﻿/* =========================
   Solentx UI System
   Buttons, Inputs, Tables, Badges, Tabs
   + Custom Modal (st-overlay + st-modal)
   + Bootstrap Modal skinning (.modal-content.st-modal)
   + POS helpers (banner/receipt/toasts)
   ========================= */

/* ===== Buttons ===== */
.st-btn {
    border: 0;
    border-radius: 12px;
    height: 42px;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
    transition: transform .15s ease, filter .15s ease, background-color .15s ease, border-color .15s ease;
}

    .st-btn:disabled {
        opacity: .55;
        cursor: not-allowed;
        transform: none !important;
    }

.st-btn-primary {
    background: linear-gradient(135deg, var(--st-blue), var(--st-blue-2));
    color: #fff;
    box-shadow: 0 10px 22px rgba(37,99,235,0.35);
}

    .st-btn-primary:hover {
        filter: brightness(1.05);
        transform: translateY(-1px);
    }

.st-btn-secondary {
    background: linear-gradient(135deg, #334155, #020617);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.18);
}

.st-btn-outline {
    background: transparent;
    color: var(--st-text);
    border: 2px solid rgba(255,255,255,0.22);
}

.st-btn-danger {
    background: linear-gradient(135deg, #7c2d12, #dc2626);
    color: #fff;
}

.st-btn-sm {
    height: 36px;
    padding: 0 12px;
    border-radius: 12px;
    font-weight: 850;
}

/* Optional: make anchors behave like buttons */
a.st-btn {
    text-decoration: none;
}

/* ===== Inputs ===== */
.st-input,
.st-select {
    height: 42px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(255,255,255,0.06);
    box-shadow: none;
    color: rgba(234,242,255,0.98);
    font-weight: 800;
    letter-spacing: .01em;
}

    .st-input::placeholder {
        color: rgba(234,242,255,0.62);
        font-weight: 700;
    }

    .st-input:focus,
    .st-select:focus {
        border-color: rgba(56,189,248,0.90);
        box-shadow: 0 0 0 .15rem rgba(56,189,248,.25);
        background: rgba(255,255,255,0.07);
    }

    .st-select option {
        background: #020617;
        color: #f8fafc;
    }

/* ===== Table / Grid ===== */
.st-table th {
    color: var(--st-text);
    font-weight: 900;
    border-bottom: 1px solid var(--st-border);
}

.st-table td {
    border-top: 1px solid var(--st-border);
}

/* ===== Badges ===== */
/* Keep badges on one line (fixes "Best value" wrapping) */
.st-badge {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    line-height: 1;
    padding: 6px 10px;
    border-radius: 999px;
}

/* Optional: slightly smaller badge on narrow screens */
@media (max-width: 420px) {
    .st-badge {
        font-size: .85rem;
        padding: 5px 9px;
    }
}

.st-badge-ok {
    background: rgba(56,189,248,.15);
    color: var(--st-blue);
}

.st-badge-warn {
    background: rgba(245,158,11,.15);
    color: #f59e0b;
}

.st-badge-danger {
    background: rgba(239,68,68,.18);
    color: var(--st-danger);
}

/* ===== Tabs / Pills ===== */
.st-tabs {
    display: inline-flex;
    gap: 6px;
    padding: 6px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.04);
}

.st-tab {
    border: 1px solid transparent;
    background: transparent;
    color: rgba(234,242,255,0.78);
    border-radius: 999px;
    padding: 8px 12px;
    font-weight: 950;
    cursor: pointer;
    transition: background .12s ease, border-color .12s ease, color .12s ease;
}

    .st-tab:hover {
        background: rgba(255,255,255,0.06);
        color: rgba(234,242,255,0.92);
    }

    .st-tab.active {
        background: rgba(56,189,248,0.14);
        border-color: rgba(56,189,248,0.22);
        color: rgba(234,242,255,0.95);
        box-shadow: 0 0 0 3px rgba(56,189,248,0.10);
    }

/* =========================================================
   MODALS (two kinds)
   1) Custom: .st-overlay + .st-modal
   2) Bootstrap: .modal-content.st-modal (skin only)
   ========================================================= */

/* Overlay: custom + bootstrap backdrop */
.st-overlay,
.modal-backdrop.show {
    background: rgba(2, 6, 23, 0.75) !important;
    backdrop-filter: blur(6px);
    z-index: 1040;
}

/* ----- Custom modal container ----- */
.st-modal {
    position: fixed;
    left: 50%;
    top: 132px;
    transform: translateX(-50%);
    width: min(760px, calc(100vw - 28px));
    max-height: calc(100vh - 18vh);
    overflow: auto;
    z-index: 1050;
    background: var(--st-panel-strong);
    border: 1px solid rgba(255,255,255,0.16);
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(0,0,0,.55);
    color: var(--st-text);
    backdrop-filter: blur(10px);
}

.st-modal-header,
.st-modal-body,
.st-modal-footer {
    padding: 16px 18px;
}

.st-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
}

