/* ═══════════════════════════════════════════════════════════════
   LOGIX.SharedWeb — logix-theme.css
   Shared design theme for all LOGIX Blazor Server applications.

   HOW TO USE:
   1. Include in each project's App.razor:
        <link rel="stylesheet" href="_content/LOGIX.SharedWeb/logix-theme.css" />
   2. Override CSS variables in your project's app.css:
        :root { --logix-accent: #0078d4; }

   VARIABLE REFERENCE:
   --logix-accent          Primary action color (buttons, links, borders)
   --logix-accent-dark     Hover state for accent
   --logix-accent-light    Light tint (card borders, input focus rings)
   --logix-header-bg       Page/card header background
   --logix-thead-bg        Table thead background
   --logix-thead-text      Table thead text color
   --logix-title           Primary heading text color
   --logix-sub             Secondary/label text color
   --logix-page-bg         Page background
   --logix-sidebar-bg      Sidebar background
   --logix-input-border    Default input border color
═══════════════════════════════════════════════════════════════ */

/* ── CSS Variables (GlassOrder defaults) ── */
:root {
    --logix-accent:       #2563eb;
    --logix-accent-dark:  #1d4ed8;
    --logix-accent-light: #93c5fd;
    --logix-header-bg:    #cfe8ff;
    --logix-thead-bg:     #bfdbfe;
    --logix-thead-text:   #1e40af;
    --logix-title:        #1e3a5f;
    --logix-sub:          #2563eb;
    --logix-page-bg:      #f4f6fb;
    --logix-sidebar-bg:   #0f1117;
    --logix-input-border: #93c5fd;
}

/* ── Reset ── */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    background: var(--logix-page-bg);
    color: #111827;
    height: 100%;
}

/* ── Buttons ── */
.btn-primary {
    background: var(--logix-accent);
    color: #fff;
    border: none;
    border-radius: 7px;
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}

    .btn-primary:hover:not(:disabled) {
        background: var(--logix-accent-dark);
    }

    .btn-primary:disabled {
        opacity: .6;
        cursor: not-allowed;
    }

.btn-secondary {
    background: #fff;
    color: #374151;
    border: 1.5px solid #d1d5db;
    border-radius: 7px;
    padding: 9px 18px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s;
}

    .btn-secondary:hover {
        background: #f9fafb;
    }

.btn-danger {
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 7px;
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

    .btn-danger:hover {
        background: #dc2626;
    }

/* Save / Cancel — themed */
.btn-save {
    background: #dbeafe;
    color: #1d4ed8;
    border: 1.5px solid var(--logix-accent-light);
    border-radius: 7px;
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

    .btn-save:hover:not(:disabled) {
        background: var(--logix-thead-bg);
    }

    .btn-save:disabled {
        opacity: .6;
        cursor: not-allowed;
    }

.btn-cancel {
    background: #ffe4e6;
    color: #be123c;
    border: 1.5px solid #fecdd3;
    border-radius: 7px;
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

    .btn-cancel:hover {
        background: #fecdd3;
    }

/* Grid action button */
.btn-action {
    background: none;
    border: none;
    padding: 2px 3px;
    cursor: pointer;
}

    .btn-action:hover { opacity: .8; }

/* ── Page Header ── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--logix-header-bg);
    border-left: 4px solid var(--logix-accent);
    border-radius: 10px;
    padding: 10px 20px;
    margin-bottom: 12px;
}

    .page-header h2 {
        margin: 0;
        font-size: 20px;
        color: var(--logix-title);
        font-weight: 700;
    }

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* ── Search inputs ── */
.search-box,
.ol-search {
    padding: 8px 14px;
    border: 1.5px solid var(--logix-input-border);
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    width: 240px;
    background: #fff;
    color: var(--logix-title);
    transition: border-color 0.15s, box-shadow 0.15s;
}

    .search-box::placeholder,
    .ol-search::placeholder {
        color: var(--logix-accent-light);
    }

    .search-box:focus,
    .ol-search:focus {
        border-color: var(--logix-accent);
        box-shadow: 0 0 0 3px rgba(37,99,235,.15);
    }

/* ── Validation ── */
input.input-error,
select.input-error,
textarea.input-error {
    border: 1.5px solid #E24B4A !important;
    box-shadow: 0 0 0 3px rgba(226,75,74,.15) !important;
    outline: none;
}

.field-error {
    font-size: 12px;
    color: #A32D2D;
    margin-top: 4px;
}

/* ── Toast notifications ── */
.toast-msg {
    position: fixed;
    bottom: 28px;
    right: 28px;
    padding: 13px 22px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0,0,0,.18);
    z-index: 9999;
    animation: logix-slideUp .25s ease;
}

.toast-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.toast-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

kbd {
    display: inline-block;
    padding: 1px 5px;
    font-size: 10px;
    font-family: inherit;
    background: rgba(255,255,255,0.25);
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
    color: #fff;
    line-height: 1.4;
}

@keyframes logix-slideUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Modals ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-box {
    background: #fff;
    border-radius: 12px;
    width: min(680px, 95vw);
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1001;
}

.modal-sm { width: min(420px, 95vw); }

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: var(--logix-header-bg);
    border-bottom: 2px solid var(--logix-accent-light);
    border-radius: 12px 12px 0 0;
    flex-shrink: 0;
}

    .modal-header h3,
    .modal-header h4 {
        margin: 0;
        font-size: 16px;
        color: var(--logix-title);
        font-weight: 700;
    }

.modal-close {
    background: #fee2e2;
    color: #be123c;
    border: 1px solid #fecdd3;
    border-radius: 6px;
    padding: 4px 10px;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    transition: background 0.15s;
}

    .modal-close:hover { background: #fecdd3; }

.modal-body {
    padding: 20px 24px;
}

.modal-footer {
    padding: 14px 24px;
    border-top: 1px solid #e5e7eb;
    background: #f8fafc;
    border-radius: 0 0 12px 12px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

/* ── Form helpers ── */
.form-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.col-span-2 { grid-column: 1 / -1; }

.form-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--logix-title);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 4px;
    display: block;
}

.form-input {
    width: 100%;
    border: 1.5px solid var(--logix-input-border);
    border-radius: 7px;
    padding: 8px 12px;
    font-size: 13px;
    color: #1a1a1a;
    background: #fff;
    outline: none;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

    .form-input:focus {
        border-color: var(--logix-accent);
        box-shadow: 0 0 0 3px rgba(37,99,235,.12);
    }

/* ── Syncfusion Grid overrides ── */
.e-grid .e-headercell {
    background: var(--logix-thead-bg) !important;
    color: var(--logix-thead-text) !important;
}

.e-grid .e-row:hover .e-rowcell {
    background: #f0f4ff !important;
}

.e-grid .e-rowcell,
.e-grid .e-headercell,
.e-grid .e-filterbarcell {
    border-right: 1px solid #d1d5db !important;
    border-bottom: 1px solid #d1d5db !important;
}

.e-grid .e-summaryrow .e-summarycell {
    background: var(--logix-header-bg) !important;
    color: var(--logix-title) !important;
    font-weight: 700 !important;
    border-top: 2px solid var(--logix-accent-light) !important;
}

    /* Forces column widths to be respected — required for ellipsis to work */
    .e-grid .e-table {
        table-layout: fixed !important;
    }

    /* ── Grid: single-row truncate with ellipsis (tooltip via ClipMode on SfGrid) ── */
    .e-grid .e-rowcell {
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        cursor: default;
    }

    .e-grid .e-headercell .e-headercelldiv {
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    /* Compact grid rows — applies to every SfGrid across all LOGIX projects
   since this file is loaded globally via App.razor */
    .e-grid .e-rowcell,
    .e-grid .e-headercell {
        padding-top: 3px !important;
        padding-bottom: 3px !important;
        line-height: 1.05 !important;
        font-size: 12.5px !important;
    }

    .e-grid .e-row input[type="date"],
    .e-grid .e-row input[type="text"] {
        height: 22px;
        font-size: 11px;
        padding: 1px 4px;
    }

/* ── Grid: viewport-fill height ── */
.e-grid {
    height: calc(100vh - 220px) !important;
}

    .e-grid .e-gridcontent {
        overflow-y: auto !important;
    }

/* ── Bill sheet (bottom sheet modal for mobile) ── */
.bill-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.bill-sheet {
    background: #fff;
    border-radius: 16px 16px 0 0;
    width: 100%;
    max-width: 640px;
    max-height: 75vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -4px 24px rgba(0,0,0,.15);
}

.bill-sheet-handle {
    width: 40px;
    height: 4px;
    background: #d1d5db;
    border-radius: 2px;
    margin: 10px auto 0;
    flex-shrink: 0;
}

.bill-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    background: var(--logix-header-bg);
    border-left: 4px solid var(--logix-accent);
    flex-shrink: 0;
}

.bill-sheet-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--logix-title);
}

