/* IBM Plex Sans Arabic (SIL Open Font License, fonts/IBMPlexSansArabic-OFL.txt), served by the site itself: the screens do not
   wait for an internet font service (every window loads the stylesheet) */
@font-face {
    font-family: "IBM Plex Sans Arabic";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2") format("woff2");
    unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0898-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC;
}

@font-face {
    font-family: "IBM Plex Sans Arabic";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/ibm-plex-sans-arabic-latin-400-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

@font-face {
    font-family: "IBM Plex Sans Arabic";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("../fonts/ibm-plex-sans-arabic-arabic-500-normal.woff2") format("woff2");
    unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0898-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC;
}

@font-face {
    font-family: "IBM Plex Sans Arabic";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("../fonts/ibm-plex-sans-arabic-latin-500-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

@font-face {
    font-family: "IBM Plex Sans Arabic";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("../fonts/ibm-plex-sans-arabic-arabic-600-normal.woff2") format("woff2");
    unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0898-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC;
}

@font-face {
    font-family: "IBM Plex Sans Arabic";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("../fonts/ibm-plex-sans-arabic-latin-600-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

@font-face {
    font-family: "IBM Plex Sans Arabic";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("../fonts/ibm-plex-sans-arabic-arabic-700-normal.woff2") format("woff2");
    unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0898-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC;
}

@font-face {
    font-family: "IBM Plex Sans Arabic";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("../fonts/ibm-plex-sans-arabic-latin-700-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

/* BasicSoft web - shared styles.
   Colors are tokens; the three themes are the desktop skins (Settings.Default.Color):
   1 = Main (navy), 2 = Default (Windows grey), 3 = Blue (sky blue); 4 = Gulf Alliance (web only, the orange and navy of the
   client's logo, Helpers/ClientBrands; the default theme); 5 = Light green, 6 = Dark (web only).
   Layout uses logical properties (inline-start / inline-end) so Arabic (rtl) and English (ltr) share every rule. */

:root,
[data-theme="1"] {
    --bg: #dde5ef;
    --surface: #ffffff;
    --surface-muted: #f6f8fb;
    --text: #1b2a3d;
    --text-muted: #5a6a7e;
    --border: #d3dce8;
    --border-strong: #b9c6d6;
    --primary: #1f4e8c;
    --primary-hover: #2466b5;
    --primary-active: #1f3a5f;
    --primary-contrast: #ffffff;
    --ring: rgba(36, 102, 181, 0.22);
    --brand-from: #142a47;
    --brand-to: #2b7bd6;
    --positive: #2ecc71;
    --danger: #b42318;
    --danger-bg: #fdeceb;
    --danger-border: #f6c9c5;
    --warning: #9a6200;
    --shadow: 0 24px 60px -24px rgba(20, 42, 71, 0.45), 0 2px 6px rgba(20, 42, 71, 0.08);
}

[data-theme="2"] {
    --bg: #e3e6ea;
    --text: #1f2933;
    --text-muted: #5f6b77;
    --border: #d4d9df;
    --border-strong: #b8c0c9;
    --primary: #3e4c59;
    --primary-hover: #52606d;
    --primary-active: #1f2933;
    --ring: rgba(82, 96, 109, 0.25);
    --brand-from: #1f2933;
    --brand-to: #616e7c;
    --shadow: 0 24px 60px -24px rgba(31, 41, 51, 0.45), 0 2px 6px rgba(31, 41, 51, 0.08);
}

[data-theme="3"] {
    --bg: #d9e9f5;
    --text: #12324a;
    --text-muted: #4f6b80;
    --border: #cddff0;
    --border-strong: #a9c7e2;
    --primary: #1479b8;
    --primary-hover: #1d93d8;
    --primary-active: #0e5a8a;
    --ring: rgba(29, 147, 216, 0.25);
    --brand-from: #0b4a75;
    --brand-to: #29a6de;
    --shadow: 0 24px 60px -24px rgba(11, 74, 117, 0.45), 0 2px 6px rgba(11, 74, 117, 0.08);
}

/* the client Gulf Alliance Solutions Co. (the default theme): the golden amber of its logo (#e78d05 to #fdc324, owner's
   sample) for the buttons, bars and brand panel (the buttons at its deeper end, so white text on them stays readable), its navy for the text and the accents (--accent) */
[data-theme="4"] {
    --bg: #f8f1e3;
    --surface-muted: #fdf9f0;
    --text: #0e2352;
    --text-muted: #5f6474;
    --border: #ecdfc4;
    --border-strong: #dcc69c;
    --primary: #e8900a;
    --primary-hover: #f5a50c;
    --primary-active: #cc7a02;
    --ring: rgba(245, 165, 12, 0.35);
    --brand-from: #e28a03;
    --brand-to: #fdbe17;
    --accent: #0b3a86;
    --shadow: 0 24px 60px -24px rgba(150, 90, 0, 0.40), 0 2px 6px rgba(150, 90, 0, 0.08);
}

/* Light green (web only, owner's request): a pale mint page, the buttons in a mid green deep enough for white text on them
   to stay readable, the brand panel from deep to fresh green, a deep forest green for the accents */
[data-theme="5"] {
    --bg: #e6f4ea;
    --surface-muted: #f3faf5;
    --text: #15342a;
    --text-muted: #52695f;
    --border: #cfe5d6;
    --border-strong: #a8d0b6;
    --primary: #23874c;
    --primary-hover: #2b9d59;
    --primary-active: #1a6b3b;
    --ring: rgba(43, 157, 89, 0.28);
    --brand-from: #1d7a45;
    --brand-to: #5fc483;
    --accent: #14532d;
    --shadow: 0 24px 60px -24px rgba(20, 83, 45, 0.40), 0 2px 6px rgba(20, 83, 45, 0.08);
}

/* Dark (web only, owner's request): the point of sale's dark values (pos.css) for every page; color-scheme makes the
   browser's own controls, scroll bars and date pickers dark too */
[data-theme="6"] {
    color-scheme: dark;
    --bg: #0e141b;
    --surface: #17202a;
    --surface-muted: #1d2834;
    --text: #e7edf4;
    --text-muted: #a3b1c0;
    --border: #2b3948;
    --border-strong: #3b4c5f;
    --primary: #3d86d6;
    --primary-hover: #559ae4;
    --primary-active: #2c6db3;
    --primary-contrast: #ffffff;
    --ring: rgba(85, 154, 228, 0.35);
    --brand-from: #0f2a4a;
    --brand-to: #2a6fbd;
    --positive: #5fd6a2;
    --danger: #ff8a80;
    --danger-bg: #3a1d1d;
    --danger-border: #6e2f2b;
    --warning: #ffc76b;
    --accent: #8cc0f5;
    --shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.75), 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* a page printed in the Dark theme: the paper gets Main's dark text on white, not the screen's light text */
@media print {
    [data-theme="6"] {
        color-scheme: light;
        --bg: #ffffff;
        --surface: #ffffff;
        --surface-muted: #f6f8fb;
        --text: #1b2a3d;
        --text-muted: #5a6a7e;
        --border: #d3dce8;
        --border-strong: #b9c6d6;
        --accent: #1f4e8c;
    }
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
    font-size: calc(15px * var(--font-scale, 1));
    line-height: 1.5;
    transition: background-color 0.2s ease;
}

h1, h2, p {
    margin: 0;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.inline-form {
    display: inline;
    margin: 0;
}

/* ---------- buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 46px;
    padding: 0 20px;
    border: 1px solid transparent;
    border-radius: 10px;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px var(--ring);
}

.btn-primary {
    background: var(--primary);
    color: var(--primary-contrast);
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-primary:active {
    background: var(--primary-active);
}

.btn-secondary {
    background: var(--surface);
    border-color: var(--border-strong);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--surface-muted);
}

.btn-ghost {
    height: 36px;
    padding: 0 14px;
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.28);
    color: #ffffff;
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn[disabled] {
    cursor: progress;
    opacity: 0.85;
}

/* ---------- brand mark ---------- */

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.14);
    color: var(--positive);
    flex: none;
}

/* ---------- the content of a window (Views/Shared/_Layout) ---------- */

.screen-body {
    min-height: 100vh;
    background: var(--surface-muted);
}

.screen-pending {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 100vh;
    padding: 32px 16px;
    text-align: center;
}

.screen-pending-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--brand-from), var(--brand-to));
    color: var(--positive);
}

.screen-pending h1 {
    font-size: calc(22px * var(--font-scale, 1));
    font-weight: 700;
}

.screen-pending p {
    max-width: 440px;
    color: var(--text-muted);
}

/* PageDialog (Scripts/pagedialog.js): the desktop's modal forms, used by every screen */
.page-dialog {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    background: rgba(15, 25, 40, 0.45);
}

/* the invoice forms (PageDialog.open with large: true): the whole height of the window but 4px a side */
.page-dialog-large {
    padding: 4px;
}

/* the item card (PageDialog.open with size: 'item', up to 1200 x 860): the whole window on a phone */
@media (max-width: 600px) {
    .page-dialog-item {
        padding: 0;
    }

    .page-dialog-item .page-dialog-box {
        width: 100% !important;
        height: 100% !important;
        border-radius: 0;
    }
}

.page-dialog-box {
    display: flex;
    flex-direction: column;
    max-width: 100%;
    max-height: 100%;
    border-radius: 10px;
    overflow: hidden;
    background: var(--surface);
    box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.5);
}

.page-dialog-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    height: 34px;
    padding: 0 6px 0 12px;
    background: linear-gradient(90deg, var(--brand-from), var(--brand-to));
    color: #ffffff;
    font-size: calc(13.5px * var(--font-scale, 1));
    font-weight: 700;
}

.page-dialog-close {
    width: 30px;
    height: 26px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #ffffff;
    font-size: calc(20px * var(--font-scale, 1));
    line-height: 1;
    cursor: pointer;
}

.page-dialog-close:hover {
    background: #e81123;
}

.page-dialog-frame {
    flex: 1;
    width: 100%;
    border: 0;
    background: var(--surface);
}

/* the loading mask of a window / form while its page loads (Scripts/shell.js, Scripts/pagedialog.js) */
.loading-mask {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(246, 248, 251, 0.88);
    background: color-mix(in srgb, var(--surface-muted, #f3f5f8) 88%, transparent);
    color: var(--text-muted, #4a5568);
    font-size: calc(14px * var(--font-scale, 1));
    font-weight: 600;
    cursor: progress;
    animation: loading-mask-in 0.15s ease-out;
}

.loading-mask[hidden] {
    display: none;
}

.loading-mask-spinner {
    width: 36px;
    height: 36px;
    border: 4px solid var(--border, #d5dbe3);
    border-top-color: var(--primary, #1f3a5f);
    border-radius: 50%;
    animation: loading-mask-spin 0.8s linear infinite;
}

@keyframes loading-mask-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes loading-mask-in {
    from {
        opacity: 0;
    }
}

/* a screen that is reading its data (body.is-waiting): a thin moving bar on top */
body.is-waiting::before {
    content: "";
    position: fixed;
    inset-inline: 0;
    top: 0;
    z-index: 100;
    height: 3px;
    background: linear-gradient(90deg, transparent 0%, var(--primary, #1f3a5f) 40%, var(--primary, #1f3a5f) 60%, transparent 100%);
    background-size: 200% 100%;
    animation: loading-bar 1s linear infinite;
    pointer-events: none;
}

@keyframes loading-bar {
    from {
        background-position: 100% 0;
    }

    to {
        background-position: -100% 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .loading-mask-spinner,
    body.is-waiting::before {
        animation-duration: 3s;
    }
}

.page-dialog-body {
    position: relative;
    display: flex;
    flex: 1;
    min-height: 0;
}

/* the typing combos of every screen (Scripts/searchcombo.js): the text box and its list of matches */
.im-combo {
    position: relative;
}

.im-combo-text {
    width: 100%;
}

/* the arrow that tells it is a drop-down (owner's request; a click on it opens the list), not on the promotions'
   several-values box */
.im-combo:not(.prm-multi-input)::after {
    content: "";
    position: absolute;
    inset-inline-end: 9px;
    top: 50%;
    width: 14px;
    height: 14px;
    margin-top: -7px;
    /* a chevron pointing down (the same in both directions) */
    background: no-repeat center / 14px 14px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 6l4.5 4.5L12.5 6' fill='none' stroke='%235a6a7e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    pointer-events: none;
}

.im-combo:not(.prm-multi-input) > .im-combo-text {
    padding-inline-end: 28px;
}

.im-combo:not(.prm-multi-input):has(> .im-combo-text:disabled)::after {
    opacity: 0.35;
}

/* "-- اختر --" as a placeholder: muted, as the empty choice it is */
.im-combo-text::placeholder {
    color: var(--text-muted, #5a6a7e);
    opacity: 1;
}

.im-combo-list {
    position: absolute;
    inset-inline: 0;
    top: 100%;
    z-index: 20;
    max-height: 240px;
    margin: 2px 0 0;
    padding: 4px 0;
    overflow: auto;
    list-style: none;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 12px 28px -12px rgba(0, 0, 0, 0.35);
}

.im-combo-list li {
    padding: 5px 10px;
    font-size: calc(13px * var(--font-scale, 1));
    cursor: pointer;
}

.im-combo-list li:hover,
.im-combo-list li.is-active {
    background: var(--primary);
    color: var(--primary-contrast);
}

/* the pagers (<< < page > >>): in Arabic the row is mirrored, "first" on the right, so the arrows are mirrored too (each
   button points the way it goes, as on the desktop's right-to-left forms) */
html[dir="rtl"] .items-page-button,
html[dir="rtl"] .pager-btn {
    transform: scaleX(-1);
}

/* the end of the session (Scripts/sessionexpiry.js): over everything, only its button closes it */
.session-expired {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 25, 40, 0.6);
}

.session-expired-box {
    width: 100%;
    max-width: 420px;
    padding: 24px;
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.session-expired-box h2 {
    margin: 0 0 8px;
    font-size: 1.2rem;
}

.session-expired-box p {
    margin: 0 0 20px;
    line-height: 1.6;
}

/* the user's add / edit / delete permissions (Scripts/permissions.js): a button the user lacks stays visible but greyed,
   with the tooltip of the missing permission (Strings.UpDenied*); its click shows the hint at the bottom of the window */
.perm-denied,
.perm-denied:hover,
.perm-denied:active {
    opacity: 0.45;
    filter: grayscale(1);
    cursor: not-allowed !important;
    box-shadow: none !important;
}

.perm-toast {
    position: fixed;
    inset-inline: 0;
    bottom: 24px;
    z-index: 2147482000;
    width: max-content;
    max-width: calc(100% - 32px);
    margin: 0 auto;
    padding: 10px 18px;
    border: 1px solid var(--danger-border);
    border-radius: 8px;
    background: var(--danger-bg);
    color: var(--danger);
    font-weight: 600;
    box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.35);
    cursor: pointer;
}

.perm-toast[hidden] {
    display: none;
}

/* the refusal page of an add / edit form opened without the permission (Views/Shared/PermissionDenied.cshtml) */
.perm-denied-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 16px;
    box-sizing: border-box;
}

.perm-denied-card {
    width: 100%;
    max-width: 420px;
    padding: 28px 24px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    text-align: center;
}

.perm-denied-card svg {
    color: var(--danger);
}

.perm-denied-title {
    margin: 8px 0;
    font-size: 1.15rem;
}

.perm-denied-text {
    margin: 0 0 20px;
    line-height: 1.6;
    color: var(--text-muted);
}

/* the red star beside the label of a required field (Scripts/requiredmarks.js: aria-required="true" or required) */
.req-star {
    margin-inline-start: 3px;
    color: var(--danger, #b42318);
    font-weight: 700;
}

/* the question before a form with unsaved changes closes (Scripts/unsavedguard.js; owner's request: "in all add edit
   screens of invoices add confirm when click on cancel button and any other screens"): over everything of the form */
.usg-dialog {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 25, 40, 0.45);
}

.usg-dialog[hidden] {
    display: none;
}

.usg-box {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: start;
    gap: 14px;
    width: min(440px, 100%);
    padding: 20px;
    border: 1px solid var(--border, #d3dce8);
    border-radius: 12px;
    background: var(--surface, #ffffff);
    color: var(--text, #1b2a3d);
    box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.5);
    font-size: calc(15px * var(--font-scale, 1));
}

.usg-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--warning, #9a6200);
    color: #ffffff;
    font-size: calc(20px * var(--font-scale, 1));
    font-weight: 700;
}

.usg-text {
    margin: 6px 0 0;
    line-height: 1.6;
    font-weight: 600;
}

.usg-actions {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.usg-actions .btn {
    height: 40px;
    font-size: calc(14px * var(--font-scale, 1));
}

.usg-discard {
    background: var(--danger, #b42318);
    color: #ffffff;
}

.usg-discard:hover {
    filter: brightness(1.08);
}

/* the Dark theme's light red: dark text on it */
:where([data-theme="6"]) .usg-discard {
    color: #2a0b08;
}

@media (max-width: 480px) {
    .usg-actions .btn {
        flex: 1 1 100%;
    }
}
