/* ==========================================================================
   Layout CSS - MoltShell
   Grid, Container, Sections, Responsive
   ========================================================================== */

/* --------------------------------------------------------------------------
   Container
   -------------------------------------------------------------------------- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.container-sm {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.container-lg {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* --------------------------------------------------------------------------
   Page Content (for legal/info pages)
   -------------------------------------------------------------------------- */
.page-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 7.5rem 1.5rem 5rem;
}

.page-header {
    margin-bottom: 2.5rem;
}

.page-header h1 {
    font-size: 2.5rem;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

/* --------------------------------------------------------------------------
   Section Headers
   -------------------------------------------------------------------------- */
.section-header {
    text-align: center;
    margin-bottom: 4.5rem;
}

.section-header h2 {
    font-size: 2.4em;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.section-header p {
    color: var(--text-secondary);
    font-size: 1.15em;
    max-width: 600px;
    margin: 0 auto;
}

/* --------------------------------------------------------------------------
   Grids
   -------------------------------------------------------------------------- */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.75rem;
}

.grid-5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.5rem;
}

/* Feature Grid */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

/* Auto-fit grids */
.grid-auto {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.25rem;
}

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */
section {
    padding: 5rem 1.5rem;
}

.section-alt {
    background: var(--bg-secondary);
}

/* Stats Section */
.stats-section {
    padding: 5rem 1.5rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.stats-grid {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.5rem;
}

/* Standards Section */
.standards {
    padding: 6.25rem 1.5rem;
    background: var(--bg-secondary);
}

.standards-container {
    max-width: 1000px;
    margin: 0 auto;
}

.standards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-top: 3rem;
}

.standard-item {
    text-align: center;
    padding: 2rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
}

.standard-item h4 {
    font-size: 0.95em;
    color: var(--primary-blue);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.standard-item p {
    font-size: 0.85em;
    color: var(--text-muted);
    margin: 0;
}

/* Use Cases Section */
.use-cases {
    padding: 7.5rem 1.5rem;
    background: var(--gradient-section);
}

.use-cases-grid {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.75rem;
}

.use-case-card {
    text-align: center;
    padding: 2.5rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    transition: all 0.3s;
}

.use-case-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover);
}

.use-case-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.25rem;
    background: var(--gradient-primary, linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 100%));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.use-case-icon svg {
    width: 32px;
    height: 32px;
    stroke: white;
    fill: none;
    stroke-width: 1.5;
}

.use-case-card h3 {
    font-size: 1.1em;
    margin-bottom: 0.75rem;
}

.use-case-card p {
    color: var(--text-secondary);
    font-size: 0.95em;
    line-height: 1.6;
    margin: 0;
}

