:root {
    --bg-cream: #fdf2e9;
    --bg-white: #ffffff;
    --primary: #7d2ae8;
    --primary-deep: #581845;
    --text-main: #1f1f1f;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --input-bg: #f9fafb;
    --card-bg: #ffffff;
    --accent: #ff4d4d;
    --danger: #ef4444;
}

/* Dark Theme Variables - Midnight Blue Palette */
.dark-theme {
    --bg-white: #0b0e14;
    /* Deep Midnight Content Background */
    --bg-cream: #0f121a;
    /* Sidebar Background */
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.08);
    --input-bg: #1c1f2b;
    /* Darker input background */
    --card-bg: #151921;
    /* Card/Elevated Surface Background */
    --primary: #6366f1;
    /* Vibrant Indigo Primary */
    --primary-deep: #4f46e5;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-white);
    color: var(--text-main);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.5;
    overflow-x: hidden;
    min-height: 100vh;
}

body.dark-theme {
    background: #0b0e14 !important;
    position: relative;
    overflow-x: hidden;
    z-index: 0;
}

body.dark-theme::before {
    content: '';
    position: fixed;
    top: -10%;
    left: -10%;
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.25) 0%, transparent 70%);
    filter: blur(120px);
    z-index: 0;
    /* Over body, under app-wrapper */
    pointer-events: none;
}

body.dark-theme::after {
    content: '';
    position: fixed;
    bottom: -10%;
    right: -10%;
    width: 50%;
    height: 50%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, transparent 70%);
    filter: blur(100px);
    z-index: 0;
    pointer-events: none;
}

.app-wrapper {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
    /* Above glows */
}

.container {
    width: 100%;
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    height: 90px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.85);
    /* Adjusted for new color scheme */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
}

.logo-box {
    width: 44px;
    height: 44px;
    background: var(--primary-deep);
    /* Adjusted for new color scheme */
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.4rem;
    color: white;
    box-shadow: 0 0 20px rgba(88, 24, 69, 0.3);
    /* Adjusted glow for new primary-deep */
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
    /* Adjusted for new color scheme */
    line-height: 1;
}

.brand-tag {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.1rem;
    margin-top: 4px;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.btn-nav {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1.8rem;
    border-radius: 100px;
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn-primary-pill {
    background: var(--primary);
    /* Adjusted for new color scheme */
    color: #fff;
    box-shadow: 0 4px 15px rgba(125, 42, 232, 0.2);
    /* Adjusted for new primary */
}

.btn-primary-pill:hover {
    background: var(--primary-deep);
    /* Adjusted for new color scheme */
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(125, 42, 232, 0.3);
    /* Adjusted for new primary */
}

.btn-secondary-pill {
    background: rgba(0, 0, 0, 0.05);
    /* Adjusted for new color scheme */
    color: var(--text-main);
    /* Adjusted for new color scheme */
    border: 1px solid var(--border);
}

.btn-secondary-pill:hover {
    background: rgba(0, 0, 0, 0.1);
    /* Adjusted for new color scheme */
    transform: translateY(-2px);
}

/* Split Screen Home Layout */
.home-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.home-left {
    flex: 1.1;
    background-color: var(--bg-cream);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 4rem;
    position: relative;
    overflow: hidden;
}

.home-right {
    flex: 0.9;
    background-color: var(--bg-white);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 4rem;
}

/* Illustration Side */
.illustration-container {
    width: 100%;
    max-width: 500px;
    text-align: center;
}

.illustration-img {
    width: 100%;
    height: auto;
    margin-bottom: 3rem;
}

.marketing-text h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-deep);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.dark-theme .marketing-text h1 {
    color: #fff;
}

.marketing-text p {
    font-size: 1.1rem;
    color: var(--primary-deep);
    opacity: 0.8;
}

.dark-theme .marketing-text p {
    color: var(--text-muted);
}

/* Auth Side */
.auth-container-home {
    width: 100%;
    max-width: 420px;
}

.auth-header-home {
    text-align: center;
    margin-bottom: 2.5rem;
}

.auth-logo {
    width: 60px;
    height: 60px;
    margin-bottom: 1.5rem;
}

.auth-header-home h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.auth-header-home p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Form Styles */
.form-group-home {
    margin-bottom: 1.5rem;
}

.form-group-home label,
.form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.form-input-home,
.form-input,
.settings-input {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: 1rem;
    font-family: inherit;
    font-size: 1rem;
    background-color: var(--input-bg);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-input-home:focus {
    outline: none;
    border-color: var(--primary);
}

.dark-theme .form-input-home,
.dark-theme .form-input,
.dark-theme .settings-input,
.dark-theme input.try-input {
    background: rgba(255, 255, 255, 0.03) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.dark-theme .form-input-home:focus,
.dark-theme .form-input:focus,
.dark-theme .settings-input:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.05) !important;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.input-icon-wrapper {
    position: relative !important;
    display: block !important;
    width: 100% !important;
}

.input-icon-wrapper i:first-child {
    position: absolute !important;
    left: 1.25rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    color: var(--text-muted);
    font-size: 1.1rem;
    transition: color 0.3s;
    z-index: 5 !important;
    pointer-events: none;
}

.input-icon-wrapper .form-input,
.input-icon-wrapper .settings-input {
    width: 100% !important;
    padding-left: 3.5rem !important;
    padding-right: 3.5rem !important;
    display: block !important;
}

.input-icon-wrapper:focus-within i {
    color: var(--primary);
}

.password-toggle {
    position: absolute !important;
    right: 1.25rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: transparent !important;
    border: none !important;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s;
    z-index: 5 !important;
}

.password-toggle:hover {
    color: var(--text-main);
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    font-size: 0.85rem;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
}

.forgot-link {
    color: var(--primary-deep);
    text-decoration: none;
    font-weight: 600;
}

.btn-auth-submit {
    width: 100%;
    padding: 1rem;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.2);
}

.btn-auth-submit:hover {
    background-color: var(--primary-deep);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(168, 85, 247, 0.3);
}

.auth-switch {
    text-align: center;
    margin-top: 2.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.auth-switch span {
    color: var(--primary);
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: 0.3s;
}

.auth-switch span:hover {
    color: #fff;
}

/* Social Login Placeholder */
.social-login {
    margin-bottom: 2rem;
}

.btn-social {
    width: 100%;
    padding: 0.85rem;
    background: white;
    border: 1.5px solid var(--border);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    transition: background 0.2s;
}

.btn-social:hover {
    background: var(--input-bg);
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    margin: 2rem 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border);
}

.divider span {
    padding: 0 1rem;
}

/* Responsive */
@media (max-width: 1024px) {
    .home-left {
        display: none;
    }

    .home-right {
        flex: 1;
        padding: 2rem;
    }
}

/* Auth Cards */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    padding: 3.5rem;
    border-radius: 2rem;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 50px 100px -20px rgba(0, 0, 0, 0.5);
}

