﻿body {
}


/* ─────────────────────────────────────────────
          LIGHT THEME
 ───────────────────────────────────────────── */
:root {
    --sb-bg: #ffffff;
    --sb-surface: #f5f6fa;
    --sb-border: #e8eaf0;
    --sb-accent: #5b52f0;
    --sb-accent-soft: #eeecfe;
    --sb-accent-glow: rgba(91,82,240,0.12);
    --sb-text: #374151;
    --sb-text-muted: #9ca3af;
    --sb-active-bg: #eeecfe;
    --sb-active-text: #4338ca;
    --sb-hover-bg: #f3f4f8;
    --sb-radius: 9px;
    --sb-width: 256px;
    --sb-font: 'Sora', sans-serif;
    --sb-transition: 0.16s cubic-bezier(.4,0,.2,1);
    --sb-dot: #4b5563;

    /* =========================================
       DATAGRID
    ========================================= */
    --grid-header-bg: linear-gradient( to bottom, #2563eb 0%, #1d4ed8 100% );
    --grid-group-bg: #f3f4f8;
    --grid-hover-bg: rgba(91,82,240,0.05);
    --grid-border: rgba(0,0,0,0.06);
    --grid-text: #374151;
    --grid-header-text: #475569;
    --grid-scrollbar: rgba(100,116,139,.35);
}

/* ─────────────────────────────────────────────
          Dark THEME
  ───────────────────────────────────────────── */
html.dark-theme,
body.dark-theme {
    --sb-bg: #16181d;
    --sb-surface: #1d2128;
    --sb-border: #2a2f38;
    --sb-accent: #8b82ff;
    --sb-accent-soft: rgba(139,130,255,0.12);
    --sb-accent-glow: rgba(139,130,255,0.18);
    --sb-text: #e5e7eb;
    --sb-text-muted: #9ca3af;
    --sb-active-bg: rgba(139,130,255,0.14);
    --sb-active-text: #c7c3ff;
    --sb-hover-bg: #232833;
    --sb-heading: #f3f4f6;
    --sb-dot: #4b5563;
    /* =========================================
       DATAGRID
    ========================================= */

    --grid-header-bg: #20242c;
    --grid-group-bg: #252b35;
    --grid-hover-bg: rgba(139,130,255,.08);
    --grid-border: rgba(255,255,255,.06);
    --grid-text: #e5e7eb;
    --grid-header-text: #cbd5e1;
    --grid-scrollbar: rgba(255,255,255,.18);
}

.mud-page {
    padding: 20px;
    border-radius: 28px;
    background: var(--sb-bg);
    border: 1px solid var(--sb-border);
    box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 16px 40px rgba(15,23,42,0.06);
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    transition: background .2s ease, border-color .2s ease;
}

.dark-theme .mud-page {
    background: var(--sb-bg);
    border: 1px solid var(--sb-border);
}

/* =========================================================
   DATA GRID
========================================================= */

.datagrid {
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--grid-border);
    background: var(--sb-bg);
}
/* =========================================================
   HEADER
========================================================= */

    .datagrid .mud-table-head th {
        background: var(--grid-header-bg) !important;
        color: white !important;
        position: sticky;
        white-space: nowrap;
        box-shadow: inset 0 -1px 0 rgba(255,255,255,.08), 0 2px 4px rgba(0,0,0,.12);
    }
/* =========================================================
   BODY ROWS
========================================================= */

    .datagrid .mud-table-body tr {
        transition: all .18s ease;
    }

        .datagrid .mud-table-body tr:hover {
            background: rgba(59,130,246,.04);
        }

/* =========================================================
   CELLS
========================================================= */

    .datagrid .mud-table-body td {
        color: var(--grid-text);
        border-bottom: 1px solid var(--grid-border);
    }

/* =========================================================
   GROUP ROW
========================================================= */

    .datagrid .mud-datagrid-group {
        background: var(--grid-group-bg);
        font-weight: 700 !important;
    }

   .datagrid .mud-datagrid-group .group-content {
            width: 100%;
        }

/* =========================================================
   STICKY GROUP ROW
========================================================= */

