/* =====================================================================
   Option One ERP/CRM - Base Stylesheet
   - Design tokens (CSS custom properties)
   - Light & Dark themes with gold accents
   - Bilingual / RTL support
   ===================================================================== */

/* ---------- Design tokens (default = Dark theme) ----------------- */
:root,
[data-theme="dark"] {
    /* Brand */
    --gold:           #d4af37;
    --gold-bright:    #f0c674;
    --gold-soft:      #b89530;
    --gold-glow:      rgba(212, 175, 55, 0.18);

    /* Surfaces */
    --bg:             #0b0b0d;
    --bg-elev-1:      #131316;
    --bg-elev-2:      #1a1a1f;
    --bg-elev-3:      #22222a;

    /* Borders */
    --border:         #2a2a31;
    --border-strong:  #3a3a44;

    /* Text */
    --text:           #f4f4f5;
    --text-muted:     #a1a1aa;
    --text-dim:       #6b6b75;

    /* Status */
    --success:        #22c55e;
    --warning:        #f59e0b;
    --danger:         #ef4444;
    --info:           #3b82f6;

    /* Effects */
    --shadow-sm:      0 1px 2px rgba(0,0,0,0.4);
    --shadow-md:      0 4px 12px rgba(0,0,0,0.5);
    --shadow-lg:      0 20px 50px rgba(0,0,0,0.6);

    /* Radii */
    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 16px;
    --r-pill: 999px;

    /* Typography */
    --font-display-en: 'Cormorant Garamond', 'Playfair Display', Georgia, serif;
    --font-body-en:    'Outfit', 'Manrope', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    --font-display-ar: 'Amiri', 'El Messiri', 'Tajawal', serif;
    --font-body-ar:    'Tajawal', 'Cairo', system-ui, sans-serif;
}

/* ---------- Light theme override ---------------------------------- */
[data-theme="light"] {
    --gold:           #b8860b;
    --gold-bright:    #d4a017;
    --gold-soft:      #a07509;
    --gold-glow:      rgba(184, 134, 11, 0.15);

    --bg:             #f8f7f4;
    --bg-elev-1:      #ffffff;
    --bg-elev-2:      #f3f1ec;
    --bg-elev-3:      #ebe7df;

    --border:         #e2ddd2;
    --border-strong:  #cbc4b3;

    --text:           #1c1c1f;
    --text-muted:     #5b5b66;
    --text-dim:       #8a8a96;

    --shadow-sm:      0 1px 2px rgba(20,20,30,0.06);
    --shadow-md:      0 4px 16px rgba(20,20,30,0.08);
    --shadow-lg:      0 20px 50px rgba(20,20,30,0.12);
}

/* ---------- Reset & base ----------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body-en);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html[lang="ar"] body,
html[dir="rtl"] body {
    font-family: var(--font-body-ar);
    font-size: 16px;
}

h1, h2, h3, h4, h5 {
    font-family: var(--font-display-en);
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text);
    margin: 0 0 0.5em;
}

html[lang="ar"] h1,
html[lang="ar"] h2,
html[lang="ar"] h3,
html[lang="ar"] h4,
html[lang="ar"] h5 {
    font-family: var(--font-display-ar);
}

a {
    color: var(--gold);
    text-decoration: none;
    transition: color 0.18s ease;
}
a:hover { color: var(--gold-bright); }

::selection {
    background: var(--gold);
    color: #000;
}

/* ---------- Forms ------------------------------------------------ */
.field {
    display: block;
    margin-bottom: 18px;
}

.field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

html[lang="ar"] .field label {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
}

.input,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="search"],
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-elev-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    font: inherit;
    transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}

.input:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 4px var(--gold-glow);
    background: var(--bg-elev-1);
}

input::placeholder,
textarea::placeholder { color: var(--text-dim); }

/* ---------- Buttons ---------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 18px;
    border-radius: var(--r-md);
    border: 1px solid transparent;
    background: var(--bg-elev-2);
    color: var(--text);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.08s, background 0.18s, border-color 0.18s, box-shadow 0.18s;
    text-decoration: none;
}

.btn:hover { background: var(--bg-elev-3); }
.btn:active { transform: translateY(1px); }

.btn-primary {
    background: linear-gradient(180deg, var(--gold-bright), var(--gold));
    color: #1c1407;
    border-color: var(--gold-soft);
    font-weight: 600;
    box-shadow: 0 6px 20px var(--gold-glow);
}
.btn-primary:hover {
    background: linear-gradient(180deg, var(--gold-bright), var(--gold-bright));
    color: #1c1407;
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
}
.btn-ghost:hover { color: var(--text); border-color: var(--gold); }

.btn-block { width: 100%; }

/* ---------- Top toolbar (used by login & inner pages) ----------- */
.app-toolbar {
    position: fixed;
    top: 18px;
    inset-inline-end: 22px;
    display: flex;
    gap: 8px;
    z-index: 50;
}

.toolbar-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--r-pill);
    border: 1px solid var(--border);
    background: var(--bg-elev-1);
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.18s, color 0.18s, background 0.18s;
}
.toolbar-btn:hover {
    border-color: var(--gold);
    color: var(--gold);
}

/* ---------- Alerts ----------------------------------------------- */
.alert {
    padding: 12px 14px;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    background: var(--bg-elev-2);
    color: var(--text);
    font-size: 14px;
    margin-bottom: 16px;
}
.alert-danger {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.35);
    color: #fca5a5;
}
[data-theme="light"] .alert-danger { color: #b91c1c; }

.alert-success {
    background: rgba(34, 197, 94, 0.08);
    border-color: rgba(34, 197, 94, 0.35);
    color: #86efac;
}
[data-theme="light"] .alert-success { color: #15803d; }

/* ---------- Utility ---------------------------------------------- */
.muted     { color: var(--text-muted); }
.text-gold { color: var(--gold); }
.center    { text-align: center; }
.hidden    { display: none !important; }

/* Google Fonts brought in via header.php / login.php */
