@import url('theme.css');
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&display=swap');

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--darker-bg);
    color: var(--text-main);
    line-height: 1.6;
    padding-top: 70px;
    /* Absolute stability: reserve space for scrollbar on both sides to keep layout perfectly centered */
    scrollbar-gutter: stable both-edges;
}

@media (max-width: 850px) {
    body {
        scrollbar-gutter: auto;
        /* Disable gutter on mobile to save space and prevent overflow issues */
    }
}

/* Scroll Lock Utility */
.lock-scroll {
    overflow: hidden !important;
    overflow-y: hidden !important;
    touch-action: none;
    -ms-touch-action: none;
}

/* Premium Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border: 3px solid var(--scrollbar-track);
    border-radius: 10px;
    transition: all 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2100;
    background: rgba(2, 6, 23, 0.4);
    backdrop-filter: blur(12px) saturate(150%);
    -webkit-backdrop-filter: blur(12px) saturate(150%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    height: 70px;
    display: flex;
    align-items: center;
}

.nav-container {
    width: 100%;
    padding: 0 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    transition: var(--transition);
}

.nav-logo:hover {
    transform: scale(1.02);
}

.logo-text {
    font-family: 'Space Grotesk', sans-serif !important;
    font-weight: 800;
    font-size: 1.35rem;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #fff 0%, #8B5CF6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px rgba(139, 92, 246, 0.3));
    white-space: nowrap;
    /* Prevent font-load shift */
    display: inline-block;
    min-width: 180px;
}

.nav-links {
    display: flex;
    gap: 32px;
    /* Balanced gap for various screen sizes */
    justify-content: center;
    white-space: nowrap;
    margin: 0 auto;
    z-index: 10;
}

/* Wide screen spacing - still perfectly centered */
@media (min-width: 1400px) {
    .nav-links {
        gap: 80px;
    }
}

.nav-link {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    padding: 0 4px;
    height: 32px;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
    letter-spacing: 0.3px;
}

.nav-link:hover,
.nav-link.active {
    background: linear-gradient(135deg, #ffffff 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
    text-shadow: none;
    /* Gradient doesn't work well with text-shadow */
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary-gradient);
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    border-radius: 4px;
    transform: translateX(-50%);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
    background: linear-gradient(90deg, #ffffff, #a5b4fc);
}

/* AI Builder - Primary Highlight */
.nav-link-featured {
    background: linear-gradient(90deg, #a5b4fc, #c084fc, #818cf8, #a5b4fc);
    background-size: 300% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800 !important;
    animation: shine 4s linear infinite;
    padding: 0 12px;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.nav-link-featured:hover {
    transform: scale(1.05) translateY(-1px);
    filter: drop-shadow(0 0 10px rgba(165, 180, 252, 0.5));
}

/* Templates - Secondary Highlight */
.nav-link-templates {
    background: linear-gradient(90deg, #5eead4, #2dd4bf, #14b8a6, #5eead4);
    background-size: 300% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700 !important;
    animation: shine 5s linear infinite reverse;
    padding: 0 12px;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.nav-link-templates:hover {
    transform: scale(1.05) translateY(-1px);
    filter: drop-shadow(0 0 10px rgba(45, 212, 191, 0.5));
}

@keyframes shine {
    to {
        background-position: 300% center;
    }
}

.auth-container {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: flex-end;
    flex: 1 1 0%;
    min-width: 200px;
    /* Fixed anchor for layout stability */
    z-index: 20;
}

/* Theme Toggle Nav Button */
.theme-toggle-nav {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
    overflow: hidden;
    padding: 0;
    flex-shrink: 0;
    backdrop-filter: blur(4px);
}

.theme-toggle-nav:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.3),
        0 0 10px rgba(99, 102, 241, 0.2);
}

/* Light mode specific theme toggle */
[data-theme="light"] .theme-toggle-nav {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.1);
    color: #1e293b;
}

[data-theme="light"] .theme-toggle-nav:hover {
    background: rgba(0, 0, 0, 0.08);
    border-color: #6366f1;
}

.theme-toggle-nav i,
.theme-toggle-nav svg {
    width: 18px !important;
    height: 18px !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    margin-top: -9px !important;
    margin-left: -9px !important;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] .sun-icon {
    transform: translateY(30px) rotate(180deg);
    opacity: 0;
}

[data-theme="dark"] .moon-icon {
    transform: translateY(0) rotate(0);
    opacity: 1;
}

[data-theme="light"] .moon-icon {
    transform: translateY(-30px) rotate(-180deg);
    opacity: 0;
}

[data-theme="light"] .sun-icon {
    transform: translateY(0) rotate(0);
    opacity: 1;
}

/* Ensure icons are hidden correctly even before JS fully boots */
.sun-icon,
.moon-icon {
    pointer-events: none;
}

[data-theme="light"] .theme-toggle-nav {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
    color: #1e293b;
}

[data-theme="light"] .theme-toggle-nav:hover {
    background: rgba(0, 0, 0, 0.06);
    border-color: #4f46e5;
}

.btn-auth {
    text-decoration: none;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
    background-size: 200% auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--white);
    padding: 6px 20px;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    box-shadow:
        0 4px 15px rgba(99, 102, 241, 0.2),
        inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    align-items: center;
    justify-content: center;
    letter-spacing: 0.5px;
}

.btn-auth:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow:
        0 8px 25px rgba(99, 102, 241, 0.4),
        0 0 15px rgba(139, 92, 246, 0.2);
    background-position: right center;
    filter: brightness(1.1);
}