/* Features Section */
.features {
    padding: 7.5rem 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Code Section */
.code-section {
    padding: 7.5rem 1.5rem;
}

.code-container {
    max-width: 900px;
    margin: 0 auto;
}

.code-block {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

.code-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.code-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.code-dot.red { background: #ff5f57; }
.code-dot.yellow { background: #ffbd2e; }
.code-dot.green { background: #28c840; }

.code-title {
    margin-left: 0.75rem;
    color: var(--text-muted);
    font-size: 0.85em;
    font-weight: 500;
}

/* CTA Section */
.cta-section {
    padding: 7.5rem 1.5rem;
    text-align: center;
    background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    position: relative;
}

.cta-section h2 {
    font-size: 2.4em;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
}

.cta-section p {
    color: var(--text-secondary);
    font-size: 1.15em;
    margin-bottom: 2.5rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.cta-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Built For Section */
.built-for {
    padding: 5rem 1.5rem;
    background: var(--bg-secondary);
    text-align: center;
    border-top: 1px solid var(--border);
}

.built-for h3 {
    font-size: 1em;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 2rem;
}

.built-for-logos {
    display: flex;
    justify-content: center;
    gap: 4rem;
    flex-wrap: wrap;
    opacity: 0.5;
}

.built-for-placeholder {
    font-size: 0.9em;
    color: var(--text-muted);
    font-style: italic;
}

/* --------------------------------------------------------------------------
   Stats Bar (for Explorer)
   -------------------------------------------------------------------------- */
.stats-bar {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 2.5rem;
    padding: 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
}

.stats-bar .stat {
    text-align: center;
    padding: 0 1.5rem;
    border-right: 1px solid var(--border);
}

.stats-bar .stat:last-child {
    border-right: none;
}

.stats-bar .stat-value {
    font-size: 1.5em;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
}

.stats-bar .stat-label {
    font-size: 0.8em;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* --------------------------------------------------------------------------
   Docs Layout
   -------------------------------------------------------------------------- */
.docs-layout {
    display: flex;
    padding-top: 65px;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    position: fixed;
    top: 65px;
    left: 0;
    bottom: 0;
    padding: 2rem 1.5rem;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    overflow-y: auto;
}

.sidebar-section {
    margin-bottom: 1.75rem;
}

.sidebar-title {
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.sidebar-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-links a {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9em;
    border-radius: 6px;
    transition: all 0.2s;
    margin-bottom: 0.125rem;
}

.sidebar-links a:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.sidebar-links a.active {
    color: var(--primary-blue);
    background: rgba(0, 51, 153, 0.1);
}

.theme-neon .sidebar-links a.active {
    color: var(--accent-pink);
    background: rgba(255,110,180,0.1);
}

.theme-neon[data-theme="light"] .sidebar-links a.active {
    background: rgba(30,86,160,0.1);
}

/* Docs Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 3rem 4rem;
    max-width: 900px;
}

/* --------------------------------------------------------------------------
   Detail Views (for Explorer)
   -------------------------------------------------------------------------- */
.detail-view {
    display: none;
}

.detail-view.active {
    display: block;
}

.detail-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.back-btn {
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s;
}

.back-btn:hover {
    border-color: var(--primary-blue);
}

.theme-neon .back-btn:hover {
    border-color: var(--accent-pink);
}

.detail-title {
    font-size: 1.4em;
    font-weight: 700;
}

.detail-subtitle {
    color: var(--text-muted);
    font-size: 0.9em;
}

.detail-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--card-shadow);
}

.detail-section h3 {
    font-size: 1em;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.detail-row {
    display: flex;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    width: 180px;
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 0.9em;
}

.detail-value {
    flex: 1;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9em;
    word-break: break-all;
}

/* --------------------------------------------------------------------------
   Tabs
   -------------------------------------------------------------------------- */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.tab-btn {
    padding: 0.625rem 1.25rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: rgba(0, 51, 153, 0.1);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--gradient-primary);
    color: white;
}

.theme-neon .tab-btn:hover {
    background: rgba(255,110,180,0.1);
}

.theme-neon .tab-btn.active {
    background: var(--gradient-1);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* --------------------------------------------------------------------------
   Search
   -------------------------------------------------------------------------- */
.search-container {
    margin-bottom: 2.5rem;
}

.search-box {
    display: flex;
    gap: 0.75rem;
    max-width: 800px;
    margin: 0 auto;
}

.search-input {
    flex: 1;
    padding: 1rem 1.5rem;
    font-size: 1em;
    border: 1px solid var(--border);
    border-radius: 50px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    transition: all 0.3s;
}

.search-input::placeholder {
    color: var(--text-muted);
    font-family: 'Inter', -apple-system, sans-serif;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(0, 51, 153, 0.15);
}

.theme-neon .search-input:focus {
    border-color: var(--accent-pink);
    box-shadow: 0 0 0 3px rgba(255,110,180,0.15);
}

.theme-neon[data-theme="light"] .search-input:focus {
    box-shadow: 0 0 0 3px rgba(30,86,160,0.15);
}

.search-btn {
    padding: 1rem 2rem;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 51, 153, 0.3);
}

.theme-neon .search-btn {
    background: var(--gradient-1);
}

.theme-neon .search-btn:hover {
    box-shadow: 0 10px 30px rgba(255,110,180,0.3);
}

.search-hint {
    text-align: center;
    margin-top: 0.75rem;
    color: var(--text-muted);
    font-size: 0.85em;
}

/* --------------------------------------------------------------------------
   Background Effects
   -------------------------------------------------------------------------- */
.bg-glow {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 30%, rgba(0,51,153,0.05) 0%, transparent 50%),
                radial-gradient(circle at 70% 70%, rgba(0,51,153,0.03) 0%, transparent 50%);
    animation: bgMove 20s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

.theme-neon .bg-glow {
    background: radial-gradient(circle at 30% 30%, rgba(255,110,180,0.08) 0%, transparent 50%),
                radial-gradient(circle at 70% 70%, rgba(0,212,255,0.08) 0%, transparent 50%);
}

.theme-neon[data-theme="light"] .bg-glow {
    background: radial-gradient(circle at 30% 30%, rgba(30,86,160,0.06) 0%, transparent 50%),
                radial-gradient(circle at 70% 70%, rgba(46,125,179,0.06) 0%, transparent 50%);
}

@keyframes bgMove {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-5%, -5%); }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-5 { grid-template-columns: repeat(3, 1fr); }
    .feature-grid { grid-template-columns: repeat(2, 1fr); }
    .use-cases-grid { grid-template-columns: repeat(2, 1fr); }
    .standards-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
    .sidebar { display: none; }
    .main-content { 
        margin-left: 0; 
        padding: 2rem 1.25rem;
    }
}

@media (max-width: 768px) {
    nav { padding: 1rem 1.25rem; }
    .nav-links { display: none; }
    .mobile-theme-toggle { display: flex; }
    
    section { padding: 3rem 1.25rem; }
    
    .grid-2 { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr; }
    .grid-4 { grid-template-columns: 1fr; }
    .grid-5 { grid-template-columns: repeat(2, 1fr); }
    .feature-grid { grid-template-columns: 1fr; }
    .use-cases-grid { grid-template-columns: 1fr; }
    .standards-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    
    .page-content { padding: 6.25rem 1.25rem 3.75rem; }
    .page-header h1 { font-size: 2rem; }
    
    .cta-buttons { flex-direction: column; align-items: stretch; }
    .cta-buttons .btn { justify-content: center; }
    
    .footer-main { flex-direction: column; }
    .footer-links-group { gap: 2.5rem; }
    .footer-bottom { flex-direction: column; text-align: center; }
    
    .stats-bar { flex-direction: column; gap: 1rem; }
    .stats-bar .stat {
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 0.75rem 0;
    }
    .stats-bar .stat:last-child { border-bottom: none; }
    
    .search-box { flex-direction: column; }
    .search-btn { width: 100%; }
    
    .detail-row { flex-direction: column; gap: 0.5rem; }
    .detail-label { width: 100%; }
    
    .tabs { overflow-x: auto; flex-wrap: nowrap; }
    .tab-btn { flex-shrink: 0; padding: 0.5rem 1rem; font-size: 0.85em; }
}

@media (max-width: 480px) {
    .grid-5 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr; }
}
