/* ==========================================================================
   Skynetwork Fortress Auth - Design System & Custom Stylesheet
   ========================================================================== */

:root {
    /* Color Palette */
    --bg-dark: #090d16;
    --bg-card: rgba(16, 23, 38, 0.85);
    --border-card: rgba(255, 255, 255, 0.08);
    --border-card-hover: rgba(124, 58, 237, 0.4);
    
    --primary: #7c3aed;
    --primary-hover: #6d28d9;
    --primary-glow: rgba(124, 58, 237, 0.35);
    
    --accent-cyan: #06b6d4;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-yellow: #f59e0b;
    
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-dim: #6b7280;
    
    --input-bg: rgba(9, 14, 26, 0.65);
    --input-border: rgba(255, 255, 255, 0.1);
    --input-focus: #7c3aed;

    /* Typography */
    --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Transitions */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Dynamic Background Glow Effect */
.background-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
    background: 
        radial-gradient(circle at 15% 20%, rgba(124, 58, 237, 0.15) 0%, transparent 45%),
        radial-gradient(circle at 85% 75%, rgba(6, 182, 212, 0.12) 0%, transparent 45%),
        radial-gradient(circle at 50% 50%, rgba(16, 185, 129, 0.05) 0%, transparent 60%);
}

/* ==========================================================================
   APP LAYOUT WITH SIDEBAR (SIDEBAR.PHP)
   ========================================================================== */

.app-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
    position: relative;
    z-index: 1;
    overflow-x: hidden;
}

.main-layout-content {
    flex: 1;
    min-width: 0; /* CRITICAL: Prevents wide table flex overflow from pushing/squeezing sidebar */
    padding: 1.75rem 2.5rem 1.75rem 1.75rem; /* Guarantees 2.5rem gap between content and right window scrollbar */
    width: 100%;
    box-sizing: border-box;
}

/* Mobile Bar */
.mobile-nav-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.25rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-card);
    position: sticky;
    top: 0;
    z-index: 90;
}

.mobile-toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-toggle-btn svg {
    width: 24px;
    height: 24px;
}

/* Sidebar Component Styles */
.sidebar-container {
    width: 260px;
    min-width: 260px;
    max-width: 260px;
    flex-shrink: 0; /* CRITICAL: Sidebar cannot be squeezed or reshaped by main content */
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 100;
    box-sizing: border-box;
    transition: var(--transition-normal);
}

.sidebar-header {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.nav-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.45);
    margin-top: 0.75rem;
    margin-bottom: 0.5rem;
    padding-left: 0.5rem;
}

.sidebar-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    margin: 1rem 0.25rem 0.5rem 0.25rem;
}

.nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    border-radius: 10px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-icon svg {
    width: 18px;
    height: 18px;
    transition: var(--transition-fast);
}

.nav-link:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.06);
    transform: translateX(4px);
}

.nav-link:hover .nav-icon svg {
    stroke: var(--primary);
}

.nav-link.active {
    background: linear-gradient(90deg, rgba(124, 58, 237, 0.25) 0%, rgba(124, 58, 237, 0.08) 100%);
    color: #ffffff;
    border: 1px solid rgba(124, 58, 237, 0.35);
    font-weight: 600;
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: -1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 22px;
    background: var(--primary);
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 10px var(--primary-glow);
}

.nav-link.active .nav-icon svg {
    stroke: #6ee7b7;
    filter: drop-shadow(0 0 6px rgba(110, 231, 183, 0.5));
}

/* Sidebar Footer */
.sidebar-footer {
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    overflow: hidden;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent-cyan) 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-details .user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-details .user-role-badge {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--accent-cyan);
    font-family: var(--font-mono);
}

.logout-icon-btn {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 0.45rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.logout-icon-btn svg {
    width: 16px;
    height: 16px;
}

.logout-icon-btn:hover {
    background: var(--accent-red);
    color: #ffffff;
}

/* ==========================================================================
   AUTHENTICATION PAGE (INDEX.PHP)
   ========================================================================== */

.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 460px;
}

.auth-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-card);
    border-radius: 20px;
    padding: 2.25rem 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5),
                0 0 0 1px rgba(255, 255, 255, 0.05);
    transition: var(--transition-normal);
}

.auth-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.85rem;
    background: rgba(124, 58, 237, 0.12);
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: 9999px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #a78bfa;
    margin-bottom: 1rem;
}

.brand-badge.small {
    padding: 0.25rem 0.65rem;
    font-size: 0.72rem;
}

.shield-icon {
    width: 16px;
    height: 16px;
    stroke: #a78bfa;
}

.auth-title {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-main);
    margin-bottom: 0.35rem;
}

.auth-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    background: rgba(9, 14, 26, 0.7);
    border: 1px solid var(--border-card);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 1.5rem;
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: transparent;
    border: none;
    padding: 0.65rem;
    border-radius: 8px;
    color: var(--text-muted);
    font-family: var(--font-main);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.tab-btn svg {
    width: 16px;
    height: 16px;
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 12px var(--primary-glow);
}

/* Alert Banner */
.alert-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    margin-bottom: 1.25rem;
    font-size: 0.85rem;
    line-height: 1.4;
    transition: var(--transition-fast);
}

.alert-banner.hidden {
    display: none;
}