.bill-sheet-party {
    font-size: 11px;
    color: var(--logix-sub);
    margin-top: 2px;
}

.bill-sheet-body {
    overflow-y: auto;
    flex: 1;
}

.bill-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

    .bill-table thead tr {
        background: var(--logix-thead-bg);
        position: sticky;
        top: 0;
    }

    .bill-table th {
        padding: 8px 12px;
        text-align: left;
        font-size: 11px;
        font-weight: 700;
        color: var(--logix-thead-text);
        text-transform: uppercase;
    }

    .bill-table td {
        padding: 8px 12px;
        border-bottom: 1px solid #f3f4f6;
        color: #374151;
    }

    .bill-table tfoot td {
        border-top: 2px solid var(--logix-thead-bg);
        border-bottom: none;
        background: #f0f9ff;
        padding: 8px 12px;
    }

.bill-total-row td { font-size: 13px; }

.bill-amt  { color: #dc2626; font-weight: 600; }
.days-old  { color: #dc2626; font-weight: 600; }
.days-ok   { color: #16a34a; font-weight: 600; }
.text-right { text-align: right !important; }
.text-center { text-align: center !important; }

.bills-btn {
    background: #fef2f2;
    color: #dc2626;
    border: 1.5px solid #fca5a5;
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

    .bills-btn:hover { background: #fecaca; }

.share-pdf-btn {
    background: #dbeafe;
    color: #1d4ed8;
    border: 1.5px solid var(--logix-accent-light);
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

    .share-pdf-btn:hover { background: var(--logix-thead-bg); }

/* Desktop bill sheet — centered modal instead of bottom sheet */
@media (min-width: 769px) {
    .bill-sheet-overlay {
        align-items: center;
    }

    .bill-sheet {
        border-radius: 12px;
        width: 560px;
        max-height: 80vh;
        box-shadow: 0 20px 60px rgba(0,0,0,.25);
    }

    .bill-sheet-handle { display: none; }
}

/* ── Mobile responsive base ── */
@media (max-width: 768px) {
    .content-area {
        padding: 12px !important;
    }

    .page-header {
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px 14px;
    }

        .page-header .btn-primary {
            width: 100%;
            text-align: center;
        }

    .search-box,
    .ol-search {
        width: 100%;
    }

    .modal-box {
        max-height: 92vh;
    }

    .form-2col {
        grid-template-columns: 1fr;
    }
}