.sticky-group-grid .mud-datagrid-group {
    position: sticky;
    top: 32px;
    z-index: 5;
    background: var(--mud-palette-surface);
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

/* =========================================================
    ALIGNMENT
========================================================= */

.text-end {
    text-align: right;
}

/* Align header cell text */
.align-right {
    text-align: right !important;
}


    .align-right .mud-table-sort-label {
        width: 100%;
        justify-content: flex-end;
    }


    .align-right .column-header {
        justify-content: flex-end;
    }


/* =========================================================
   SCROLLBAR
========================================================= */

.datagrid .mud-table-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.datagrid .mud-table-container::-webkit-scrollbar-thumb {
    background: var(--grid-scrollbar);
}



.datagrid .mud-table-body tr:hover {
    background: var(--grid-hover-bg);
}


.summary-row td{
    font-weight: 800 !important;
    color: var(--mud-palette-primary) !important;
    border-top: 2px solid var(--mud-palette-primary);
}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 960px) {

    .sticky-group-grid tr:has(.mud-datagrid-group) {
        position: sticky;
        top: 0;
        z-index: 20;
        background: var(--mud-palette-surface);
    }

    .sticky-group-grid .mud-datagrid-group {
        background: var(--mud-palette-surface);
    }
    /*
    .datagrid .mud-table-body td {
        padding-top: 8px;
        padding-bottom: 8px;
    }*/
}

/* =========================================================
   LAPTOP & MEDIUM SCREEN OPTIMIZATIONS (Up to 1600px wide)
========================================================= */
@media (max-width: 1600px) {
    /* 1. Reduce overall font sizing inside headers and rows */
    .datagrid .mud-table-head th,
    .datagrid .mud-table-body td,
    .datagrid .mud-datagrid-group td {
        font-size: 0.775rem !important; /* Drops from standard ~14px to a clean, crisp ~12px */
    }

    /* 2. Tighten horizontal and vertical cell spacing padding */
    .datagrid .mud-table-cell {
        padding: 4px 6px !important; /* Shaves off default loose empty spacing margins */
    }

    /* 3. Give the currency header grouping row breathing room without blowing out width */
    .datagrid .mud-datagrid-group .mud-stack {
        font-size: 0.75rem !important;
        gap: 8px !important;
    }
}

/* =========================================================
   TEXT TRUNCATION FUNCTIONALITY
========================================================= */
/* Prevents the ledger text from pushing numeric fields off the laptop screen edge */
.datagrid .truncate-cell {
    max-width: 220px; /* Adjust maximum visual allowance based on preference */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}




.text-center {
    text-align: center;
}

.text-start {
    text-align: left;
}

/* =========================================================
  Loader
========================================================= */
.overlay-container {
    position: relative;
}

/*.loading-overlay {
    position: fixed !important;
    inset: 0 !important;
    z-index: 99999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(255,255,255,.65);
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 32px;
    border-radius: 16px;
    background: rgba(255,255,255,0.9);
    box-shadow: 0 8px 30px rgba(0,0,0,0.08);
}

*/

/* =========================================================
   FILTER CONTAINER
========================================================= */

.filters {
    background: var(--sb-surface);
    padding: 5px 12px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    transition: background .2s ease;
    border-radius:20px;
    margin-bottom:5px;
}

    /* =========================================================
   FILTER INPUTS
========================================================= */

    .filters .mud-input-root {
        font-size: 13px !important;
        color: var(--sb-text) !important;
    }

    /* outlined border */
    .filters .mud-input-outlined .mud-input-outlined-border {
        border-color: var(--sb-border) !important;
        border-radius: 6px !important;
        transition: all .18s ease;
    }

    /* hover */
    .filters .mud-input-outlined:hover .mud-input-outlined-border {
        border-color: var(--sb-accent) !important;
    }

    /* focused */
    .filters .mud-input-outlined.mud-input-focused .mud-input-outlined-border {
        border-color: var(--sb-accent) !important;
        border-width: 1.5px !important;
    }

    /* actual input background */
    .filters .mud-select-input,
    .filters .mud-autocomplete .mud-input-slot,
    .filters .mud-input > input,
    .filters .mud-input-control {
        background: var(--sb-bg) !important;
        color: var(--sb-text) !important;
        border-radius: 6px !important;
    }

    /* labels */
    .filters .mud-input-label {
        color: var(--sb-text-muted) !important;
    }

    /* icons */
    .filters .mud-input-adornment,
    .filters .mud-select-icon {
        color: var(--sb-text-muted) !important;
    }



