/* ===== CSS VARIABLES ===== */
:root {
    /* Colors */
    --primary-color: #6366f1;
    --primary-hover: #5855eb;
    --primary-light: #e0e7ff;
    --secondary-color: #64748b;
    --accent-color: #06b6d4;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;

    /* Backgrounds */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-overlay: rgba(15, 23, 42, 0.1);
    --bg-glass: rgba(255, 255, 255, 0.25);
    --bg-glass-hover: rgba(255, 255, 255, 0.4);

    /* Text Colors */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-white: #ffffff;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 0 1px rgba(99, 102, 241, 0.05), 0 1px 3px 0 rgba(99, 102, 241, 0.1);

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;

    /* Spacing */
    --space-xs: 0.5rem;
    --space-sm: 0.75rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;

    /* Animations */
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ===== GLOBAL STYLES ===== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* ===== BACKGROUND DECORATIONS ===== */
.bg-decoration {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
            radial-gradient(circle at 25% 25%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
            radial-gradient(circle at 75% 75%, rgba(6, 182, 212, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: -2;
}

.bg-grid {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
            linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
            linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: -1;
}

/* ===== LAYOUT CONTAINERS ===== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-lg);
    position: relative;
    z-index: 1;
}

/* ===== HEADER STYLES ===== */
.header {
    text-align: center;
    margin-bottom: var(--space-2xl);
    animation: fadeInUp 0.8s ease-out;
}

.logo {
    font-size: var(--font-size-4xl);
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: var(--space-sm);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    letter-spacing: -0.025em;
}

.subtitle {
    font-size: var(--font-size-lg);
    color: rgba(255, 255, 255, 0.8);
    font-weight: 300;
}

/* ===== LOGIN CONTAINER ===== */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px);
    animation: fadeInScale 0.6s ease-out;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-2xl);
    padding: var(--space-2xl);
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.5), transparent);
}

.login-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.login-header h2 {
    font-size: var(--font-size-2xl);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.login-header p {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

/* ===== FORM STYLES ===== */
.login-form {
    space-y: var(--space-lg);
}

.input-group {
    position: relative;
    margin-bottom: var(--space-lg);
}

.code-input {
    width: 100%;
    height: 60px;
    font-size: var(--font-size-lg);
    text-align: center;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-lg);
    padding: 0 var(--space-lg);
    background: var(--bg-primary);
    transition: all var(--transition-base);
    font-family: var(--font-family);
    outline: none;
    letter-spacing: 0.1em;
}

.code-input:focus {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.code-input::placeholder {
    color: var(--text-muted);
    letter-spacing: normal;
}

.input-decoration {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    width: 0;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    transition: width var(--transition-base);
    border-radius: 1px;
}

.code-input:focus + .input-decoration {
    width: 100%;
}

/* ===== POLICY SECTION ===== */
.policy-section {
    margin: var(--space-lg) 0;
    direction: rtl;
}

.checkbox-wrapper {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
}

.policy-checkbox {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    accent-color: var(--primary-color);
}

.policy-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: 1.5;
}

.policy-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.policy-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* ===== BUTTON STYLES ===== */
.submit-button {
    width: 100%;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: var(--text-white);
    border: none;
    border-radius: var(--radius-lg);
    font-size: var(--font-size-lg);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.submit-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.submit-button:active {
    transform: translateY(-1px);
}

.button-text {
    position: relative;
    z-index: 2;
}

.button-ripple {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    opacity: 0;
    transition: opacity var(--transition-base);
}

.submit-button:hover .button-ripple {
    opacity: 1;
}

/* ===== ERROR MESSAGES ===== */
.error-message {
    color: var(--error-color);
    font-size: var(--font-size-sm);
    text-align: center;
    margin: var(--space-sm) 0;
    font-weight: 500;
    min-height: 20px;
}

/* ===== LOGIN FOOTER ===== */
.login-footer {
    margin-top: var(--space-xl);
    padding-top: var(--space-lg);
    border-top: 1px solid #e2e8f0;
}

.help-links {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    text-align: center;
}

.help-text {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    direction: rtl;
}

.help-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.help-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* ===== NAVIGATION STYLES ===== */
.navigation-container {
    animation: fadeInUp 0.8s ease-out;
    margin-top: var(--space-2xl);
}

.nav-header {
    text-align: center;
    margin-bottom: var(--space-2xl);
}

.nav-header h2 {
    font-size: var(--font-size-3xl);
    font-weight: 600;
    color: var(--text-white);
    margin-bottom: var(--space-sm);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.nav-header p {
    color: rgba(255, 255, 255, 0.8);
    font-size: var(--font-size-base);
}

.nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-xl);
    max-width: 800px;
    margin: 0 auto;
}

.nav-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.nav-item {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    transition: all var(--transition-base);
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    min-height: 120px;
}

.nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
}

.nav-item:hover {
    background: var(--bg-glass-hover);
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.nav-icon {
    font-size: 2rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-lg);
    flex-shrink: 0;
}

.nav-content {
    flex-grow: 1;
}

.nav-content h3 {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--text-white);
    margin-bottom: var(--space-xs);
}

.nav-content p {
    font-size: var(--font-size-sm);
    color: rgba(255, 255, 255, 0.7);
}

.nav-arrow {
    font-size: var(--font-size-xl);
    color: rgba(255, 255, 255, 0.5);
    transition: all var(--transition-base);
}

.nav-item:hover .nav-arrow {
    color: var(--text-white);
    transform: translateX(4px);
}

.logout-item {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.3);
}

.logout-item:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .container {
        padding: var(--space-md);
    }

    .login-card {
        padding: var(--space-lg);
        margin: var(--space-md);
    }

    .nav-grid {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }

    .nav-item {
        padding: var(--space-lg);
        min-height: 100px;
    }

    .nav-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .logo {
        font-size: var(--font-size-3xl);
    }

    .nav-header h2 {
        font-size: var(--font-size-2xl);
    }
}

@media (max-width: 480px) {
    .login-card {
        margin: var(--space-sm);
        padding: var(--space-lg);
    }

    .code-input {
        height: 50px;
        font-size: var(--font-size-base);
    }

    .submit-button {
        height: 50px;
        font-size: var(--font-size-base);
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for better accessibility */
button:focus-visible,
input:focus-visible,
a:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --bg-glass: rgba(255, 255, 255, 0.9);
        --bg-glass-hover: rgba(255, 255, 255, 1);
    }

    .nav-item {
        border: 2px solid rgba(255, 255, 255, 0.5);
    }
}