/* ========== AI METAGEN PRO - MASTER THEME & LAYOUT CSS ========== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ========== 1. COMPLETE THEME VARIABLES ========== */
:root {
    /* Dark Mode (Default) */
    --bg-primary: #030014;
    --bg-secondary: #0b0521;
    --bg-tertiary: #1E293B;
    --bg-card: #0e072b;
    --bg-input: #0F172A;
    --bg-modal: #1e1338;

    --text-primary: #F8FAFC;
    --text-secondary: #E2E8F0;
    --text-muted: #94A3B8;
    --text-label: #b6babf;

    --border-color: #334155;
    --border-light: #30363D;

    --accent: #F97316;
    --accent-hover: #ea580c;
    --accent-orange: #F97316;
    --accent-orange-hover: #ea580c;
    --accent-blue: #3B82F6;
    --accent-blue-dark: #2563EB;
    --accent-green: #10B981;
    --code-bg: #1e1e2f;

    --shadow-sm: rgba(0, 0, 0, 0.25);
    --shadow-md: rgba(0, 0, 0, 0.45);
    --shadow-lg: rgba(0, 0, 0, 0.65);

    --header-height: 70px;
    --transition-speed: 0.3s;
}

/* Light Mode Overrides */
html.light-mode,
body.light-mode {
    --bg-primary: #F8FAFC;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #F1F5F9;
    --bg-card: #F2F3F4;
    --bg-input: #FFFFFF;
    --bg-modal: #FFFFFF;

    --text-primary: #0F172A;
    --text-secondary: #1E293B;
    --text-muted: #64748B;
    --text-label: #475569;

    --border-color: #CBD5E1;
    --border-light: #E2E8F0;

    --shadow-sm: rgba(0, 0, 0, 0.05);
    --shadow-md: rgba(0, 0, 0, 0.1);
    --shadow-lg: rgba(0, 0, 0, 0.15);
    --code-bg: #f1f5f9;
}

/* ========== 2. GLOBAL RESET & BASE STYLES ========== */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--accent-orange);
}

.page-content-wrapper {
    flex: 1 0 auto;
    width: 100%;
    margin-top: var(--header-height);
    padding-bottom: 50px;
}

/* ========== 3. MASTER APP HEADER ========== */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(3, 0, 20, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 25px;
    z-index: 9999;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

html.light-mode .app-header,
body.light-mode .app-header {
    background: rgba(255, 255, 255, 0.95);
}

.sidebar-toggle-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    margin-right: 12px;
    border-radius: 6px;
}

.sidebar-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.header-brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.brand-text-wrapper {
    display: flex;
    flex-direction: column;
}

.header-brand-name {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.3px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.brand-pro-badge {
    color: #fff;
    padding: 2px 7px;
    font-size: 0.68em;
    font-weight: 700;
    border-radius: 5px;
    transform: skewX(-10deg);
    background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

.header-brand-tagline {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Nav links */
.header-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 30px;
}

.nav-btn {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 8px;
    transition: all 0.2s ease;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.nav-btn:hover,
.nav-btn.active {
    color: var(--accent-orange);
    background: rgba(249, 115, 22, 0.1);
    border-color: rgba(249, 115, 22, 0.25);
}

/* Nav Dropdown */
.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 230px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 15px 35px var(--shadow-md);
    padding: 8px;
    z-index: 1000;
}

.nav-dropdown:hover .nav-dropdown-content {
    display: block;
    animation: dropIn 0.2s ease-out;
}

@keyframes dropIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.dropdown-link:hover {
    background: rgba(249, 115, 22, 0.12);
    color: var(--accent-orange);
    transform: translateX(3px);
}

.dropdown-link i {
    width: 18px;
    text-align: center;
    color: var(--accent-blue);
}

/* Header Right Actions */
.header-actions-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-toggle-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s ease;
    text-decoration: none;
    color: var(--text-primary);
}

.theme-toggle-btn:hover {
    border-color: var(--accent-orange);
    transform: scale(1.05);
}

/* ========== 4. MASTER FOOTER ========== */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 50px 20px 20px;
    margin-top: auto;
    width: 100%;
}

.footer .container {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-top {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 40px;
    margin-bottom: 30px;
}

.footer-brand {
    flex: 1 1 280px;
}

.footer-brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.footer-nav-links {
    display: none !important;
}

.footer-columns {
    flex: 2 1 680px;
    display: grid !important;
    grid-template-columns: repeat(5, minmax(130px, 1fr)) !important;
    gap: 25px !important;
    margin-left: 0 !important;
}

@media (max-width: 1024px) {
    .footer-columns {
        grid-template-columns: repeat(3, minmax(130px, 1fr)) !important;
        gap: 20px !important;
    }
}

@media (max-width: 640px) {
    .footer-columns {
        grid-template-columns: repeat(2, minmax(130px, 1fr)) !important;
        gap: 16px !important;
    }
}

.footer-column {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    text-align: left !important;
    gap: 0 !important;
}

.footer-column h4 {
    margin: 0 0 16px 0 !important;
    padding: 2px 0 2px 8px !important;
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
    border-left: 3px solid var(--accent-orange) !important;
    text-align: left !important;
    line-height: 1.3 !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.footer-column ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    text-align: left !important;
    width: 100% !important;
}

.footer-column li {
    margin: 0 !important;
    padding: 0 !important;
    text-align: left !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    width: 100% !important;
}

.footer-column a,
.footer-column span,
.footer-link {
    color: var(--text-muted) !important;
    text-decoration: none !important;
    font-size: 0.9rem !important;
    text-align: left !important;
    transition: all 0.2s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
}

.footer-column a:hover {
    color: var(--accent-orange) !important;
    text-decoration: none !important;
    transform: translateX(3px) !important;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.social-links {
    display: flex;
    gap: 14px;
}

.social-links a {
    color: var(--text-muted);
    font-size: 1.15rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
}

.social-links a:hover {
    color: var(--accent-orange);
    transform: translateY(-2px);
    border-color: var(--accent-orange);
}

/* ========== 5. MOBILE RESPONSIVE ========== */
@media (max-width: 900px) {
    .sidebar-toggle-btn {
        display: block;
    }

    .header-nav {
        display: none;
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--bg-primary);
        flex-direction: column;
        align-items: flex-start;
        padding: 20px;
        gap: 10px;
        margin-left: 0;
        overflow-y: auto;
        border-top: 1px solid var(--border-color);
    }

    .header-nav.active {
        display: flex;
    }

    .nav-btn {
        width: 100%;
        justify-content: flex-start;
        padding: 12px;
        font-size: 1rem;
    }

    .nav-dropdown {
        width: 100%;
    }

    .nav-dropdown-content {
        position: static;
        box-shadow: none;
        padding-left: 20px;
        background: transparent;
        border: none;
    }

    .footer-top {
        flex-direction: column;
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }
}
