/**
 * ADASystems - Main Application Stylesheet
 * Base styles, CSS variables, layout, header, footer
 */

/* ==========================================
   CSS RESET & BASE
   ========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ==========================================
   CSS VARIABLES (Themes)
   ========================================== */
:root {
    /* Light theme (default) */
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --accent: #10b981;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --text-dark: #111827;
    --text-gray: #6b7280;
    --text-light: #9ca3af;
    --bg-body: #f3f4f6;
    --bg-light: #f9fafb;
    --bg-white: #ffffff;
    --border: #e5e7eb;
    --shadow: rgba(15, 23, 42, 0.08);
    --shadow-lg: rgba(15, 23, 42, 0.12);
    --header-bg: #ffffff;
    --header-border: rgba(148, 163, 184, 0.4);
}

/* Dark theme */
html.dark {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #60a5fa;
    --accent: #34d399;
    --success: #34d399;
    --error: #f87171;
    --warning: #fbbf24;
    --text-dark: #f9fafb;
    --text-gray: #9ca3af;
    --text-light: #6b7280;
    --bg-body: #0f172a;
    --bg-light: #1e293b;
    --bg-white: #1e293b;
    --border: #334155;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-lg: rgba(0, 0, 0, 0.4);
    --header-bg: #1e293b;
    --header-border: #334155;
}

/* ==========================================
   BODY & TYPOGRAPHY
   ========================================== */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-body);
    min-height: 100vh;
    color: var(--text-dark);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==========================================
   HEADER - Modern Glassmorphism Style
   ========================================== */
.header {
    background: rgba(3, 7, 18, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 1rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    top: 0;
    z-index: 100;
}

html:not(.dark) .header {
    background: rgba(255, 255, 255, 0.8);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.logo {
    height: 40px;
    width: auto;
}

/* Centered Navigation */
.nav-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.nav-links {
    display: flex;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links a {
    text-decoration: none;
    color: #94a3b8;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

html:not(.dark) .nav-links a {
    color: #475569;
}

.nav-links a:hover {
    color: #06b6d4;
    background: rgba(6, 182, 212, 0.1);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.cta-button {
    background: linear-gradient(135deg, #06b6d4, #8b5cf6);
    color: white;
    padding: 0.6rem 1.5rem;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(6, 182, 212, 0.4);
}

/* Auth Header */
.welcome h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
}

.welcome .role {
    font-size: 0.75rem;
    font-weight: 600;
    color: #4f46e5;
    background: rgba(79, 70, 229, 0.08);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    display: inline-block;
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

html.dark .welcome .role {
    background: rgba(79, 70, 229, 0.2);
    color: #a5b4fc;
}

.user-email {
    color: var(--text-gray);
    font-size: 0.9rem;
}

.logout-btn {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.logout-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 25px rgba(239, 68, 68, 0.35);
}

/* ==========================================
   MAIN CONTENT
   ========================================== */
.main-content {
    flex: 1;
}

.main-content.padded {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* ==========================================
   FLASH MESSAGES / ALERTS
   ========================================== */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--success);
    color: #065f46;
}

html.dark .alert-success {
    color: #34d399;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    color: #991b1b;
}

html.dark .alert-error {
    color: #f87171;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--warning);
    color: #92400e;
}

html.dark .alert-warning {
    color: #fbbf24;
}

/* ==========================================
   FOOTER
   ========================================== */
.footer {
    background: var(--bg-white);
    border-top: 1px solid var(--border);
    padding: 3rem 0 1.5rem;
    margin-top: auto;
}

html.dark .footer {
    background: #0f172a;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-section .footer-title {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.footer-section a {
    display: block;
    color: var(--text-gray);
    text-decoration: none;
    margin-bottom: 0.5rem;
    transition: color 0.3s;
}

.footer-section a:hover {
    color: var(--primary);
}

.footer-link-btn {
    display: block;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: var(--text-gray);
    text-align: left;
    cursor: pointer;
    margin-bottom: 0.5rem;
    transition: color 0.3s;
}

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

.footer-section p {
    color: var(--text-gray);
    font-size: 0.9rem;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    margin-top: 2rem;
    border-top: 1px solid var(--border);
    color: var(--text-gray);
    font-size: 0.85rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
}

/* ==========================================
   COMMON COMPONENTS
   ========================================== */

/* Cards */
.card {
    background: var(--bg-white);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px var(--shadow);
    border: 1px solid var(--border);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-dark);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    filter: brightness(1.1);
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-danger:hover {
    filter: brightness(1.1);
}

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

.btn-lg {
    padding: 0.8rem 1.75rem;
    font-size: 1rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    font-size: 0.9rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    background: var(--bg-white);
    color: var(--text-dark);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input::placeholder {
    color: var(--text-light);
}

/* Tables */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background: var(--bg-light);
    font-weight: 600;
    color: var(--text-dark);
    white-space: nowrap;
}

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

.table tr:hover td {
    background: var(--bg-light);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

html.dark .badge-success {
    background: rgba(52, 211, 153, 0.15);
    color: #34d399;
}

.badge-error {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

html.dark .badge-error {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

html.dark .badge-warning {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}

.badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}

html.dark .badge-info {
    background: rgba(96, 165, 250, 0.15);
    color: #60a5fa;
}

/* ==========================================
   UTILITY CLASSES
   ========================================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-warning { color: var(--warning); }
.text-gray { color: var(--text-gray); }
.text-light { color: var(--text-light); }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

.hidden { display: none; }
.visible { display: block; }

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }

    .header {
        padding: 0.75rem 1rem;
    }

    .header-right {
        flex-direction: column;
        gap: 0.75rem;
    }

    .nav-links {
        display: none;
    }

    .main-content.padded {
        padding: 1.25rem;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .table-container {
        font-size: 0.85rem;
    }

    .table th,
    .table td {
        padding: 0.75rem;
    }

    .btn {
        padding: 0.5rem 1rem;
    }
}