.st-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid rgba(255,255,255,0.12);
}

/* Titles/subtitles used in custom modal markup */
.st-modal-title {
    margin: 0;
    font-weight: 950;
    letter-spacing: .01em;
    color: #fff;
}

.st-modal-subtitle {
    margin-top: 4px;
    color: rgba(234,242,255,0.68);
    font-weight: 750;
    font-size: .92rem;
    line-height: 1.25;
}

.st-modal-close {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.06);
    color: rgba(234,242,255,0.92);
    font-weight: 950;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .12s ease;
}

    .st-modal-close:hover {
        background: rgba(255,255,255,0.14);
        border-color: rgba(56,189,248,0.55);
        transform: translateY(-1px);
    }

/* ----- Bootstrap modal skinning ONLY (prevent fixed-position hijack) ----- */
.modal-content.st-modal {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    width: auto;
    max-height: none;
    overflow: visible;
    z-index: auto;
}

/* Remove Bootstrap “white panel” look inside Solentx modals */
.st-modal .modal-header,
.st-modal .modal-body,
.st-modal .modal-footer {
    background: transparent !important;
    box-shadow: none !important;
}

/* Bootstrap header/footer borders + padding (when using bootstrap markup) */
.st-modal .modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.12) !important;
}

.st-modal .modal-body {
    padding: 18px 20px;
}

.st-modal .modal-footer {
    padding: 14px 20px;
    border-top: 1px solid rgba(255,255,255,0.12) !important;
}

/* Inputs inside modals (custom + bootstrap) */
.st-modal .form-control,
.st-modal .form-select,
.st-modal .st-input,
.st-modal .st-select {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.18);
    color: #fff;
    border-radius: 12px;
    font-weight: 800;
    height: 42px;
}

    .st-modal .form-control::placeholder {
        color: rgba(234,242,255,0.55);
        font-weight: 700;
    }

    .st-modal .form-control:focus,
    .st-modal .form-select:focus {
        border-color: var(--st-blue);
        box-shadow: 0 0 0 4px rgba(56,189,248,0.18);
        background: rgba(255,255,255,0.08);
    }

/* Bootstrap close button: consistent X */
.st-modal .btn-close {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.16);
    background: rgba(255,255,255,0.06);
    color: #fff;
    opacity: 1 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 950;
    cursor: pointer;
    transition: all .12s ease;
    filter: none !important;
    background-image: none !important;
}

    .st-modal .btn-close::before {
        content: "✕";
        font-size: 1rem;
        line-height: 1;
    }

    .st-modal .btn-close:hover {
        background: rgba(255,255,255,0.14);
        border-color: rgba(56,189,248,0.55);
        transform: translateY(-1px);
    }

/* Bootstrap modal animation polish */
.modal.fade .modal-dialog {
    transform: translateY(10px) scale(.98);
    transition: all .15s ease-out;
}

.modal.show .modal-dialog {
    transform: translateY(0) scale(1);
}

/* ===== Form helpers ===== */
.st-label {
    font-size: .82rem;
    font-weight: 800;
    color: rgba(234,242,255,0.78);
    margin-bottom: 6px;
}

.st-help {
    margin-top: 6px;
    font-size: .82rem;
    color: rgba(234,242,255,0.55);
}

.st-divider {
    height: 1px;
    background: rgba(255,255,255,0.10);
    margin: 14px 0;
}

.st-check {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.04);
    border-radius: 14px;
}

