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

/* ===== Theme Variables ===== */
body[data-theme="light"] {
    --bg-start: #eef1f8;
    --bg-mid: #f7f8fc;
    --bg-end: #ffffff;
    --card-bg: rgba(255, 255, 255, 0.85);
    --card-border: rgba(0, 0, 0, 0.08);
    --card-shadow: 0 25px 50px rgba(0, 0, 0, 0.12);
    --text: #1a1a2e;
    --text-soft: rgba(0, 0, 0, 0.6);
    --text-muted: rgba(0, 0, 0, 0.45);
    --input-bg: rgba(0, 0, 0, 0.04);
    --input-border: rgba(0, 0, 0, 0.12);
    --input-placeholder: rgba(0, 0, 0, 0.35);
    --navbar-bg: rgba(255, 255, 255, 0.85);
    --navbar-border: rgba(0, 0, 0, 0.06);
    --toast-bg: rgba(255, 255, 255, 0.98);
    --toast-border: rgba(0, 0, 0, 0.1);
    --navlink: #334; 
}

body[data-theme="dark"] {
    --bg-start: #0c0c1d;
    --bg-mid: #1a1a2e;
    --bg-end: #16213e;
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --card-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
    --text: #e0e0e0;
    --text-soft: rgba(255, 255, 255, 0.8);
    --text-muted: rgba(255, 255, 255, 0.45);
    --input-bg: rgba(255, 255, 255, 0.08);
    --input-border: rgba(255, 255, 255, 0.15);
    --input-placeholder: rgba(255, 255, 255, 0.35);
    --navbar-bg: rgba(0, 0, 0, 0.3);
    --navbar-border: rgba(255, 255, 255, 0.08);
    --toast-bg: rgba(30, 30, 60, 0.95);
    --toast-border: rgba(255, 255, 255, 0.1);
    --navlink: #fff;
}

body {
    font-family: 'Tajawal', sans-serif;
    background: linear-gradient(135deg, var(--bg-start) 0%, var(--bg-mid) 50%, var(--bg-end) 100%);
    min-height: 100vh;
    color: var(--text);
    transition: background 0.4s ease, color 0.4s ease;
}

/* ===== Theme Toggle Button ===== */
.theme-toggle {
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 10000;
    width: 46px;
    height: 46px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.55);
}

.lang-toggle {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 10000;
    min-width: 52px;
    height: 46px;
    padding: 0 14px;
    border: none;
    border-radius: 23px;
    background: linear-gradient(135deg, #f093fb, #f5576c);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    font-family: 'Tajawal', sans-serif;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(245, 87, 108, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lang-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 10px 30px rgba(245, 87, 108, 0.55);
}

.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--card-shadow);
    animation: fadeInUp 0.6s ease-out;
}

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

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.brand-logo {
    max-height: 72px;
    max-width: 100%;
    margin-bottom: 16px;
    border-radius: 12px;
}

.auth-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-primary, #667eea), var(--brand-secondary, #764ba2));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 32px;
    color: white;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.auth-icon.otp-icon {
    background: linear-gradient(135deg, var(--brand-primary, #f093fb), var(--brand-secondary, #f5576c));
    box-shadow: 0 10px 30px rgba(245, 87, 108, 0.4);
}

.auth-header h2 {
    color: var(--text);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: var(--text-soft);
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.form-control {
    background: var(--input-bg) !important;
    border: 1px solid var(--input-border) !important;
    border-radius: 12px;
    padding: 14px 16px;
    color: var(--text) !important;
    font-family: 'Tajawal', sans-serif;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    background: var(--input-bg) !important;
    border-color: #667eea !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2) !important;
    outline: none;
}

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

.otp-input {
    font-size: 2rem !important;
    text-align: center;
    letter-spacing: 16px;
    direction: ltr;
    padding: 18px !important;
    font-weight: 700;
}

.btn-primary {
    background: linear-gradient(135deg, var(--brand-primary, #667eea), var(--brand-secondary, #764ba2));
    border: none;
    border-radius: 12px;
    padding: 14px;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: 'Tajawal', sans-serif;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.5);
    background: linear-gradient(135deg, var(--brand-primary, #667eea), var(--brand-secondary, #764ba2));
}

.btn-outline-primary {
    border-color: #667eea;
    color: #667eea;
    border-radius: 12px;
    padding: 12px 30px;
    font-family: 'Tajawal', sans-serif;
    transition: all 0.3s ease;
}

.btn-outline-primary:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    color: var(--text-muted);
}

.auth-footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

.auth-footer a:hover {
    color: #8fa4f0;
    text-decoration: underline;
}

.alert {
    border-radius: 12px;
    padding: 14px 16px;
    border: none;
    font-size: 0.9rem;
}

.alert-danger {
    background: rgba(245, 87, 108, 0.15);
    color: #f5576c;
    border: 1px solid rgba(245, 87, 108, 0.3);
}

.text-muted {
    color: var(--text-muted) !important;
}

/* Navbar */
.navbar {
    background: var(--navbar-bg) !important;
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--navbar-border);
    padding: 12px 0;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text) !important;
}

.navbar-nav .nav-link {
    color: var(--navlink) !important;
}

.navbar-nav .nav-link.text-light {
    color: var(--text) !important;
}

/* Dashboard */
.dashboard-container {
    padding: 40px 0;
}

.welcome-section h1 {
    color: var(--text);
    font-weight: 800;
    font-size: 2.2rem;
}

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

.dash-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    transition: all 0.3s ease;
    height: 100%;
}

.dash-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-shadow);
    border-color: rgba(102, 126, 234, 0.4);
}

.dash-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 24px;
    color: white;
}

.dash-card h4 {
    color: var(--text-soft);
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 1rem;
}

.dash-card p {
    color: var(--text-soft);
    font-size: 1.1rem;
    margin-bottom: 0;
}

.info-card {
    text-align: right;
    padding: 24px;
}

.info-card h4 {
    font-size: 1rem;
    margin-bottom: 12px;
}

.badge {
    font-size: 0.85rem;
    padding: 6px 14px;
    border-radius: 8px;
}

/* Toast */
.toast {
    border-radius: 12px;
    background: var(--toast-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--toast-border);
}

.toast-body {
    font-family: 'Tajawal', sans-serif;
    color: var(--text);
}

/* Responsive */
@media (max-width: 576px) {
    .auth-card {
        padding: 28px 20px;
        border-radius: 20px;
    }

    .auth-icon {
        width: 65px;
        height: 65px;
        font-size: 26px;
    }

    .auth-header h2 {
        font-size: 1.5rem;
    }

    .welcome-section h1 {
        font-size: 1.6rem;
    }

    .otp-input {
        font-size: 1.6rem !important;
        letter-spacing: 10px;
    }
}

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

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.5);
    border-radius: 4px;
}

/* Selection */
::selection {
    background: #667eea;
    color: white;
}

/* Connect page code snippets */
.code-box {
    background: #0d1220;
    color: #d6e2ff;
    border-radius: 12px;
    padding: 16px;
    font-size: 12.5px;
    line-height: 1.7;
    overflow-x: auto;
    white-space: pre;
}
body[data-theme="dark"] .code-box {
    background: #1b2134;
    color: #d6e2ff;
}