/* =========================================================
   TOOLBAR
========================================================= */

.ld-toolbar {
    background: var(--sb-bg);
    border: 1px solid var(--sb-border);
    border-radius: 7px;
    /*    padding: 6px 12px;*/
    display: flex;
    align-items: center;
    gap: 2px;
    flex-wrap: wrap;
    min-height: 40px;
    transition: background .2s ease, border-color .2s ease;
}

.ld-toolbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* divider */
.ld-vdiv {
    width: 1px;
    height: 16px;
    background: var(--sb-border);
    margin: 0 8px;
    flex-shrink: 0;
}

/* toolbar label */
.ld-toolbar-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--sb-text-muted);
    margin-right: 4px;
    white-space: nowrap;
}

/* =========================================================
   ACTION BUTTONS
========================================================= */

.ld-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* =========================================================
   CHECKBOX TEXT
========================================================= */

.filters .mud-checkbox-label {
    color: var(--sb-text) !important;
}

/* =========================================================
   LINKS
========================================================= */

.filters .mud-link {
    color: var(--sb-accent) !important;
}
/* =========================================================
   Dialog
========================================================= */

/* ─── Dialog Shell ─────────────────────────────────────────── */
.df-dialog .mud-dialog-title {
    font-size: 17px;
    font-weight: 500;
    letter-spacing: -0.01em;
    padding: 1.25rem 1.5rem 1rem;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    margin-bottom: 0;
}

.df-dialog .mud-dialog-content {
    padding: 1.25rem 1.5rem;
}

.df-dialog .mud-dialog-actions {
    padding: 0;
}

/* ─── Inputs & Selects ──────────────────────────────────────── */
.df-dialog .mud-input-outlined .mud-input-outlined-border {
    border-radius: 8px !important;
}

.df-dialog .mud-input-outlined:focus-within .mud-input-outlined-border {
    border-color: #7F77DD !important;
    box-shadow: 0 0 0 3px rgba(83, 74, 183, 0.10);
}

.df-toggle-row {
    height: 42px;
    padding: 0 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid var(--mud-palette-lines-default);
    background: var(--mud-palette-background-grey);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.03em;
    color: var(--mud-palette-text-secondary);
}

    .df-toggle-row:hover {
        border-color: #7F77DD;
    }


/* ─── Dialog Footer ─────────────────────────────────────────── */
.df-footer {
    width: 100%;
    background: var(--mud-palette-background-grey);
    border-top: 1px solid var(--mud-palette-lines-default);
    padding: 12px 16px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}


/* =========================================================
   Context Menu
========================================================= */

.row-selected td {
    background-color: #c6c1f5 !important;
    color: var(--mud-palette-primary-text) !important;
    font-weight: 500;
}

.context-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
}

.modern-context-menu {
    position: fixed;
    z-index: 9999;
    min-width: 220px;
    padding: 2px;
    border-radius: 14px;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 8px 28px rgba(0,0,0,0.12), 0 2px 6px rgba(0,0,0,0.06);
    animation: ctxFade .12s ease-out;
}

.ctx-item {
    min-height: 38px !important;
    border-radius: 10px;
    margin: 2px 0;
    font-size: 0.92rem;
    font-weight: 500;
    transition: all .15s ease;
}

    .ctx-item:hover {
        background: rgba(25,118,210,0.08);
    }

    .ctx-item .mud-list-item-icon {
        min-width: 34px;
        color: #6b7280;
    }

.delete-item {
    color: #e53935 !important;
}

    .delete-item .mud-list-item-icon {
        color: #e53935 !important;
    }

@keyframes ctxFade {
    from {
        opacity: 0;
        transform: scale(.96);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}


.id-header .column-header {
    justify-content: center !important;
}


.filter-link {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: all .18s ease;
}

.filter-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    position: relative;
    padding: 3px 8px;
    border-radius: 8px;
}

.filter-link:hover .filter-wrapper {
    background: rgba(0,0,0,0.04);
}

.filter-icon {
    font-size: 16px !important;
}

.filter-active {
    color: #f59e0b !important;
    font-weight: 600;
}

.filter-badge {
    min-width: 17px;
    height: 17px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    margin-left: 2px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}

.blue-grid .mud-table-head th {
    background-color: #D6EAF8 !important;
    color: darkblue !important;
    font-weight: 800;
}