.nav-logo-dynamic {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 0%;
    min-width: 200px;
    /* Fixed anchor for layout stability */
    z-index: 20;
}

.btn-tiny-auth {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    background: var(--primary-gradient);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.btn-tiny-auth:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.mobile-auth-trigger {
    display: none;
    min-width: 60px;
    /* Maintain space for avatar/btn */
    justify-content: center;
    z-index: 100;
}


/* Mobile Menu Button (Hamburger) */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--white);
    padding: 8px;
    z-index: 1002;
    transition: transform 0.2s;
    grid-column: 3;
    justify-self: end;
}

.mobile-menu-btn.active {
    transform: rotate(90deg);
}

/* Mobile Nav Overlay */
.mobile-nav-overlay {
    position: fixed;
    top: 70px;
    left: 0;
    width: 100%;
    height: calc(100vh - 70px);
    background: rgba(2, 6, 23, 0.95);
    backdrop-filter: blur(12px);
    z-index: 2050 !important;
    /* Above editor resizer (1000) but below navbar (2100) */
    display: flex;
    flex-direction: column;
    padding: 24px;
    gap: 20px;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-nav-overlay.active {
    transform: translateX(0);
}

.mobile-nav-utility-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    margin-bottom: 8px;
}

.utility-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mobile-nav-links {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

.mobile-nav-link {
    font-size: 1.1rem;
    padding: 12px;
    border-radius: 8px;
    color: var(--text-main);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s;
}

.mobile-nav-link.active,
.mobile-nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Mobile Featured Styles */
.mobile-nav-link-featured {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(168, 85, 247, 0.15) 100%) !important;
    border: 1px solid rgba(168, 85, 247, 0.4) !important;
    position: relative;
    overflow: hidden;
}

.mobile-nav-link-templates {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.15) 0%, rgba(45, 212, 191, 0.15) 100%) !important;
    border: 1px solid rgba(20, 184, 166, 0.4) !important;
    position: relative;
    overflow: hidden;
}

.mobile-nav-link-featured::after,
.mobile-nav-link-templates::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60px;
    height: 100%;
    background: linear-gradient(to right,
            transparent,
            rgba(255, 255, 255, 0.15),
            transparent);
    transform: skewX(-25deg);
    animation: mobileShimmer 3s infinite;
}

@keyframes mobileShimmer {
    0% {
        left: -100%;
    }

    30% {
        left: 150%;
    }

    100% {
        left: 150%;
    }
}

.mobile-nav-link-featured::before {
    content: '✨';
    font-size: 0.9rem;
    margin-right: 8px;
    filter: drop-shadow(0 0 5px rgba(165, 180, 252, 0.5));
}

