/* =============================================
   DrawKids — App Styles
   Design Tokens + Reset + Base + Layout
   ============================================= */

/* ===== Design Tokens ===== */
:root {
    /* Primary — أزرق مرح */
    --primary-50:  #E6F0FF;
    --primary-100: #BFDBFE;
    --primary-200: #93C5FD;
    --primary-300: #60A5FA;
    --primary-400: #3B82F6;
    --primary-500: #4D96FF;
    --primary-600: #3B82F6;
    --primary-700: #2563EB;

    /* Secondary — أصفر سعيد */
    --secondary-50:  #FFF9E6;
    --secondary-100: #FFF3BF;
    --secondary-300: #FFD93D;
    --secondary-400: #FCC419;
    --secondary-500: #F5B700;

    /* Accent — برتقالي */
    --accent-300: #FF9A6C;
    --accent-500: #FF6B35;

    /* Success — أخضر */
    --success-50:  #E6F9EE;
    --success-500: #6BCB7F;
    --success-700: #28A745;

    /* Warning */
    --warning-500: #FCC419;

    /* Error — أحمر */
    --error-50:  #FEECEC;
    --error-500: #E63946;

    /* Neutrals */
    --gray-50:  #F8FAFC;
    --gray-100: #F1F5F9;
    --gray-200: #E2E8F0;
    --gray-300: #CBD5E1;
    --gray-400: #94A3B8;
    --gray-500: #64748B;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1E293B;
    --gray-900: #0F172A;

    /* Background */
    --bg-primary: #F0F9FF;
    --bg-surface: #FFFFFF;
    --bg-muted:   #F1F5F9;

    /* Text */
    --text-primary:   #2D3748;
    --text-secondary: #718096;
    --text-muted:     #94A3B8;
    --text-inverse:   #FFFFFF;

    /* Font */
    --font-primary: 'Cairo', 'Almarai', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Cairo', 'Baloo Bhaijaan 2', sans-serif;

    /* Font Sizes */
    --text-xs:   0.75rem;   /* 12px */
    --text-sm:   0.875rem;  /* 14px */
    --text-base: 1rem;      /* 16px */
    --text-lg:   1.125rem;  /* 18px */
    --text-xl:   1.25rem;   /* 20px */
    --text-2xl:  1.5rem;    /* 24px */
    --text-3xl:  1.875rem;  /* 30px */
    --text-4xl:  2.25rem;   /* 36px */

    /* Spacing */
    --space-1:  4px;
    --space-2:  8px;
    --space-3:  12px;
    --space-4:  16px;
    --space-5:  20px;
    --space-6:  24px;
    --space-8:  32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* Radius */
    --radius-sm:   8px;
    --radius-md:   12px;
    --radius-lg:   16px;
    --radius-xl:   24px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.10);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.14);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.20);
    --shadow-primary: 0 4px 14px rgba(77, 150, 255, 0.4);

    /* Transitions */
    --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-bouncy:   cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth:   cubic-bezier(0.4, 0, 0.2, 1);
    --duration-fast:   150ms;
    --duration-medium: 250ms;
    --duration-slow:   400ms;

    /* Z-index */
    --z-dropdown: 100;
    --z-sticky:   200;
    --z-modal:    1000;
    --z-toast:    1100;

    /* Layout */
    --header-height: 64px;
    --bottom-nav-height: 72px;
    --max-width: 1200px;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-primary);
    color: var(--text-primary);
    direction: rtl;
    text-align: right;
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

ul, ol {
    list-style: none;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    border: 2px solid transparent;
    border-radius: var(--radius-lg);
    font-family: var(--font-primary);
    font-weight: 700;
    font-size: var(--text-base);
    line-height: 1;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-standard);
    text-decoration: none;
    min-height: 48px;
    min-width: 48px;
    white-space: nowrap;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.btn:focus-visible {
    outline: 3px solid var(--primary-500);
    outline-offset: 2px;
}

.btn:active {
    transform: scale(0.97);
}

/* Primary */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    color: var(--text-inverse);
    box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(77, 150, 255, 0.5);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Secondary */