.alert-banner.error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.alert-banner.success {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

/* Forms */
.auth-form {
    display: none;
    flex-direction: column;
    gap: 1.15rem;
}

.auth-form.active {
    display: flex;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--text-main);
}

.input-container {
    position: relative;
    display: flex;
    align-items: center;
}

.field-icon {
    position: absolute;
    left: 1rem;
    width: 18px;
    height: 18px;
    stroke: var(--text-dim);
    pointer-events: none;
    transition: var(--transition-fast);
}

.input-container input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 10px;
    color: var(--text-main);
    font-family: var(--font-main);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition-fast);
}

.input-container input::placeholder {
    color: var(--text-dim);
}

.input-container input:focus {
    border-color: var(--input-focus);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.input-container input:focus ~ .field-icon {
    stroke: var(--primary);
}

.toggle-password {
    position: absolute;
    right: 0.75rem;
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.toggle-password:hover {
    color: var(--text-main);
}

.toggle-password svg {
    width: 18px;
    height: 18px;
}

.input-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Custom Checkbox */
.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.custom-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.825rem;
    color: var(--text-muted);
    user-select: none;
}

.custom-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkmark {
    width: 18px;
    height: 18px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 5px;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-checkbox input:checked ~ .checkmark {
    background: var(--primary);
    border-color: var(--primary);
}

.checkmark::after {
    content: "";
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    display: none;
}

.custom-checkbox input:checked ~ .checkmark::after {
    display: block;
}

/* Submit Button & Spinner */
.submit-btn {
    width: 100%;
    padding: 0.85rem;
    background: var(--primary);
    border: none;
    border-radius: 10px;
    color: #ffffff;
    font-family: var(--font-main);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 14px var(--primary-glow);
    transition: var(--transition-normal);
    margin-top: 0.5rem;
}

.submit-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--primary-glow);
}

.submit-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spin 0.8s linear infinite;
}

.spinner.hidden {
    display: none;
}

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

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.75rem;
    color: var(--text-dim);
}

/* ==========================================================================
   DASHBOARD PAGE (DASHBOARD.PHP)
   ========================================================================== */

.dashboard-body {
    padding: 0;
}

/* Welcome Hero */
.welcome-card {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.2) 0%, rgba(6, 182, 212, 0.1) 100%);
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.welcome-text h2 {
    font-size: 1.65rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.welcome-text p {
    color: var(--text-muted);
    font-size: 0.925rem;
}

.welcome-text code {
    font-family: var(--font-mono);
    color: var(--accent-cyan);
    background: rgba(0, 0, 0, 0.3);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.9rem;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #6ee7b7;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--accent-green);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse 1.8s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border-card);
    border-radius: 16px;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition-normal);
}

.stat-card:hover {
    border-color: var(--border-card-hover);
    transform: translateY(-2px);
}

.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 22px;
    height: 22px;
}

.stat-icon.purple { background: rgba(124, 58, 237, 0.15); color: #a78bfa; }
.stat-icon.cyan { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); }
.stat-icon.green { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }
.stat-icon.blue { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }

.stat-details {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.775rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Details Grid */
.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-card);
    border-radius: 20px;
    padding: 1.5rem;
    width: 100%;
    box-sizing: border-box;
}

.card-header {
    margin-bottom: 1.25rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.card-header h3 {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 1.1rem;
    font-weight: 700;
}

.card-header h3 svg {
    width: 20px;
    height: 20px;
    stroke: var(--primary);
}

.info-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.info-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.875rem;
}

.info-key {
    color: var(--text-muted);
}

.info-val {
    font-weight: 600;
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.info-badge {
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-mono);
}

.info-badge.success {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

/* Responsive Breakpoints */
@media (max-width: 900px) {
    .app-layout {
        flex-direction: column;
    }

    .mobile-nav-bar {
        display: flex;
    }

    .sidebar-container {
        position: fixed;
        left: -280px;
        top: 0;
        height: 100vh;
        width: 260px;
        z-index: 999;
        box-shadow: 10px 0 30px rgba(0,0,0,0.5);
    }

    .sidebar-container.open {
        left: 0;
    }

    .main-layout-content {
        padding: 1.25rem 1rem;
    }
}

/* Custom Delete Confirmation Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.25s ease;
}

.modal-overlay.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.modal-card {
    background: #0f172a;
    border: 1px solid var(--border-card-hover);
    border-radius: 20px;
    padding: 2rem;
    max-width: 440px;
    width: 90%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 30px rgba(239, 68, 68, 0.15);
    text-align: center;
    animation: modalPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
    0% { transform: scale(0.9) translateY(10px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-icon {
    width: 56px;
    height: 56px;
    background: rgba(239, 68, 68, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem auto;
    color: #ef4444;
}

.modal-icon svg {
    width: 28px;
    height: 28px;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.modal-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 1.75rem;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.modal-btn-cancel {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border: 1px solid var(--border-card);
    padding: 0.65rem 1.25rem;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    flex: 1;
    transition: all 0.2s ease;
}

.modal-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.15);
}

.modal-btn-confirm {
    background: #ef4444;
    color: #ffffff;
    border: none;
    padding: 0.65rem 1.25rem;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    flex: 1;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    transition: all 0.2s ease;
}

.modal-btn-confirm:hover {
    background: #dc2626;
    transform: translateY(-1px);
}