.mobile-auth-container {
    margin-top: auto;
    border-top: 1px solid var(--glass-border);
    padding-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-icon {
    font-size: 1.2rem;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
}

.btn-logout {
    background: rgba(244, 63, 94, 0.1);
    border: 1px solid rgba(244, 63, 94, 0.2);
    color: #fb7185;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-logout:hover {
    background: #f43f5e;
    color: white;
}

/* Global Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    font-size: 0.95rem;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.btn-primary {
    background: var(--primary-gradient);
    color: var(--white);
    background-size: 200% auto;
    box-shadow: 0 10px 20px -5px rgba(99, 102, 241, 0.4);
    position: relative;
    overflow: hidden;
    font-weight: 700;
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.btn-primary::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -100%;
    width: 80px;
    height: 200%;
    background: linear-gradient(to right,
            transparent,
            rgba(255, 255, 255, 0.2),
            transparent);
    transform: rotate(25deg);
    animation: btnShimmer 4s infinite;
}

@keyframes btnShimmer {
    0% {
        left: -100%;
    }

    25% {
        left: 150%;
    }

    100% {
        left: 150%;
    }
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 20px 40px -10px rgba(99, 102, 241, 0.6),
        0 0 20px rgba(99, 102, 241, 0.3);
    background-position: right center;
}

.btn-primary:active {
    transform: translateY(-1px) scale(0.98);
}

.btn-secondary {
    background: var(--glass);
    color: var(--white);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}


/* Modal Base (for fallback) */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(2, 6, 23, 0.8);
    backdrop-filter: blur(8px);
}

.modal-content {
    background: #1e293b;
    margin: 10% auto;
    padding: 40px;
    border: 1px solid var(--glass-border);
    width: 90%;
    max-width: 400px;
    border-radius: 20px;
    box-shadow: var(--shadow);
}

/* Alert Modal (e.g. "No changes to compile") */
.alert-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    inset: 0;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
}

.alert-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.75);
    backdrop-filter: blur(4px);
}

.alert-modal-content {
    position: relative;
    background: #1e293b;
    border: 1px solid var(--glass-border);
    padding: 32px 40px;
    border-radius: 16px;
    width: 90%;
    max-width: 380px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    animation: alertPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 1;
}