.btn-secondary {
    background: var(--secondary-300);
    color: var(--gray-800);
    box-shadow: 0 4px 14px rgba(255, 217, 61, 0.4);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 217, 61, 0.5);
}

/* Ghost */
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 2px solid var(--gray-200);
}

.btn-ghost:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
}

/* Sizes */
.btn-sm {
    min-height: 40px;
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
}

.btn-lg {
    min-height: 56px;
    padding: var(--space-4) var(--space-8);
    font-size: var(--text-lg);
}

.btn-xl {
    min-height: 64px;
    padding: var(--space-4) var(--space-10);
    font-size: var(--text-xl);
    border-radius: var(--radius-xl);
}

/* ===== Icon Button ===== */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    border: 2px solid var(--gray-200);
    font-size: 1.25rem;
    transition: all var(--duration-fast) var(--ease-standard);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.btn-icon:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
    transform: scale(1.05);
}

/* ===== Header ===== */
.site-header {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--gray-200);
    height: var(--header-height);
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-4);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
}

.logo-icon {
    font-size: 1.75rem;
    line-height: 1;
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.logo-name {
    font-weight: 900;
    font-size: var(--text-lg);
    color: var(--primary-500);
    letter-spacing: -0.5px;
}

.logo-ar {
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-weight: 600;
}

/* Main Nav (Desktop) */
.main-nav {
    display: none;
    align-items: center;
    gap: var(--space-1);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    transition: all var(--duration-fast) var(--ease-standard);
}

.nav-link:hover {
    background: var(--primary-50);
    color: var(--primary-500);
}

.nav-link.active {
    background: var(--primary-500);
    color: var(--text-inverse);
}

.header-settings {
    flex-shrink: 0;
}

/* ===== Main ===== */
.site-main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--space-6) var(--space-4);
    padding-bottom: calc(var(--bottom-nav-height) + var(--space-6));
    min-height: calc(100vh - var(--header-height));
}

/* ===== Bottom Navigation (Mobile) ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: var(--z-sticky);
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: var(--bottom-nav-height);
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-md);
    min-width: 56px;
    min-height: 56px;
    transition: all var(--duration-fast) var(--ease-standard);
    color: var(--text-muted);
}

.bottom-nav-item.active {
    color: var(--primary-500);
}

.bottom-nav-item.active .bottom-nav-icon {
    transform: scale(1.15);
}

.bottom-nav-icon {
    font-size: 1.5rem;
    line-height: 1;
    transition: transform var(--duration-fast) var(--ease-bouncy);
}

.bottom-nav-label {
    font-size: 0.625rem;
    font-weight: 700;
}

/* زر الرسم المركزي */
.bottom-nav-draw {
    position: relative;
}

.bottom-nav-draw .bottom-nav-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    color: white;
    border-radius: 50%;
    font-size: 1.5rem;
    margin-top: -20px;
    box-shadow: var(--shadow-primary);
    border: 4px solid var(--bg-primary);
}

.bottom-nav-draw .bottom-nav-label {
    margin-top: -2px;
    color: var(--primary-500);
}

/* ===== Sections ===== */
.section {
    margin-bottom: var(--space-8);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.section-title {
    font-size: var(--text-xl);
    font-weight: 800;
}

.section-link {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--primary-500);
    transition: color var(--duration-fast);
}

.section-link:hover {
    color: var(--primary-700);
}

/* ===== Page Header ===== */
.page-header {
    margin-bottom: var(--space-6);
}

.page-title {
    font-size: var(--text-3xl);
    font-weight: 900;
    margin-bottom: var(--space-1);
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: var(--text-base);
}

/* ===== Responsive ===== */
@media (min-width: 768px) {
    :root {
        --header-height: 72px;
    }

    .main-nav {
        display: flex;
    }

    .bottom-nav {
        display: none;
    }

    .site-main {
        padding-bottom: var(--space-8);
    }

    .page-title {
        font-size: var(--text-4xl);
    }
}

@media (min-width: 1024px) {
    .site-main {
        padding: var(--space-8);
    }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== Print ===== */
@media print {
    .site-header,
    .bottom-nav,
    .btn {
        display: none !important;
    }
}