/* ===== CSV helper (only shown on CSV tab) ===== */
.st-csvhelp {
    margin-top: 12px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.14);
    background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.03));
    box-shadow: 0 14px 32px rgba(0,0,0,0.22);
}

.st-csvhelp-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.st-csvhelp-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 950;
    letter-spacing: .01em;
    margin: 0;
}

    .st-csvhelp-title .dot {
        width: 34px;
        height: 34px;
        border-radius: 12px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: rgba(56,189,248,0.14);
        border: 1px solid rgba(56,189,248,0.22);
        color: rgba(234,242,255,0.92);
    }

.st-csvhelp-sub {
    margin-top: 6px;
    color: var(--st-muted);
    font-size: .92rem;
    font-weight: 650;
}

.st-csvhelp-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.st-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 900;
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.04);
    color: rgba(234,242,255,0.92);
}

    .st-pill .req {
        padding: 2px 8px;
        border-radius: 999px;
        font-size: .70rem;
        font-weight: 950;
        border: 1px solid rgba(255,255,255,0.16);
        background: rgba(255,255,255,0.06);
        color: rgba(234,242,255,0.85);
    }

    .st-pill.req-ok {
        border-color: rgba(56,189,248,0.28);
        background: rgba(56,189,248,0.10);
    }

    .st-pill.opt-warn {
        border-color: rgba(245,158,11,0.28);
        background: rgba(245,158,11,0.10);
    }

.st-csvhelp-sample {
    margin-top: 12px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(0,0,0,0.20);
    padding: 10px 12px;
}

    .st-csvhelp-sample .label {
        color: rgba(234,242,255,0.70);
        font-size: .78rem;
        font-weight: 900;
        letter-spacing: .08em;
        text-transform: uppercase;
        margin-bottom: 6px;
    }

    .st-csvhelp-sample code {
        display: block;
        font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
        font-size: .86rem;
        color: rgba(234,242,255,0.92);
        white-space: nowrap;
        overflow: auto;
    }

/* ===== POS banner layout helpers ===== */
.pos-banner-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
}

.pos-banner-left {
    min-width: 0;
}

.pos-banner-right {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.pos-banner-action {
    white-space: nowrap;
}

/* ===== Receipt preview ===== */
.receipt-box {
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.12);
    background: radial-gradient(circle at top left, rgba(56,189,248,0.08), transparent 45%), rgba(255,255,255,0.02);
    padding: 16px;
    font-family: ui-monospace, Consolas, monospace;
    font-size: .95rem;
    color: var(--st-text);
}

.receipt-header {
    text-align: center;
    font-weight: 950;
    font-size: 1.05rem;
    letter-spacing: .03em;
    color: #fff;
}

.receipt-sub {
    text-align: center;
    font-size: .85rem;
    font-weight: 700;
    color: var(--st-muted);
}

.receipt-divider {
    border-top: 1px dashed rgba(255,255,255,0.18);
    margin: 12px 0;
}

.receipt-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 2px 0;
}

.receipt-item {
    font-weight: 900;
    color: #fff;
}

.receipt-qty {
    color: var(--st-muted);
    font-weight: 700;
}

.receipt-money {
    font-weight: 950;
    color: #fff;
}

.receipt-total-row {
    display: flex;
    justify-content: space-between;
    font-size: 1.1rem;
    font-weight: 950;
    color: #fff;
}

.receipt-footer {
    text-align: center;
    font-size: .82rem;
    font-weight: 700;
    color: var(--st-muted);
    margin-top: 6px;
}

/* ===== Toast stack ===== */
.toast-stack {
    position: fixed;
    top: 92px;
    right: 16px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(360px, calc(100vw - 32px));
    pointer-events: none;
}

.toast {
    pointer-events: none;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.16);
    background: rgba(10,18,38,0.92);
    box-shadow: 0 18px 40px rgba(0,0,0,0.55);
    padding: 12px 14px;
    color: rgba(234,242,255,0.92);
    backdrop-filter: blur(10px);
    animation: toastIn .14s ease-out;
}