@keyframes alertPop {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.alert-modal-icon {
    font-size: 3rem;
    margin-bottom: 20px;
    display: block;
}

.alert-modal-message {
    font-size: 1.1rem;
    color: var(--text-main);
    font-weight: 500;
    margin-bottom: 28px;
    line-height: 1.5;
}

.btn-alert-ok {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 10px 32px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.btn-alert-ok:hover {
    transform: translateY(-1px);
    filter: brightness(1.1);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-alert-ok:active {
    transform: translateY(0);
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.status-ready {
    background: rgba(99, 102, 241, 0.1);
    color: #a5b4fc;
}

.status-loading {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.status-error {
    background: rgba(244, 63, 94, 0.1);
    color: #f43f5e;
}

.status-success {
    background: rgba(99, 102, 241, 0.1);
    color: #a5b4fc;
}

/* Tablet/Small Laptop Optimization */
@media (min-width: 769px) and (max-width: 1220px) {
    .nav-container {
        padding: 0 16px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .nav-logo-dynamic,
    .auth-container {
        flex: 1 1 0%;
    }

    .nav-links {
        display: flex;
        gap: 10px;
        /* Even tighter gap for medium screens */
        margin: 0 auto;
        z-index: 10;
        width: auto;
    }

    .nav-link {
        font-size: 0.8rem;
        padding: 4px 6px;
    }

    .nav-logo {
        font-size: 1.1rem;
    }

    /* Scale down logo text instead of hiding it too early */
    @media (max-width: 1150px) {
        .logo-text {
            font-size: 0.9rem;
        }

        .nav-links {
            gap: 16px;
        }
    }
}

@media (max-width: 850px) {
    .nav-links {
        display: none;
    }

    .nav-container {
        width: 100%;
        padding: 0 12px;
        display: grid !important;
        /* Critical: Enable grid for grid-column children to work */
        /* Left: Auth Trigger, Center: Logo, Right: Menu */
        grid-template-columns: auto 1fr auto;
        align-items: center;
        gap: 8px;
        overflow: hidden;
        /* Prevent any internal animation from pushing navbar width */
    }

    .logo-text {
        min-width: unset !important;
        font-size: 1rem !important;
    }

    .mobile-auth-trigger {
        display: flex;
        align-items: center;
        grid-column: 1;
        justify-self: start;
    }

    /* Hide desktop-only triggers on mobile */
    .auth-container #authBtn,
    .auth-container #profileAvatar,
    #themeToggleNav,
    #authBtn,
    #profileAvatar,
    .btn-auth {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    /* Keep the container and dropdown viable so the absolute-positioned menu still works */
    .auth-container,
    .profile-dropdown {
        display: block !important;
        width: 0;
        height: 0;
        margin: 0;
        padding: 0;
        position: absolute;
        top: 0;
        right: 0;
    }

    .profile-menu {
        position: fixed;
        top: 70px;
        right: 12px;
        width: calc(100% - 24px);
        max-width: 280px;
        z-index: 2200;
        /* Above navbar for dropdown clarity */
    }

    /* Adjust Auth Button for Mobile */
    .btn-auth {
        padding: 6px 10px;
        font-size: 0.75rem;
        white-space: nowrap;
    }

    /* Logo in Center */
    .nav-logo-dynamic {
        grid-column: 2;
        justify-self: center;
        width: 100%;
        justify-content: center;
        min-width: 0 !important;
    }

    .nav-logo {
        justify-content: center;
        font-size: 1rem;
    }

    .nav-logo .logo-text {
        display: block;
    }

    /* Hide logo icon and text on very small screens to prevent crowding */
    @media (max-width: 417px) {
        .nav-logo img {
            height: 24px;
            width: 24px;
        }

        .logo-text {
            font-size: 0.85rem;
        }
    }

    @media (max-width: 344px) {

        .nav-logo .logo-text,
        .nav-logo img {
            display: none !important;
        }
    }

    /* Menu on Right */
    .mobile-menu-btn {
        display: block;
        grid-column: 3;
        justify-self: end;
    }

    /* Ensure the auth container inside the overlay is visible as a fallback */
    .mobile-auth-container {
        display: flex;
    }
}

/* ========================================
   PREMIUM SKELETON LOADING SYSTEM
   ======================================== */

/* Full-page loader overlay */
.app-loader {
    position: fixed;
    inset: 0;
    background: #020617;
    /* Solid Dark Navy to ensure full coverage */
    z-index: 100000;
    /* Extremely high to cover navbar (2100) */
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

/* Active state - visible */
.app-loader.active {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

/* Loader content wrapper */
.app-loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
    padding: 32px 56px;
    background: #0f172a;
    /* Solid background for certainty */
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    box-shadow:
        0 25px 80px rgba(0, 0, 0, 0.8),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    width: auto;
    max-width: 95vw;
}

/* Premium Skeleton Loader Container */
.skeleton-loader {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

/* Skeleton Header */
.skeleton-loader-header {
    display: flex;
    align-items: center;
    gap: 16px;
}

.skeleton-avatar {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.1) 100%);
    position: relative;
    overflow: hidden;
}

.skeleton-header-lines {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.skeleton-line {
    height: 16px;
    border-radius: 8px;
    background: #707d91;
    /* Much lighter for clarity */
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: block !important;
    margin-bottom: 12px;
}

.skeleton-line.w-70 {
    width: 70%;
}

.skeleton-line.w-50 {
    width: 50%;
}

.skeleton-line.w-85 {
    width: 85%;
}

.skeleton-line.w-40 {
    width: 40%;
}

/* Skeleton Cards Grid */
.skeleton-cards {
    display: flex;
    gap: 16px;
}

.skeleton-card-item {
    flex: 1;
    height: 80px;
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
}

/* Premium Shimmer Animation */
.skeleton-avatar::after,
.skeleton-line::after,
.skeleton-card-item::after,
.skeleton-rect::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.03) 20%,
            rgba(255, 255, 255, 0.08) 50%,
            rgba(255, 255, 255, 0.03) 80%,
            transparent 100%);
    animation: skeletonShimmer 1.8s ease-in-out infinite;
}

.skeleton-line::after {
    animation-delay: 0.1s;
}

.skeleton-card-item:nth-child(1)::after {
    animation-delay: 0s;
}

.skeleton-card-item:nth-child(2)::after {
    animation-delay: 0.15s;
}

.skeleton-card-item:nth-child(3)::after {
    animation-delay: 0.3s;
}

@keyframes skeletonShimmer {
    0% {
        left: -100%;
    }

    60%,
    100% {
        left: 100%;
    }
}

/* Skeleton Footer Lines */
.skeleton-footer {
    display: flex;
    width: 100%;
}

/* Workspace Specific Skeleton Loader */
.skeleton-workspace {
    display: flex !important;
    gap: 40px;
    width: 100%;
    width: 850px;
    max-width: 100%;
    height: 380px;
    padding: 20px;
}

.skeleton-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.skeleton-divider {
    width: 2px;
    background: rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
}

.skeleton-divider::after {
    content: '';
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg,
            transparent 0%,
            rgba(255, 255, 255, 0.05) 50%,
            transparent 100%);
    animation: skeletonShimmerVertical 2s ease-in-out infinite;
}

@keyframes skeletonShimmerVertical {
    0% {
        top: -100%;
    }

    60%,
    100% {
        top: 100%;
    }
}

.skeleton-rect {
    width: 100%;
    min-height: 220px;
    background: #334155;
    /* Lighter slate blue for better visibility */
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    display: block !important;
    flex-direction: column;
}

.skeleton-rect.h-large {
    flex: 1;
    /* Best for filling panels */
    min-height: 200px;
}

.skeleton-rect.h-medium {
    height: 160px;
}

.skeleton-rect.h-small {
    height: 32px;
}

/* Light mode workspace overrides */
[data-theme="light"] .skeleton-workspace {
    width: 850px;
    max-width: 100%;
}

[data-theme="light"] .skeleton-divider {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .skeleton-rect {
    background: #f1f5f9 !important;
    border-color: #e2e8f0;
}

[data-theme="light"] .skeleton-line,
[data-theme="light"] .skeleton-section-title,
[data-theme="light"] .skeleton-avatar,
[data-theme="light"] .skeleton-card-item {
    background: #f1f5f9 !important;
    border-color: #f8fafc;
}

[data-theme="light"] .skeleton-rect::after,
[data-theme="light"] .skeleton-line::after,
[data-theme="light"] .skeleton-avatar::after,
[data-theme="light"] .skeleton-card-item::after {
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(0, 0, 0, 0.02) 20%,
            rgba(0, 0, 0, 0.08) 50%,
            rgba(0, 0, 0, 0.02) 80%,
            transparent 100%) !important;
}

[data-theme="light"] .skeleton-divider::after {
    background: linear-gradient(180deg,
            transparent 0%,
            rgba(0, 0, 0, 0.03) 50%,
            transparent 100%);
}

/* Responsiveness for the workspace skeleton */
@media (max-width: 900px) {
    .skeleton-workspace {
        min-width: unset;
        flex-direction: column;
        height: auto;
    }

    .skeleton-divider {
        width: 100%;
        height: 2px;
    }
}


/* Status message */
.app-loader-message {
    color: var(--text-main);
    font-size: 1.05rem;
    font-weight: 600;
    text-align: center;
    letter-spacing: 0.4px;
    min-width: 200px;
    background: linear-gradient(135deg, #f8fafc 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: messagePulse 2.5s ease-in-out infinite;
}

@keyframes messagePulse {

    0%,
    100% {
        opacity: 1;
        transform: translateY(0);
    }

    50% {
        opacity: 0.7;
        transform: translateY(-2px);
    }
}

/* Loading Dots Animation (optional enhancement) */
.loader-dots {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 8px;
}

.loader-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    animation: dotBounce 1.4s ease-in-out infinite;
}

.loader-dot:nth-child(1) {
    animation-delay: 0s;
}

.loader-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.loader-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dotBounce {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Mobile responsive */
@media (max-width: 600px) {
    .app-loader-content {
        padding: 32px 28px;
        margin: 0 20px;
        min-width: unset;
        width: calc(100% - 40px);
        max-width: 320px;
    }

    .skeleton-cards {
        flex-direction: column;
        gap: 12px;
    }

    .skeleton-card-item {
        height: 60px;
    }

    .skeleton-avatar {
        width: 44px;
        height: 44px;
    }

    .app-loader-message {
        font-size: 0.95rem;
        min-width: unset;
    }

    .loader-dot {
        width: 6px;
        height: 6px;
    }
}

/* ========================================
   MODERN PROFILE DROPDOWN
   ======================================== */

/* Profile Avatar Button */
.profile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    /* Super-elliptical look */
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 0.85rem;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.profile-avatar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(255, 255, 255, 0.2), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.profile-avatar:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow:
        0 8px 20px rgba(99, 102, 241, 0.3),
        0 0 0 4px rgba(99, 102, 241, 0.1);
}

.profile-avatar:hover::after {
    opacity: 1;
}

/* Dropdown Container */
.profile-dropdown {
    position: relative;
    display: inline-block;
}

.profile-menu {
    position: absolute;
    top: calc(100% + 15px);
    right: 0;
    background: rgba(10, 15, 28, 0.9);
    /* Even deeper dark */
    backdrop-filter: blur(30px) saturate(200%);
    -webkit-backdrop-filter: blur(30px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    min-width: 260px;
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    opacity: 0;
    visibility: hidden;
    transform: translateY(15px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1000;
    overflow: hidden;
}

.profile-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Menu Items */
.profile-menu-header {
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.profile-menu-name {
    font-weight: 700;
    color: var(--white);
    font-size: 1rem;
    display: block;
    margin-bottom: 4px;
    letter-spacing: -0.3px;
}

.profile-menu-email {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.profile-menu-items {
    padding: 8px 0;
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.profile-menu-item i {
    width: 18px;
    height: 18px;
    opacity: 0.7;
    transition: all 0.2s ease;
}

.profile-menu-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--white);
}

.profile-menu-item:hover i {
    opacity: 1;
    transform: translateX(3px);
    color: var(--primary-light);
}

.profile-menu-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.profile-menu-divider {
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.1), transparent);
    margin: 10px 0;
}

.profile-menu-item.logout {
    color: #fb7185;
    margin-top: 4px;
}

.profile-menu-item.logout:hover {
    background: rgba(244, 63, 94, 0.12);
    color: #ff4d6d;
}

.profile-menu-item.logout:hover i {
    color: #ff4d6d;
    transform: translateX(3px);
}

/* Hide old user profile */
.user-profile {
    display: none !important;
}

/* Mobile responsive */
@media (max-width: 600px) {
    .profile-menu {
        min-width: 180px;
        right: -10px;
    }
}

/* Footer */
.footer {
    padding: 60px 0;
    border-top: 1px solid var(--glass-border);
    text-align: center;
    background: var(--darker-bg);
}

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

.footer-links {
    display: flex;
    gap: clamp(12px, 4vw, 32px);
    justify-content: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    /* Ensure it wraps if screen is extremely narrow */
}

.footer-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    transition: var(--transition);
    white-space: nowrap;
}

.footer-link:hover {
    color: var(--white);
}

/* Developer Socials */
.footer-socials {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
}

.social-link {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.social-link:hover {
    background: var(--primary-gradient);
    border-color: transparent;
    color: white;
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

.social-link i {
    width: 20px;
    height: 20px;
}

.footer-copyright {
    color: #475569;
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .footer {
        padding: 40px 20px;
    }

    .footer-links {
        gap: clamp(8px, 3vw, 20px);
        margin-bottom: 20px;
    }
}

/* FIX: Ensure Profile Menu sits below header on mobile and doesn't overlap text */
@media (max-width: 768px) {
    .profile-menu {
        position: fixed !important;
        top: 80px !important;
        /* Clear gap below navbar */
        left: 12px !important;
        /* Align with the Left Avatar Trigger */
        right: auto !important;
        /* Do not force to right */
        width: auto !important;
        min-width: 260px !important;
        max-width: 85vw !important;
        background: #1e293b !important;
        border: 1px solid var(--glass-border) !important;
        border-radius: 12px !important;
        /* Full rounded corners */
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5) !important;
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}