.auth-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.auth-header h1 {
    font-size: 2.2rem;
    font-weight: 900;
    margin-bottom: 0.75rem;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-header p {
    color: var(--text-muted);
}

.form-group {
    margin-bottom: 1.8rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.75rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
}

.form-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    padding: 1rem 1.25rem;
    border-radius: 1rem;
    color: #fff;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    background: rgba(255, 255, 255, 0.05);
}

.btn-auth {
    width: 100%;
    padding: 1.1rem;
    background: var(--gradient);
    border: none;
    border-radius: 1rem;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(59, 130, 246, 0.2);
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
}

.btn-auth:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(59, 130, 246, 0.3);
}

/* Tables in Dark Mode */
.table-wrapper {
    background: var(--card-bg);
    border-radius: 1.5rem;
    border: 1px solid var(--border);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 1.25rem 1.5rem;
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
    font-weight: 700;
}

td {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
}

tr:last-child td {
    border-bottom: none;
}

.dark-theme table th {
    background: rgba(255, 255, 255, 0.02);
}

/* Footer */
.footer {
    padding: 8rem 0 4rem;
    background: #01010c;
    border-top: 1px solid var(--border);
    text-align: center;
}

.footer-desc {
    color: var(--text-muted);
    max-width: 500px;
    margin: 0 auto 3rem;
}

.footer-divider {
    height: 1px;
    background: var(--border);
    margin-bottom: 2rem;
}

.copyright {
    color: rgba(148, 163, 184, 0.4);
    font-size: 0.9rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade {
    animation: fadeIn 0.8s ease-out forwards;
}

/* Sidebar & Dashboard Compatibility */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background: rgba(15, 18, 26, 0.7);
    /* Semi-transparent */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--border);
    padding: 2.5rem 1.5rem;
    position: fixed;
    height: 100vh;
    z-index: 1001;
    transition: transform 0.3s ease;
}

.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 4rem;
    min-height: 100vh;
    background: transparent;
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 12px;
    transition: 0.3s;
    font-weight: 500;
}

.nav-link:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.03);
}

.nav-link.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 10px 20px rgba(125, 42, 232, 0.2);
}

/* Mobile Toggle (Hidden by default) */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    z-index: 1002;
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* Responsive Sidebar */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        background: #0b0e14;
        /* Match body bg for solid look */
        padding-top: 5rem;
        width: 100%;
        max-width: 280px;
        z-index: 2001;
        /* Higher than toggle */
    }

    .sidebar.show {
        transform: translateX(0);
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.8);
    }

    .main-content {
        margin-left: 0;
        padding: 6rem 1.25rem 2rem;
    }

    .sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 45px;
        height: 45px;
        padding: 0;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .table-wrapper {
        overflow-x: auto;
        border-radius: 1rem;
    }

    table {
        min-width: 700px;
    }
}

@media (max-width: 768px) {
    .home-wrapper {
        flex-direction: column;
    }

    .home-right {
        padding: 3rem 1.5rem;
    }

    .marketing-text h1 {
        font-size: 1.75rem;
    }

    .auth-card {
        padding: 2rem;
        border-radius: 1.5rem;
    }

    .auth-header h1 {
        font-size: 1.75rem;
    }

    .swagger-wrapper {
        padding: 3rem 1.25rem;
    }

    .swagger-wrapper>div:first-child {
        flex-direction: column;
        gap: 2rem;
    }

    .swagger-wrapper>div:first-child>div:last-child {
        text-align: left !important;
    }

    .image-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .hero-section h1 {
        font-size: 2.25rem !important;
    }
}

@media (max-width: 480px) {
    .brand-name {
        font-size: 1.1rem;
    }

    .navbar {
        height: 70px;
    }

    .btn-nav {
        padding: 0.5rem 1.2rem;
        font-size: 0.85rem;
    }

    .auth-container-home h2 {
        font-size: 1.5rem;
    }

    .main-content h1 {
        font-size: 1.75rem !important;
    }

    .card {
        padding: 1.5rem;
    }
}

/* Dashboard Grids */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.card {
    background: rgba(21, 25, 33, 0.6) !important;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1.5rem;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: 0.3s;
    position: relative;
    overflow: hidden;
}

.stat-card {
    background: rgba(21, 25, 33, 0.6);
    /* Glass effect */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 2rem;
    padding: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.image-card {
    background: var(--card-bg);
    border-radius: 2rem;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: 0.3s;
}

.image-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
}

.image-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
}

.image-details {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}