@keyframes toastIn {
    from {
        transform: translateY(-6px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.toast-title {
    font-weight: 950;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast-sub {
    color: rgba(234,242,255,0.68);
    font-weight: 750;
    margin-top: 4px;
    font-size: .92rem;
}

.toast-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.06);
}

    .toast-dot.ok {
        background: rgba(132,204,22,1);
    }

    .toast-dot.bad {
        background: rgba(239,68,68,1);
    }

/* ===== Responsive ===== */
@media (max-width: 575.98px) {
    .st-card {
        padding: 14px;
    }

    .st-csvhelp {
        padding: 12px;
    }

    .st-csvhelp-sample code {
        font-size: .82rem;
    }
}

@media (max-width: 720px) {
    .pos-banner-grid {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .pos-banner-sub {
        white-space: normal;
        text-transform: none;
        letter-spacing: .01em;
        line-height: 1.2;
        margin-top: 6px;
    }

    .pos-banner-right {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        justify-content: stretch;
    }

        .pos-banner-right .ws-pill {
            width: 100%;
            justify-content: space-between;
        }

        .pos-banner-right .pos-banner-action {
            grid-column: 1 / -1;
            width: 100%;
            justify-content: center;
        }

    .pos-banner-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .ws-wrap {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .ws-pill {
        width: 100%;
        border-radius: 14px;
        padding: 10px 12px;
        min-height: auto;
        gap: 6px;
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        background: rgba(10,18,38,0.72);
        border: 1px solid rgba(255,255,255,0.18);
        box-shadow: 0 10px 22px rgba(0,0,0,0.22);
    }

    .ws-label {
        padding-left: 0;
        font-size: .72rem;
        font-weight: 900;
        letter-spacing: .06em;
        text-transform: uppercase;
        color: rgba(234,242,255,0.70);
        line-height: 1.1;
    }

    .ws-value {
        padding-right: 0;
        font-size: 1.0rem;
        font-weight: 950;
        color: #fff;
        line-height: 1.15;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .ws-wrap > button.st-btn {
        width: 100%;
    }
}

@media (max-width: 520px) {
    .st-sticky {
        position: static;
    }
}

@media (max-width: 420px) {
    .pos-banner-right {
        grid-template-columns: 1fr;
    }
}

/* =========================
   Quick Actions (Pro UI)
   ========================= */

.st-actions-panel {
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.04);
    padding: 14px;
}

.st-actions-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

@media (max-width: 991.98px) {
    .st-actions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 575.98px) {
    .st-actions-grid {
        grid-template-columns: 1fr;
    }
}

.st-action-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(0,0,0,0.18);
    transition: all .12s ease;
    text-decoration: none;
}

    .st-action-item:hover {
        background: rgba(56,189,248,0.08);
        border-color: rgba(56,189,248,0.28);
        transform: translateY(-1px);
    }

.st-action-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.16);
    background: rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 950;
    color: rgba(234,242,255,0.9);
    flex: 0 0 auto;
}

.st-action-text {
    min-width: 0;
}

.st-action-title {
    font-weight: 950;
    color: var(--st-text);
    line-height: 1.1;
}

.st-action-sub {
    font-size: .85rem;
    color: var(--st-muted);
    margin-top: 2px;
    font-weight: 650;
}

.st-insight-box {
    border-radius: 14px;
    border: 1px solid var(--st-border);
    background: rgba(255,255,255,0.04);
    padding: 14px;
    height: 100%;
    transition: all .15s ease;
}

    .st-insight-box:hover {
        background: rgba(56,189,248,0.06);
        border-color: rgba(56,189,248,0.25);
    }

.st-insight-title {
    font-weight: 900;
    letter-spacing: .01em;
    color: rgba(234,242,255,0.95);
    font-size: .95rem;
}

.st-insight-value {
    font-size: 1.2rem;
    font-weight: 950;
    margin-top: 6px;
    color: #fff;
}

/* Make selects match Solentx dark/glass even when disabled */
.st-select:disabled,
.form-select.st-select:disabled {
    opacity: 0.72;
    cursor: not-allowed;
    background: rgba(255,255,255,0.05) !important;
    color: rgba(234,242,255,0.82) !important;
    border-color: rgba(255,255,255,0.14) !important;
}

    .st-select:disabled option,
    .form-select.st-select:disabled option {
        color: #0b1220; /* options are rendered by OS; keep readable */
    }