/* ==============================================
   BASE STYLES - Reset & Global Elements
   ============================================== */

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

html {
    font-size: var(--font-size-base);
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    color: var(--text-primary);
    background:
        radial-gradient(1200px 600px at 8% -10%, rgba(234, 148, 54, 0.10), transparent 65%),
        var(--bg-page);
    direction: rtl;
    text-align: right;
    line-height: 1.6;
    min-height: 100vh;
}

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

a {
    color: var(--brand-secondary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

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

input, textarea, select, button {
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
}

input, textarea, select {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-surface);
    color: var(--text-primary);
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
    outline: none;
    direction: rtl;
}

/* 🔴 WITHOUT THIS RULE, EVERY `dir="ltr"` IN index.html IS DEAD MARKUP.
   `direction: rtl` above is an AUTHOR declaration; the `dir` attribute is only a UA
   presentational hint, and the author sheet wins. So all 17 fields marked `dir="ltr"` —
   username, password, email, phone, address, the client fields, every one of them — still
   computed `direction: rtl`, and the settings audit's fix for finding #22 would have shipped
   protecting nothing at all. Measured on the running page before this rule existed:
   `client-phone`, which has carried `dir="ltr"` for as long as it has existed, computed `rtl`.
   The visible symptom is a trailing period landing at the WRONG END of an address or an email,
   and the caret jumping when a rep edits one. */
input[dir="ltr"], textarea[dir="ltr"], select[dir="ltr"] { direction: ltr; }

input:focus, textarea:focus, select:focus {
    border-color: rgba(234, 148, 54, 0.55);
    box-shadow: 0 0 0 3px rgba(234, 148, 54, 0.12);
}

/* The rule above sets `outline: none` on buttons as well as inputs — but only inputs got a
   replacement focus style. So keyboard focus was INVISIBLE on every button in the app: you
   could tab to حذف and have no idea you were on it. Inputs keep their existing treatment;
   this restores a visible ring for everything else, and only for keyboard focus, so a mouse
   click does not leave a ring behind. */
button:focus-visible,
a:focus-visible,
[role="button"]:focus-visible,
[tabindex]:not([tabindex="-1"]):focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
    border-radius: var(--border-radius);
}

input[readonly]:not([id="quote-prepared-by"]) {
    background: var(--bg-page);
    color: var(--text-muted);
    cursor: default;
    border-style: dashed;
}

input[readonly]:not([id="quote-prepared-by"]):focus {
    border-color: var(--border-color);
    box-shadow: none;
}

textarea {
    resize: vertical;
    min-height: 96px;
}

label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
}

.form-group:has(input[required]) label::after,
.form-group:has(select[required]) label::after {
    content: ' *';
    color: #ef4444;
}

::placeholder {
    color: var(--text-muted);
}

::selection {
    background: rgba(234, 148, 54, 0.18);
    color: #0f172a;
}
