/* ZAR THEME + RESPONSIVE POS DOCK — 2026-09-06 */
:root {
  --zar-bg: #070b12;
  --zar-surface: #0f1722;
  --zar-surface-2: #17212e;
  --zar-border: #334155;
  --zar-text: #f8fafc;
  --zar-muted: #cbd5e1;
  --zar-accent: #e11d2e;
  --zar-shadow: 0 10px 30px rgba(0,0,0,.22);
}

#zar-day-night-switch {
  position: fixed; right: 18px; bottom: 84px; z-index: 10050;
  width: 46px; height: 46px; border: 1px solid var(--zar-border);
  border-radius: 50%; background: var(--zar-surface); color: var(--zar-text);
  box-shadow: var(--zar-shadow); display: grid; place-items: center;
  font-size: 19px; cursor: pointer; transition: transform .2s, background .2s;
}
#zar-day-night-switch:hover { transform: translateY(-2px); }
#zar-day-night-switch:focus-visible { outline: 3px solid rgba(225,29,46,.35); outline-offset: 2px; }

body.zar-theme-dark { background: var(--zar-bg) !important; color: var(--zar-text) !important; }
body.zar-theme-dark .content-wrapper,
body.zar-theme-dark .main-footer,
body.zar-theme-dark .modal-content,
body.zar-theme-dark .box,
body.zar-theme-dark .card,
body.zar-theme-dark .panel,
body.zar-theme-dark .dropdown-menu,
body.zar-theme-dark .select2-dropdown,
body.zar-theme-dark .table-responsive { background-color: var(--zar-surface) !important; color: var(--zar-text) !important; }
body.zar-theme-dark .box-header,
body.zar-theme-dark .box-footer,
body.zar-theme-dark .modal-header,
body.zar-theme-dark .modal-footer,
body.zar-theme-dark .panel-heading,
body.zar-theme-dark .table > thead > tr > th { background-color: var(--zar-surface-2) !important; color: var(--zar-text) !important; border-color: var(--zar-border) !important; }
body.zar-theme-dark .table > tbody > tr > td,
body.zar-theme-dark .table > tfoot > tr > td,
body.zar-theme-dark hr { border-color: var(--zar-border) !important; }
body.zar-theme-dark .table-striped > tbody > tr:nth-of-type(odd),
body.zar-theme-dark .table-hover > tbody > tr:hover { background-color: #131d29 !important; }
body.zar-theme-dark input:not([type=checkbox]):not([type=radio]),
body.zar-theme-dark select,
body.zar-theme-dark textarea,
body.zar-theme-dark .select2-selection,
body.zar-theme-dark .form-control { background: #0b111a !important; color: var(--zar-text) !important; border-color: var(--zar-border) !important; }
body.zar-theme-dark input::placeholder,
body.zar-theme-dark textarea::placeholder { color: #94a3b8 !important; opacity: 1; }
body.zar-theme-dark label,
body.zar-theme-dark h1, body.zar-theme-dark h2, body.zar-theme-dark h3,
body.zar-theme-dark h4, body.zar-theme-dark h5, body.zar-theme-dark h6,
body.zar-theme-dark .text-black { color: var(--zar-text) !important; }
body.zar-theme-dark .text-muted,
body.zar-theme-dark .help-block { color: var(--zar-muted) !important; }

body.zar-theme-light {
  --zar-bg: #eef2f7; --zar-surface: #ffffff; --zar-surface-2: #f8fafc;
  --zar-border: #d7dee8; --zar-text: #172033; --zar-muted: #64748b;
  background: var(--zar-bg) !important; color: var(--zar-text) !important;
}
body.zar-theme-light .ferrari-pos-shell,
body.zar-theme-light .ferrari-action-dock,
body.zar-theme-light .ferrari-action-row,
body.zar-theme-light .pos-form-actions,
body.zar-theme-light .codex-mobile-dock,
body.zar-theme-light .zrx-main-actions { background: var(--zar-surface) !important; color: var(--zar-text) !important; }
body.zar-theme-light .ferrari-pos-shell *,
body.zar-theme-light .pos-form-actions * { text-shadow: none !important; }
body.zar-theme-light .ferrari-pos-shell input,
body.zar-theme-light .ferrari-pos-shell select,
body.zar-theme-light .ferrari-pos-shell textarea,
body.zar-theme-light .ferrari-pos-shell .form-control { background: #fff !important; color: #172033 !important; border-color: #b9c4d2 !important; }
body.zar-theme-light .ferrari-pos-shell .table,
body.zar-theme-light .ferrari-pos-shell .table td,
body.zar-theme-light .ferrari-pos-shell .table th { background: #fff !important; color: #172033 !important; border-color: #cbd5e1 !important; }
body.zar-theme-light .content-wrapper,
body.zar-theme-light .main-footer,
body.zar-theme-light .modal-content,
body.zar-theme-light .box,
body.zar-theme-light .card,
body.zar-theme-light .panel { background-color: #fff !important; color: #172033 !important; }

/* Reflow every checkout control; never squeeze or overflow at small widths. */
@media (max-width: 1199px) {
  .ferrari-action-row { height: auto !important; min-height: 0 !important; }
  .ferrari-action-dock { position: relative !important; height: auto !important; padding: 8px !important; }
  .ferrari-action-dock > .tw-flex { display: grid !important; grid-template-columns: 1fr !important; overflow: visible !important; padding: 0 !important; }
  .ferrari-action-dock .zrx-main-actions { display: grid !important; grid-template-columns: repeat(auto-fit,minmax(92px,1fr)) !important; gap: 8px !important; width: 100% !important; overflow: visible !important; }
  .ferrari-action-dock .zrx-main-actions > * { min-width: 0 !important; width: 100% !important; max-width: none !important; }
  .ferrari-action-dock .zrx-checkout-pair { display: grid !important; grid-template-columns: repeat(auto-fit,minmax(56px,1fr)) !important; width: 100% !important; }
  .ferrari-action-dock .zrx-checkout-action,
  .ferrari-action-dock button { min-height: 48px !important; white-space: normal !important; line-height: 1.15 !important; }
  .ferrari-action-dock .pos-total { display: flex !important; grid-column: 1 / -1 !important; order: -20; justify-content: center !important; padding: 9px 12px !important; border: 1px solid var(--zar-border) !important; border-radius: 10px; }
  .ferrari-action-dock .zrx-recent-wrap { width: 100% !important; }
  .codex-mobile-dock { display: grid !important; grid-template-columns: 1fr !important; gap: 8px !important; width: 100% !important; }
  .codex-mobile-total { grid-column: 1 / -1; display: flex !important; justify-content: center; padding: 9px; border: 1px solid var(--zar-border); border-radius: 10px; }
  .codex-mobile-buttons { display: grid !important; grid-template-columns: repeat(auto-fit,minmax(92px,1fr)) !important; gap: 8px !important; width: 100% !important; }
  .codex-mobile-buttons > button, .codex-mobile-buttons > div { width: 100% !important; min-width: 0 !important; min-height: 48px !important; }
}
@media (max-width: 575px) {
  #zar-day-night-switch { right: 12px; bottom: 70px; width: 42px; height: 42px; }
  .codex-mobile-buttons, .ferrari-action-dock .zrx-main-actions { grid-template-columns: repeat(2,minmax(0,1fr)) !important; }
  .ferrari-action-dock { border-radius: 12px 12px 0 0 !important; }
}
@media (min-width: 1200px) { .codex-mobile-dock { display: none !important; } }

#zar-theme-toggle { display:none !important; }

/* Strong mobile containment: page-specific POS rules load later. */
@media (max-width: 1199px) {
  html body .ferrari-action-dock > div.tw-flex {
    display: grid !important; grid-template-columns: minmax(0,1fr) !important;
    width: 100% !important; max-width: 100% !important;
  }
  html body .ferrari-action-dock div.zrx-main-actions {
    display: grid !important; grid-column: 1 / -1 !important;
    grid-template-columns: repeat(auto-fit,minmax(92px,1fr)) !important;
    width: 100% !important; max-width: 100% !important; overflow: visible !important;
  }
  html body .ferrari-action-dock div.zrx-main-actions > * {
    grid-column: auto !important; grid-row: auto !important;
    width: 100% !important; min-width: 0 !important; max-width: 100% !important;
    margin: 0 !important; transform: none !important;
  }
  html body .ferrari-action-dock div.zrx-main-actions > .hide,
  html body .ferrari-action-dock div.zrx-main-actions > [style*="display: none"] { display: none !important; }
  html body .ferrari-action-dock div.zrx-main-actions > .pos-total {
    display: flex !important; grid-column: 1 / -1 !important; width: 100% !important;
    min-height: 52px !important; height: auto !important; order: -99 !important;
  }
}
@media (max-width: 575px) {
  html body .ferrari-action-dock div.zrx-main-actions {
    grid-template-columns: repeat(3,minmax(0,1fr)) !important;
  }
}

#zar-final-theme-switch{position:fixed;right:18px;bottom:84px;z-index:10060;width:46px;height:46px;border:1px solid #475569;border-radius:50%;background:#0f1722;color:#fff;box-shadow:0 10px 30px rgba(0,0,0,.3);display:grid;place-items:center;font-size:19px;cursor:pointer}body.zar-theme-light #zar-final-theme-switch{background:#fff;color:#172033;border-color:#cbd5e1}@media(max-width:575px){#zar-final-theme-switch{right:12px;bottom:70px;width:42px;height:42px}}


/* --- PRINT DARK BACKGROUND FIX --- */
@media print {
    :root, html, body,
    body.zar-theme-dark,
    body.zar-theme-light,
    body[class*="zar-theme-"] {
        --zt-bg: transparent !important;
        --zt-surface: transparent !important;
        --zt-surface2: transparent !important;
        --zar-bg: transparent !important;
        --zar-surface: transparent !important;
        background: transparent !important;
        background-color: transparent !important;
        background-image: none !important;
        color: #000000 !important;
        color-scheme: light !important;
        height: auto !important;
        min-height: 0 !important;
    }

    body.zar-theme-dark .thetop,
    body.zar-theme-light .thetop,
    body[class*="zar-theme-"] .thetop,
    body.zar-theme-dark main,
    body.zar-theme-light main,
    body[class*="zar-theme-"] main,
    body.zar-theme-dark #scrollable-container,
    body.zar-theme-light #scrollable-container,
    body[class*="zar-theme-"] #scrollable-container,
    body.zar-theme-dark .content-wrapper,
    body.zar-theme-light .content-wrapper,
    body[class*="zar-theme-"] .content-wrapper,
    body.zar-theme-dark .content,
    body.zar-theme-light .content,
    body[class*="zar-theme-"] .content,
    body.zar-theme-dark .wrapper,
    body.zar-theme-light .wrapper,
    body[class*="zar-theme-"] .wrapper,
    body.zar-theme-dark section.content,
    body.zar-theme-light section.content,
    body[class*="zar-theme-"] section.content,
    .thetop, main, #scrollable-container, .content-wrapper, .content, .wrapper, section.content {
        background: transparent !important;
        background-color: transparent !important;
        background-image: none !important;
        box-shadow: none !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
    }

    .tw-h-screen, .tw-h-full,
    body[class*="zar-theme-"] .tw-h-screen,
    body[class*="zar-theme-"] .tw-h-full {
        height: auto !important;
        min-height: 0 !important;
    }

    #zar_print_cut_feed {
        display: none !important;
        height: 0 !important;
    }
}
