/* ألوان واضحة. الوضع المظلم يغيّر الخلفيات فقط، ويبقي الطبقات الشفافة شفافة. */
:root {
    --brand: #0c4a6e;
    --brand-2: #0369a1;
    --accent: #ea580c;
    --surface: #f4f7fb;
}

body { background-color: var(--surface); }

button.bg-black,
a.bg-black,
.option-card.bg-black,
.option-card.selected,
.service-card.selected,
.work-stage-card.selected {
    background-color: var(--brand);
    color: #fff;
}

.option-card.selected span,
.service-card.selected span,
.option-card.bg-black span {
    color: #fff;
}

button[type="submit"].bg-black\/25,
a.bg-black\/25,
.bg-black\/25 {
    background-color: var(--brand) !important;
    color: #fff !important;
}

#quick-order-fab a { background-color: var(--accent) !important; }

.option-card { padding: 0.4rem 0.6rem; min-height: 0; }
.option-card span { font-size: 0.875rem; }

/* لا تلوّن طبقات التعتيم بلون مصمت */
.fixed.inset-0,
[class*="bg-opacity"],
[class*="bg-black/"] {
    background-color: rgba(15, 23, 42, 0.45);
}

html.theme-dark { color-scheme: dark; }
html.theme-dark body { background: #0f172a; color: #e5e7eb; }
html.theme-dark header,
html.theme-dark aside#sidebar,
html.theme-dark aside {
    background-color: #111827;
    color: #f8fafc;
}
html.theme-dark .bg-white,
html.theme-dark .bg-gray-50,
html.theme-dark .bg-gray-100 {
    background-color: #1e293b;
    color: #f8fafc;
}
html.theme-dark .text-black,
html.theme-dark .text-gray-800,
html.theme-dark .text-gray-700 { color: #f8fafc; }
html.theme-dark .text-gray-600,
html.theme-dark .text-gray-500 { color: #cbd5e1; }
html.theme-dark .border-black,
html.theme-dark .border-gray-200,
html.theme-dark .border-gray-300 { border-color: #475569; }
html.theme-dark input,
html.theme-dark select,
html.theme-dark textarea {
    background-color: #0f172a;
    color: #f8fafc;
    border-color: #475569;
}
html.theme-dark .fixed.inset-0,
html.theme-dark [class*="bg-opacity"],
html.theme-dark [class*="bg-black/"] {
    background-color: rgba(2, 6, 23, 0.55);
}
#order-modal-overlay,
.side-modal-overlay {
    background-color: rgba(15, 23, 42, 0.45) !important;
}
html.theme-dark #order-modal-overlay,
html.theme-dark .side-modal-overlay {
    background-color: rgba(2, 6, 23, 0.55) !important;
}
html.theme-dark #order-modal,
html.theme-dark #receipt-panel,
html.theme-dark #user-dropdown,
html.theme-dark #notifications-dropdown,
html.theme-dark #work-timer-menu {
    background-color: #1e293b;
    color: #f8fafc;
}

@media (min-width: 1100px) {
    #print-workspace { display: block; }
    .print-line-item > .space-y-4 {
        display: grid;
        grid-template-columns: 1fr 1fr;
        column-gap: 16px;
        row-gap: 12px;
        align-items: start;
    }
    .print-line-item .field-span { grid-column: 1 / -1; }
    .design-slot { align-self: stretch; }
    #design-image-drop {
        min-height: 180px !important;
        max-height: 230px;
        height: 100%;
    }
    #design-image-preview-img {
        max-height: 140px !important;
        width: 100%;
        object-fit: contain;
    }
}

#design-image-drop {
    min-height: 150px;
    max-height: 210px;
    overflow: hidden;
}
#design-image-preview-img,
#modal-design-image {
    max-height: 140px !important;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}
#modal-design-image-wrap {
    min-height: 96px !important;
    max-height: 190px;
}

.page-loader {
    position: fixed;
    inset: 0;
    z-index: 40000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(244, 247, 251, 0.72);
    backdrop-filter: blur(2px);
}
.page-loader[hidden] { display: none !important; }
.page-loader-spin {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 3px solid #dbe4ee;
    border-top-color: #0c4a6e;
    animation: pageSpin .7s linear infinite;
}
@keyframes pageSpin { to { transform: rotate(360deg); } }
html.is-loading::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 40000;
    background: rgba(244, 247, 251, 0.78);
}
html.is-loading::after {
    content: "";
    position: fixed;
    top: 50%;
    left: 50%;
    width: 46px;
    height: 46px;
    margin: -23px 0 0 -23px;
    border-radius: 50%;
    border: 3px solid #dbe4ee;
    border-top-color: #0c4a6e;
    animation: pageSpin .65s linear infinite;
    z-index: 40001;
}
html.theme-dark.is-loading::before { background: rgba(15, 23, 42, 0.72); }

.field-guide-pulse {
    outline: 3px solid #dc2626;
    outline-offset: 3px;
}
#field-guide-tip {
    position: absolute;
    z-index: 80;
    background: #dc2626;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    pointer-events: none;
}

#printers-tbody tr[draggable="true"] { cursor: grab; }
#printers-tbody tr.printer-drag-over { outline: 2px solid #0c4a6e; }

/* صفوف الجداول في الوضع المظلم: خلفية داكنة ونص فاتح حتى مع تمرير الماوس */
html.theme-dark table {
    background-color: #1e293b;
    color: #f8fafc;
}
html.theme-dark thead th {
    background-color: #111827 !important;
    color: #f8fafc !important;
}
html.theme-dark tbody td {
    background-color: #1e293b !important;
    color: #f8fafc !important;
}
html.theme-dark tbody tr:hover td {
    background-color: #334155 !important;
    color: #f8fafc !important;
}
html.theme-dark tbody td span[class*="bg-yellow"],
html.theme-dark tbody td span[class*="bg-green"],
html.theme-dark tbody td span[class*="bg-red"],
html.theme-dark tbody td span[class*="bg-blue"] {
    color: #1e293b !important;
}

.global-search-field {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 12px;
    border: 2px solid #0f172a;
    border-radius: 10px;
    background: #fff;
}
.global-search-field i {
    color: #64748b;
    font-size: 14px;
    flex: 0 0 auto;
}
.global-search-field input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: none;
    background: transparent;
    font-size: 14px;
    color: #0f172a;
    padding: 0;
}
.global-search-field input::-webkit-search-decoration,
.global-search-field input::-webkit-search-cancel-button,
.global-search-field input::-webkit-search-results-button,
.global-search-field input::-webkit-search-results-decoration {
    -webkit-appearance: none;
    appearance: none;
    display: none;
}
html.theme-dark .global-search-field {
    background: #0f172a;
    border-color: #475569;
}
html.theme-dark .global-search-field input {
    color: #f8fafc;
    background: transparent !important;
}

.printer-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.printer-filter {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #0f172a;
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.printer-filter.active { background: #0c4a6e; color: #fff; border-color: #0c4a6e; }
.printer-filter-summary { margin-bottom: 12px; font-size: 13px; font-weight: 600; color: #334155; }
html.theme-dark .printer-filter { background: #1e293b; color: #f8fafc; border-color: #475569; }
html.theme-dark .printer-filter.active { background: #0369a1; color: #fff; border-color: #0369a1; }
html.theme-dark .printer-filter-summary { color: #cbd5e1; }
