/* ==================================================
   NexaBase API - Modern Dark Theme CSS
   ================================================== */

:root {
    --bg-primary: #0f172a;
    --bg-card: #111827;
    --bg-card-hover: #1a2236;
    --bg-sidebar: #0b1120;
    --bg-input: #1e293b;
    --bg-border: rgba(255,255,255,0.06);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --accent: #8b5cf6;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --glass-bg: rgba(17, 24, 39, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --transition: all 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ==================================================
   GLASSMORPHISM CARD
   ================================================== */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: var(--shadow-lg);
}

/* ==================================================
   LANDING PAGE
   ================================================== */
.landing-page {
    overflow-x: hidden;
}

.landing-page .navbar {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--bg-border);
}

.landing-page .navbar-brand {
    color: var(--text-primary);
    font-family: 'Poppins', sans-serif;
}

.hero-section {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.15;
    pointer-events: none;
}

.orb-1 {
    width: 500px;
    height: 500px;
    background: var(--primary);
    top: -100px;
    right: -100px;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: var(--accent);
    bottom: -50px;
    left: -100px;
}

.text-gradient {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-card {
    padding: 1.5rem;
}

.hero-card .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.code-preview {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8rem;
    line-height: 1.8;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
}

.feature-card {
    padding: 1.5rem;
}

.feature-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.bg-purple {
    background-color: rgba(139, 92, 246, 0.1) !important;
}

.text-purple {
    color: #a78bfa !important;
}

.cta-card {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
}

/* ==================================================
   AUTH PAGES
   ================================================== */
.auth-page {
    min-height: 100vh;
    overflow-x: hidden;
}

.auth-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
}

.auth-card {
    padding: 2rem;
    position: relative;
    z-index: 1;
}

.auth-page .form-control {
    font-size: 0.9rem;
    padding: 0.6rem 0.8rem;
    border: 1px solid transparent;
    transition: var(--transition);
}

.auth-page .form-control:focus {
    background-color: var(--bg-input);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    color: var(--text-primary);
}

.auth-page .input-group-text {
    border: 1px solid transparent;
}

.letter-spacing-2 {
    letter-spacing: 0.2em;
}

/* ==================================================
   BUTTONS
   ================================================== */
.btn {
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover), #1d4ed8);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-outline-light {
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
}

/* ==================================================
   DASHBOARD LAYOUT
   ================================================== */
.dashboard-body {
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--bg-border);
    z-index: 1000;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-brand {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--bg-border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    text-decoration: none;
    font-family: 'Poppins', sans-serif;
}

.sidebar-brand i {
    font-size: 1.5rem;
}

.sidebar-nav {
    list-style: none;
    padding: 1rem 0.75rem;
    flex: 1;
}

.sidebar-nav li {
    margin-bottom: 0.25rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: var(--transition);
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
}

.sidebar-nav a.active {
    font-weight: 500;
}

.sidebar-nav i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.sidebar-section-title {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 0.75rem 1rem 0.5rem;
    font-weight: 600;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--bg-border);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    padding: 0.5rem;
    cursor: pointer;
}

.main-content {
    margin-left: 260px;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.dashboard-navbar {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--bg-border);
    padding: 0.75rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.page-content {
    padding: 1.5rem;
}

/* ==================================================
   STATS CARDS
   ================================================== */
.stat-card {
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    height: 100%;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.blue {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
}

.stat-icon.green {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.stat-icon.purple {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent);
}

.stat-icon.orange {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.stat-icon.red {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.stat-icon.cyan {
    background: rgba(6, 182, 212, 0.15);
    color: var(--info);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

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

/* ==================================================
   STORAGE BAR
   ================================================== */
.storage-bar-container {
    margin-top: 0.75rem;
}

.storage-bar-bg {
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
}

.storage-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
    background: linear-gradient(90deg, var(--primary), var(--accent));
}

.storage-bar-fill.warning {
    background: linear-gradient(90deg, var(--warning), #f97316);
}

.storage-bar-fill.danger {
    background: linear-gradient(90deg, var(--danger), #dc2626);
}

/* ==================================================
   API KEY SECTION
   ================================================== */
.api-key-display {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    word-break: break-all;
}

/* ==================================================
   TABLES
   ================================================== */
.table-glass {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table-glass th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    color: var(--text-muted);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--bg-border);
    white-space: nowrap;
}

.table-glass td {
    padding: 0.875rem 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--bg-border);
    vertical-align: middle;
}

.table-glass tbody tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.table-glass tbody tr:last-child td {
    border-bottom: none;
}

.badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.35em 0.65em;
    border-radius: 6px;
}

/* ==================================================
   JSON EDITOR
   ================================================== */
.json-editor {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8rem;
    line-height: 1.6;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--bg-border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    color: var(--text-secondary);
    width: 100%;
    min-height: 200px;
    resize: vertical;
}

.json-editor:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ==================================================
   PLAYGROUND
   ================================================== */
.playground-response {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    padding: 1rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8rem;
    max-height: 400px;
    overflow-y: auto;
}

/* ==================================================
   TOAST NOTIFICATIONS
   ================================================== */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
}

.toast-nexa {
    background: var(--bg-card);
    border: 1px solid var(--bg-border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    animation: toastSlide 0.3s ease;
    margin-bottom: 0.5rem;
}

@keyframes toastSlide {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-nexa.success {
    border-left: 3px solid var(--success);
}

.toast-nexa.error {
    border-left: 3px solid var(--danger);
}

.toast-nexa.warning {
    border-left: 3px solid var(--warning);
}

.toast-nexa.info {
    border-left: 3px solid var(--primary);
}

/* ==================================================
   SKELETON LOADING
   ================================================== */
.skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: skeleton 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ==================================================
   MODAL
   ================================================== */
.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--bg-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--bg-border);
    padding: 1.25rem;
}

.modal-footer {
    border-top: 1px solid var(--bg-border);
    padding: 1rem 1.25rem;
}

.modal-body {
    padding: 1.25rem;
}

.btn-close {
    filter: invert(1);
    opacity: 0.5;
}

/* ==================================================
   MOBILE BOTTOM NAV
   ================================================== */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-sidebar);
    border-top: 1px solid var(--bg-border);
    z-index: 1000;
    padding: 0.5rem 0;
}

.mobile-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.65rem;
    flex: 1;
    padding: 0.25rem;
}

.mobile-nav a i {
    font-size: 1.25rem;
}

.mobile-nav a.active {
    color: var(--primary);
}

/* ==================================================
   SCROLLBAR
   ================================================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ==================================================
   DOCUMENTATION
   ================================================== */
.doc-code-block {
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-sm);
    padding: 1rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8rem;
    overflow-x: auto;
    margin: 0.75rem 0;
}

.doc-code-block code {
    color: var(--text-secondary);
    white-space: pre;
}

/* ==================================================
   SPINNER
   ================================================== */
.spinner-nexa {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================================================
   RESPONSIVE
   ================================================== */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .mobile-nav {
        display: flex;
    }
    
    .page-content {
        padding-bottom: 5rem;
    }
}

@media (max-width: 767.98px) {
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .stat-value {
        font-size: 1.25rem;
    }
    
    .auth-card {
        padding: 1.5rem;
    }
    
    .table-glass {
        display: block;
        overflow-x: auto;
    }
}

/* ==================================================
   ADMIN STYLES
   ================================================== */
.admin-badge {
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
}

.user-badge {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.active {
    background: var(--success);
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
}

.status-dot.inactive {
    background: var(--danger);
}

/* ==================================================
   CHARTS
   ================================================== */
.chart-container {
    position: relative;
    height: 250px;
}
