/* ============================================================
   NodeAIr Theme - Global Design System
   Dark glassmorphic theme based on HTML mockups
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
    --na-cyan: #06b6d4;
    --na-cyan-light: #22d3ee;
    --na-blue: #3b82f6;
    --na-blue-light: #60a5fa;
    --na-bg-dark: #020617;
    --na-bg-mid: #1e3a8a;
    --na-bg-light: #0f172a;
    --na-bg-card: rgba(15, 23, 42, 0.6);
    --na-border: rgba(6, 182, 212, 0.3);
    --na-border-hover: rgba(6, 182, 212, 0.6);
    --na-text-primary: #e2e8f0;
    --na-text-secondary: #94a3b8;
    --na-text-tertiary: #64748b;
    --na-radius: 16px;
    --na-radius-sm: 8px;
    --na-radius-lg: 24px;
    --na-transition: 0.3s ease;
    --na-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* --- Base Styles --- */
* {
    box-sizing: border-box;
}

body {
    font-family: var(--na-font);
    color: var(--na-text-primary);
    min-height: 100dvh;
    margin: 0;
    background: linear-gradient(135deg, #020617 0%, #1e3a8a 50%, #0f172a 100%);
    position: relative;
    overflow: hidden;
}

h1, h2, h3, h4, h5, h6 {
    color: #ffffff;
    font-weight: 600;
    line-height: 1.2;
}

p {
    color: var(--na-text-secondary);
    line-height: 1.6;
}

a {
    color: var(--na-cyan-light);
    text-decoration: none;
    transition: color var(--na-transition);
}

a:hover {
    color: var(--na-cyan);
}

.nodeair-app {
    position: relative;
    width: 100%;
    min-height: 100dvh;
    overflow: hidden;
}

.bg-grid {
    position: absolute;
    inset: 0;
    background-image: linear-gradient(to right, #1e293b 1px, transparent 1px), linear-gradient(to bottom, #1e293b 1px, transparent 1px);
    background-size: 4rem 4rem;
    opacity: 0.2;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    animation: float 8s ease-in-out infinite;
}

.orb1 {
    top: 25%;
    left: 25%;
    width: 384px;
    height: 384px;
    background: rgba(6, 182, 212, 0.2);
    animation-delay: 0s;
}

.orb2 {
    bottom: 25%;
    right: 25%;
    width: 384px;
    height: 384px;
    background: rgba(59, 130, 246, 0.2);
    animation-delay: -4s;
}

@keyframes float {
    0%, 100% {
        transform: scale(1) translate(0, 0);
        opacity: 0.3;
    }

    50% {
        transform: scale(1.2) translate(20px, 15px);
        opacity: 0.5;
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

/* fadeIn keyframes defined once below (near fadeInUp) */

.nodeair-content {
    position: relative;
    z-index: 1;
    height: 100dvh;
}

/* --- Glassmorphism Utilities --- */
.glass-card {
    background: var(--na-bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--na-border);
    border-radius: var(--na-radius);
    transition: all var(--na-transition);
}

.glass-card:hover {
    border-color: var(--na-border-hover);
}

.glass-input {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--na-border);
    border-radius: var(--na-radius-sm);
    color: var(--na-text-primary);
    padding: 14px 16px;
    font-size: 14px;
    font-family: var(--na-font);
    transition: all var(--na-transition);
    outline: none;
    width: 100%;
}

.glass-input::placeholder {
    color: var(--na-text-tertiary);
}

.glass-input:focus {
    border-color: var(--na-cyan);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
}

.glass-header {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--na-border);
}

/* --- Button Styles --- */
.btn-glow {
    background: linear-gradient(135deg, var(--na-cyan), var(--na-blue));
    color: #ffffff;
    border: none;
    border-radius: var(--na-radius-sm);
    padding: 14px 24px;
    cursor: pointer;
    transition: all var(--na-transition);
    font-weight: 600;
    font-size: 16px;
    font-family: var(--na-font);
    box-shadow: 0 10px 25px -5px rgba(6, 182, 212, 0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-glow:hover {
    transform: scale(1.02);
    box-shadow: 0 15px 35px -5px rgba(6, 182, 212, 0.4);
}

.btn-glow:active {
    transform: scale(0.98);
}

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

#btn-scarnas-login {
    background: linear-gradient(135deg, var(--na-cyan), var(--na-blue));
    color: #ffffff;
    border: none;
    border-radius: var(--na-radius-sm);
    padding: 12px 24px;
    cursor: pointer;
    transition: all var(--na-transition);
    font-weight: 600;
    font-size: 14px;
    font-family: var(--na-font);
    box-shadow: 0 10px 25px -5px rgba(6, 182, 212, 0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

#btn-scarnas-login:hover {
    transform: scale(1.02);
    box-shadow: 0 15px 35px -5px rgba(6, 182, 212, 0.4);
}

#btn-scarnas-login:active {
    transform: scale(0.98);
}

/* --- Status Indicators --- */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
    animation: pulse 2s ease-in-out infinite;
    flex-shrink: 0;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--na-bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--na-border);
    border-radius: 9999px;
    color: var(--na-text-secondary);
    font-size: 14px;
}

/* --- Animations --- */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

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

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

/* --- Logo Styles --- */
.nodeair-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nodeair-logo-text {
    font-weight: 300;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, var(--na-cyan-light), var(--na-blue-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nodeair-logo-text strong {
    font-weight: 600;
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(6, 182, 212, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(6, 182, 212, 0.5);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(6, 182, 212, 0.3) transparent;
}

/* --- Shared Header Buttons --- */
.na-header-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--na-radius-sm, 8px);
    color: var(--na-text-secondary, #94a3b8);
    cursor: pointer;
    transition: all var(--na-transition, 0.3s ease);
    font-size: 14px;
    text-decoration: none;
}

.na-header-btn:hover {
    color: var(--na-cyan-light, #22d3ee);
    background: rgba(6, 182, 212, 0.1);
    border-color: rgba(6, 182, 212, 0.3);
}

.na-header-btn-ghost {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--na-radius-sm, 8px);
    color: var(--na-text-secondary, #94a3b8);
    cursor: pointer;
    transition: all var(--na-transition, 0.3s ease);
    font-size: 16px;
    text-decoration: none;
}

.na-header-btn-ghost:hover {
    color: var(--na-cyan-light, #22d3ee);
    background: rgba(6, 182, 212, 0.1);
    border-color: rgba(6, 182, 212, 0.3);
}

/* --- Utility Classes --- */
.na-fade-in {
    animation: fadeIn 0.3s ease-out;
}

.na-fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

.na-text-primary {
    color: var(--na-text-primary);
}

.na-text-secondary {
    color: var(--na-text-secondary);
}

.na-text-tertiary {
    color: var(--na-text-tertiary);
}

.na-text-cyan {
    color: var(--na-cyan-light);
}

/* --- Offcanvas --- */
.offcanvas-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 50;
    animation: backdropIn 0.2s ease-out;
}

@keyframes backdropIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.offcanvas {
    position: fixed;
    top: 0;
    bottom: 0;
    visibility: visible;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(6, 182, 212, 0.2);
    z-index: 51;
    display: flex;
    flex-direction: column;
    animation: slideIn 0.3s ease-out;
    overflow: hidden;
}

.offcanvas-left {
    left: 0;
    width: 350px;
    border-left: none;
    border-radius: 0 var(--na-radius, 16px) var(--na-radius, 16px) 0;
}

.offcanvas-right {
    right: 0;
    width: min(520px, 80vw);
    border-right: none;
    border-radius: var(--na-radius, 16px) 0 0 var(--na-radius, 16px);
    animation-name: slideInRight;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.offcanvas-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(6, 182, 212, 0.2);
    flex-shrink: 0;
}

.offcanvas-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--na-text-primary, #e2e8f0);
    display: flex;
    align-items: center;
    gap: 8px;
}

.offcanvas-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* ===== User menu (logged-in user + logout) ===== */
.na-user-menu {
    position: relative;
    display: inline-flex;
}

.na-user-menu-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    padding: 0 10px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--na-text, #e2e8f0);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.na-user-menu-trigger:hover {
    background: rgba(6, 182, 212, 0.10);
    border-color: rgba(6, 182, 212, 0.35);
}

.na-user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #06b6d4, #3b82f6);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.na-user-avatar-lg {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
    font-size: 13px;
}

.na-user-name {
    flex: 0 1 auto;
    font-size: 0.9rem;
    font-weight: 500;
    max-width: 160px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.na-user-caret {
    font-size: 0.7rem;
    color: #64748b;
}

.na-user-backdrop {
    position: fixed;
    inset: 0;
    z-index: 70;
    background: transparent;
}

.na-user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 71;
    min-width: 220px;
    padding: 8px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(6, 182, 212, 0.30);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.na-user-dropdown-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 8px 10px;
}

.na-user-dropdown-name {
    font-size: 0.9rem;
    font-weight: 600;
    min-width: 0;
    color: var(--na-text, #e2e8f0);
    overflow-wrap: anywhere;
}

.na-user-dropdown-divider {
    margin: 4px 0;
    border: 0;
    border-top: 1px solid rgba(148, 163, 184, 0.20);
}

.na-user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: var(--na-text, #e2e8f0);
    font-size: 0.9rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease;
}

.na-user-dropdown-item:hover {
    background: rgba(239, 68, 68, 0.14);
    color: #fca5a5;
}

/* Float variant — Sections page (no top-right header) */
.na-user-menu-float {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 60;
}

/* Sidebar variant — Admin sidebar (stacked, full width, above the footer border) */
.na-user-menu-sidebar {
    display: block;
    width: 100%;
    margin-bottom: 0.75rem;
}

.na-user-menu-sidebar .na-user-menu-trigger {
    width: 100%;
    justify-content: flex-start;
}

.na-user-menu-sidebar .na-user-name {
    flex: 1 1 auto;
    max-width: none;
}

.na-user-menu-sidebar .na-user-dropdown {
    right: 0;
    left: 0;
    bottom: calc(100% + 8px);
    top: auto;
    min-width: 0;
}
