@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800;900&family=Tajawal:wght@400;500;700;800;900&family=Inter:wght@400;600;700;800;900&display=swap');

/* ========================================= */
/* 🛑 THEME VARIABLES & DESIGN TOKENS        */
/* ========================================= */
:root {
    --theme-primary: #0D47A1;
    --theme-secondary: #6f42c1;
    --theme-success: #28a745;
    --theme-danger: #dc3545;
    --theme-warning: #ffc107;
    --theme-info: #17a2b8;
    --theme-grey: #777777;

    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --bg-panel: rgba(255, 255, 255, 0.08);
    --bg-input: #ffffff;

    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;

    --border-color: rgba(255, 255, 255, 0.15);
    --border-light: rgba(255, 255, 255, 0.1);

    --basic-white: #ffffff;
    --basic-black: #000000;
    --basic-red: #ff0000;
    --basic-darkred: #D44638;
    --basic-green: #25D366;
    --basic-darkgreen: #28a745;
    --basic-orange: #ffc107;
    --basic-darkorange: #f97316;
    --basic-blue: #007bff;
    --basic-darkblue: #0000ff;
    --basic-yellow: #ffff00;
    --basic-pink: #f8d7da;
    --basic-amber: #ff9800;
    --basic-grey-alt: #6c757d;

    --basic-grey-0: #ccc;
    --basic-grey-1: #aaa;
    --basic-grey-2: #999;
    --basic-grey-3: #888;
    --basic-grey-4: #777;
    --basic-grey-5: #666;
    --basic-grey-6: #555;
    --basic-grey-7: #444;
    --basic-grey-8: #333;
    --basic-grey-9: #222;

    --text-success-dark: #155724;
    --text-warning-dark: #856404;
    --text-danger-dark: #721c24;
    --bg-info-light: rgba(23, 162, 184, 0.15);
    --border-info-light: rgba(23, 162, 184, 0.3);
    --bg-warning-light: rgba(255, 193, 7, 0.15);
    --border-warning-light: rgba(255, 193, 7, 0.3);
    --loader-ring: rgba(255, 255, 255, 0.2);
}

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

body {
    font-family: 'Cairo', 'Tajawal', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: radial-gradient(circle at 50% 15%, #1e1b4b 0%, #0f172a 60%, #020617 100%);
    color: var(--text-main);
    min-height: 100vh;
    padding: 15px;
    -webkit-font-smoothing: antialiased;
}

[dir="rtl"] { direction: rtl; text-align: right; }
[dir="ltr"] { direction: ltr; text-align: left; }

.app-container {
    max-width: 520px;
    margin: 0 auto;
    min-height: 90vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.screen {
    display: none;
    width: 100%;
}

.screen.active {
    display: block;
}

.welcome-subtitle {
    text-align: center;
    margin-bottom: 5px;
    color: var(--text-muted);
    font-size: 1.4rem;
    font-weight: 700;
}

.main-title {
    font-size: 2.2rem;
    font-weight: 900;
    text-align: center;
    color: var(--basic-white);
    margin-bottom: 20px;
}

.card {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 20px;
    padding: 30px 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    margin-bottom: 20px;
}

.input-field {
    width: 100%;
    padding: 14px 18px;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.95);
    color: #0f172a;
    font-size: 1.15rem;
    font-weight: 600;
    outline: none;
    transition: all 0.2s ease;
    text-align: center;
    box-sizing: border-box;
}

.input-field:focus {
    border-color: #3b82f6;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.35);
}

.code-box {
    margin: 20px 0;
    background: rgba(23, 162, 184, 0.15);
    padding: 20px 15px;
    border-radius: 16px;
    border: 1px solid rgba(23, 162, 184, 0.35);
    text-align: center;
}

.code-label {
    display: block;
    font-weight: 800;
    margin-bottom: 10px;
    color: #38bdf8;
    font-size: 1.15rem;
}

.pin-box {
    margin: 20px 0;
    background: rgba(255, 193, 7, 0.15);
    padding: 20px 15px;
    border-radius: 16px;
    border: 1px solid rgba(255, 193, 7, 0.35);
    text-align: center;
}

.pin-label {
    display: block;
    font-weight: 800;
    margin-bottom: 10px;
    color: #fbbf24;
    font-size: 1.15rem;
}

.btn-action {
    width: 100%;
    padding: 15px 24px;
    border-radius: 14px;
    border: none;
    font-size: 1.2rem;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-action:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.btn-action:active {
    transform: translateY(0);
}

.btn-green {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: var(--basic-white);
}

.btn-blue {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    color: var(--basic-white);
}

.btn-nav {
    background: rgba(255, 255, 255, 0.12);
    color: var(--basic-white);
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 8px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    font-family: inherit;
    transition: all 0.2s ease;
}

.btn-nav:hover {
    background: rgba(255, 255, 255, 0.25);
}

.hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.hud-item {
    font-size: 1.2rem;
    font-weight: bold;
    color: #fbbf24;
}

.v1-options-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 20px 0;
}

.v1-action-area {
    margin-top: 20px;
}

.loader {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========================================= */
/* 🌟 APP PRELOADER & SEAMLESS TRANSITIONS   */
/* ========================================= */
.app-preloader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999999;
    background: #0f172a;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.app-preloader.hidden {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.preloader-spinner {
    width: 44px;
    height: 44px;
    border: 3.5px solid rgba(255, 255, 255, 0.15);
    border-top-color: #38bdf8;
    border-radius: 50%;
    animation: preloaderSpin 0.75s linear infinite;
}

.preloader-text {
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    opacity: 0.85;
}

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

