/* ============================================================================
   SB Time Tracker -- Liquid Glass Design System
   Apple-inspired translucent surfaces, frosted glass, soft depth
   Built on MudBlazor first principles with targeted CSS overrides
   ============================================================================ */

/* -- Base ----------------------------------------------------------------- */
html, body {
    background: #F2F2F7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.mud-main-content {
    padding: 0;
}

/* -- Glass mixin (reusable via class) ------------------------------------- */
.glass,
.mud-appbar,
.mud-drawer,
.mud-card,
.mud-paper:not(.mud-popover-paper),
.mud-dialog .mud-dialog-content,
.mud-dialog .mud-paper {
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
}

/* -- AppBar --------------------------------------------------------------- */
.mud-appbar {
    background: rgba(251, 251, 253, 0.72) !important;
    color: #1D1D1F !important;
    border-bottom: 0.5px solid rgba(60, 60, 67, 0.12);
    box-shadow: 0 0.5px 0 rgba(0, 0, 0, 0.04) !important;
}

.mud-appbar .mud-icon-button {
    color: #007AFF !important;
}

.mud-appbar .mud-typography {
    color: #1D1D1F !important;
}

/* -- Drawer --------------------------------------------------------------- */
.mud-drawer {
    background: rgba(251, 251, 253, 0.65) !important;
    border-right: 0.5px solid rgba(60, 60, 67, 0.12) !important;
    box-shadow: none !important;
}

.mud-drawer-header {
    background: transparent !important;
    border-bottom: 0.5px solid rgba(60, 60, 67, 0.08);
}

/* -- Cards & Paper -------------------------------------------------------- */
.mud-card,
.mud-paper {
    background: rgba(255, 255, 255, 0.72) !important;
    border: 0.5px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06),
                0 0.5px 0 rgba(255, 255, 255, 0.8) inset !important;
    border-radius: 16px !important;
    overflow: hidden;
}

.mud-card-header {
    padding: 20px 20px 8px 20px;
}

.mud-card-content {
    padding: 8px 20px 20px 20px;
}

/* -- Nav links ------------------------------------------------------------ */
.mud-nav-link {
    border-radius: 10px !important;
    margin: 2px 8px !important;
    padding: 8px 12px !important;
    transition: background 0.2s ease, color 0.2s ease;
}

.mud-nav-link:hover {
    background: rgba(0, 122, 255, 0.08) !important;
}

.mud-nav-link.active {
    background: rgba(0, 122, 255, 0.12) !important;
    color: #007AFF !important;
    font-weight: 600;
}

.mud-nav-link.active .mud-nav-link-icon {
    color: #007AFF !important;
}

.mud-nav-group-text {
    border-radius: 10px !important;
    margin: 2px 8px !important;
    padding: 8px 12px !important;
}

/* -- Buttons -------------------------------------------------------------- */
.mud-button-filled {
    border-radius: 12px !important;
    box-shadow: 0 1px 4px rgba(0, 122, 255, 0.2) !important;
    text-transform: none !important;
    font-weight: 600 !important;
    letter-spacing: 0 !important;
    transition: all 0.2s ease;
}

.mud-button-filled:hover {
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3) !important;
    transform: translateY(-0.5px);
}

.mud-button-filled.mud-button-filled-primary {
    background: linear-gradient(180deg, #3395FF 0%, #007AFF 100%) !important;
}

.mud-button-filled.mud-button-filled-error {
    background: linear-gradient(180deg, #FF5E57 0%, #FF3B30 100%) !important;
    box-shadow: 0 1px 4px rgba(255, 59, 48, 0.2) !important;
}

.mud-button-filled.mud-button-filled-success {
    background: linear-gradient(180deg, #4CD964 0%, #34C759 100%) !important;
    box-shadow: 0 1px 4px rgba(52, 199, 89, 0.2) !important;
}

.mud-button-outlined {
    border-radius: 12px !important;
    border-color: rgba(60, 60, 67, 0.18) !important;
    text-transform: none !important;
    font-weight: 500 !important;
    transition: all 0.2s ease;
}

.mud-button-outlined:hover {
    background: rgba(0, 122, 255, 0.06) !important;
    border-color: rgba(0, 122, 255, 0.3) !important;
}

.mud-button-text {
    border-radius: 10px !important;
    text-transform: none !important;
    font-weight: 500 !important;
}

/* -- Toggle Group --------------------------------------------------------- */
.mud-toggle-group {
    border-radius: 12px !important;
    background: rgba(118, 118, 128, 0.08) !important;
    border: none !important;
    padding: 2px !important;
}

.mud-toggle-item {
    border-radius: 10px !important;
    border: none !important;
    text-transform: none !important;
    font-weight: 500 !important;
    color: #3C3C43 !important;
    transition: all 0.25s ease;
}

.mud-toggle-item .mud-typography,
.mud-toggle-item .mud-toggle-item-content {
    color: inherit !important;
}

.mud-toggle-item.mud-toggle-item-selected,
.mud-toggle-item.mud-selected-item {
    background: #FFFFFF !important;
    color: #007AFF !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08), 0 0.5px 0 rgba(0, 0, 0, 0.04) !important;
    font-weight: 600 !important;
}

.mud-toggle-item.mud-toggle-item-selected .mud-typography,
.mud-toggle-item.mud-selected-item .mud-typography {
    color: #007AFF !important;
}

/* -- Chips ---------------------------------------------------------------- */
.mud-chip {
    border-radius: 20px !important;
    font-weight: 500 !important;
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
}

.mud-chip.mud-chip-outlined {
    background: rgba(255, 255, 255, 0.6) !important;
    border: 0.5px solid rgba(0, 122, 255, 0.3) !important;
    color: #007AFF !important;
}

/* -- Inputs / Selects / Pickers ------------------------------------------- */
.mud-input-outlined .mud-input-outlined-border {
    border-radius: 12px !important;
    border-color: rgba(60, 60, 67, 0.18) !important;
    transition: border-color 0.2s ease;
}

.mud-input-outlined:hover .mud-input-outlined-border {
    border-color: rgba(0, 122, 255, 0.4) !important;
}

.mud-input.mud-input-outlined.mud-input-adorned-end {
    border-radius: 12px;
}

.mud-select .mud-input-outlined .mud-input-outlined-border {
    border-radius: 12px !important;
}

/* -- DataGrid ------------------------------------------------------------- */
.mud-table,
.mud-data-grid {
    border-radius: 16px !important;
    overflow: hidden;
    border: 0.5px solid rgba(60, 60, 67, 0.12);
}

.mud-table-head .mud-table-cell {
    background: rgba(118, 118, 128, 0.04) !important;
    font-weight: 600 !important;
    font-size: 0.8125rem;
    color: #6E6E73;
    border-bottom: 0.5px solid rgba(60, 60, 67, 0.12) !important;
}

.mud-table-body .mud-table-row:hover {
    background: rgba(0, 122, 255, 0.04) !important;
}

.mud-table-cell {
    border-bottom: 0.5px solid rgba(60, 60, 67, 0.08) !important;
}

/* -- Dialogs -------------------------------------------------------------- */
.mud-dialog {
    border-radius: 20px !important;
    overflow: hidden;
}

.mud-dialog .mud-paper {
    border-radius: 20px !important;
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(60px) saturate(200%);
    -webkit-backdrop-filter: blur(60px) saturate(200%);
    border: 0.5px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.12),
                0 8px 24px rgba(0, 0, 0, 0.08) !important;
}

.mud-dialog-title {
    padding: 20px 24px 8px 24px !important;
}

.mud-dialog-content {
    padding: 8px 24px 16px 24px !important;
}

.mud-dialog-actions {
    padding: 8px 24px 20px 24px !important;
}

/* -- Overlay / Backdrop --------------------------------------------------- */
.mud-overlay-dark {
    background: rgba(0, 0, 0, 0.3) !important;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* -- Popover -------------------------------------------------------------- */
.mud-popover-paper {
    border-radius: 14px !important;
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(60px) saturate(200%);
    -webkit-backdrop-filter: blur(60px) saturate(200%);
    border: 0.5px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12),
                0 2px 8px rgba(0, 0, 0, 0.06) !important;
}

/* -- Snackbar ------------------------------------------------------------- */
.mud-snackbar {
    border-radius: 14px !important;
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12) !important;
}

/* -- Progress ------------------------------------------------------------- */
.mud-progress-linear {
    border-radius: 8px !important;
    overflow: hidden;
}

.mud-progress-linear .mud-progress-linear-bar {
    border-radius: 8px;
}

/* -- Menu ----------------------------------------------------------------- */
.mud-menu .mud-list {
    border-radius: 14px !important;
}

.mud-menu-item {
    border-radius: 8px !important;
    margin: 2px 6px !important;
    transition: background 0.15s ease;
}

.mud-menu-item:hover {
    background: rgba(0, 122, 255, 0.08) !important;
}

/* -- Checkbox ------------------------------------------------------------- */
.mud-checkbox .mud-icon-root {
    border-radius: 6px;
}

/* -- Alert ---------------------------------------------------------------- */
.mud-alert {
    border-radius: 12px !important;
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
}

/* -- Dividers ------------------------------------------------------------- */
.mud-divider {
    border-color: rgba(60, 60, 67, 0.12) !important;
}

/* -- Badge ---------------------------------------------------------------- */
.mud-badge-content {
    font-weight: 600 !important;
    font-size: 0.7rem !important;
}

/* -- DropZone (calendar columns) ------------------------------------------ */
.mud-drop-zone-calendar {
    border-radius: 14px !important;
    background: rgba(255, 255, 255, 0.45) !important;
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border: 0.5px solid rgba(255, 255, 255, 0.5);
    transition: background 0.2s ease;
}

.mud-drop-zone-calendar:hover {
    background: rgba(255, 255, 255, 0.6) !important;
}

/* -- Timer bar ------------------------------------------------------------ */
.timer-bar {
    background: rgba(251, 251, 253, 0.8);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border-top: 0.5px solid rgba(60, 60, 67, 0.12);
    border-bottom: 0.5px solid rgba(60, 60, 67, 0.12);
}

/* -- Scrollbar (WebKit) --------------------------------------------------- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* -- Timesheet segment bar (multi-segment partial submissions) ------------- */
.ts-segment-bar {
    display: inline-flex;
    height: 26px;
    border-radius: 13px;
    overflow: hidden;
    gap: 2px;
    min-width: 200px;
    align-items: stretch;
}

.ts-seg {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    padding: 0 8px;
    color: white;
    white-space: nowrap;
    cursor: default;
}

.ts-seg-open      { background: var(--mud-palette-grey-default, #6b6b6b); color: #f5f5f5; }
.ts-seg-submitted { background: var(--mud-palette-info, #2196F3); }
.ts-seg-approved  { background: var(--mud-palette-success, #4CAF50); }
.ts-seg-rejected  { background: var(--mud-palette-warning, #FF9800); }

/* -- Liquid glass time entry cards ---------------------------------------- */
.glass-entry-card {
    border: 0.5px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    padding: 8px 10px;
    margin-bottom: 4px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.glass-entry-card .mud-typography {
    color: white !important;
}

.glass-entry-card:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14);
}

.glass-entry-card--selected,
.timeline-entry--selected {
    outline: 2px solid #007AFF;
    outline-offset: 1px;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.18);
}

.day-entry-row--selected {
    background: rgba(0, 122, 255, 0.10);
}

/* -- Lock badge ----------------------------------------------------------- */
/* Universal-contrast wrapper for lock icons that sit on project-colored
   entry cards (Week glass-card, Day timeline). The white circle lifts the
   category-colored icon off any background; subtle shadow gives depth.
   Pair with EntryLockVisuals.IconFor / ColorHexFor for the icon inside.
   Use the --sm variant inline within tight rows like the Month pill.
   Not needed on flat surfaces (day-list row, dialog title) — those use
   the icon directly without the badge. */
.entry-lock-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
}
.entry-lock-badge .mud-icon-root {
    font-size: 12px !important;
}

.entry-lock-badge--sm {
    position: relative;
    top: auto;
    right: auto;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.20);
}
.entry-lock-badge--sm .mud-icon-root {
    font-size: 9px !important;
}

/* -- Day column header (today highlight) ---------------------------------- */
.day-header {
    border-radius: 12px;
    padding: 6px 4px;
    text-align: center;
    margin-bottom: 8px;
    transition: background 0.2s ease;
}

.day-header--today {
    background: linear-gradient(180deg, #3395FF 0%, #007AFF 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.25);
}

.day-header--today .mud-typography {
    color: white !important;
}

/* -- Month cell ----------------------------------------------------------- */
.month-cell {
    min-height: 100px;
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(12px) saturate(140%);
    -webkit-backdrop-filter: blur(12px) saturate(140%);
    border-radius: 14px;
    border: 0.5px solid rgba(255, 255, 255, 0.5);
    padding: 8px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
}

.month-cell:hover {
    background: rgba(255, 255, 255, 0.75);
    transform: translateY(-1px);
}

.month-cell--outside {
    opacity: 0.45;
}

.month-cell--today-badge {
    background: linear-gradient(180deg, #3395FF 0%, #007AFF 100%);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8125rem;
    box-shadow: 0 1px 4px rgba(0, 122, 255, 0.3);
}

/* -- Month entry pill ----------------------------------------------------- */
.month-entry-pill {
    border-radius: 6px;
    padding: 2px 6px;
    margin-bottom: 2px;
    font-size: 0.7rem;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: white !important;
    font-weight: 500;
    border: 0.5px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    transition: transform 0.1s ease, filter 0.1s ease;
}

.month-entry-pill:hover {
    transform: scale(1.02);
}

/* -- Timeline slot -------------------------------------------------------- */
.timeline-slot {
    display: flex;
    min-height: 52px;
    border-bottom: 0.5px solid rgba(60, 60, 67, 0.08);
    cursor: pointer;
    transition: background 0.15s ease;
}

.timeline-slot:hover {
    background: rgba(0, 122, 255, 0.03);
}

.timeline-slot-label {
    width: 56px;
    color: #AEAEB2;
    font-size: 0.75rem;
    font-weight: 500;
    padding-top: 6px;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.timeline-entry {
    border-radius: 10px;
    padding: 6px 10px;
    min-width: 120px;
    flex: 1;
    cursor: pointer;
    color: white;
    border: 0.5px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.timeline-entry .mud-typography,
.timeline-entry * {
    color: white;
}

.timeline-entry:hover {
    transform: translateY(-1px) scale(1.005);
    filter: brightness(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.14);
}

/* -- Day view sidebar entry rows ------------------------------------------ */
.day-entry-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 4px;
    border-bottom: 0.5px solid rgba(60, 60, 67, 0.08);
    cursor: pointer;
    border-radius: 10px;
    transition: background 0.15s ease;
}

.day-entry-row:hover {
    background: rgba(0, 122, 255, 0.04);
}

.day-entry-dot {
    width: 4px;
    height: 36px;
    border-radius: 2px;
    flex-shrink: 0;
}

/* -- Logged-time box in dialog -------------------------------------------- */
.logged-time-box {
    background: rgba(118, 118, 128, 0.06);
    border: 0.5px solid rgba(60, 60, 67, 0.08);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 12px;
}

/* -- Week grid container -------------------------------------------------- */
.week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    overflow-x: auto;
    min-width: 700px;
}

/* -- Month grid container ------------------------------------------------- */
.month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

/* -- Toolbar -------------------------------------------------------------- */
.glass-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 0.5px solid rgba(255, 255, 255, 0.6);
    border-radius: 18px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

/* /my-dashboard — mobile layout adjustments */
.dash-quick-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

@media (min-width: 600px) {
    .dash-quick-row { flex-direction: row; }
}

/* Pull Quick Entry + Recent Entries up after the Capacity Ring on mobile so the
   primary action ("log time") sits above the analytics cards. */
@media (max-width: 959.98px) {
    .dash-cap    { order: -30; }
    .dash-quick  { order: -20; }
    .dash-recent { order: -10; }

    /* Tighten card content min-heights so the page is shorter on phones. */
    .dash-card-tight .mud-card-content {
        min-height: 0 !important;
        padding-top: 12px;
        padding-bottom: 12px;
    }

    /* Stack page-header controls below the title rather than wrapping awkwardly. */
    .dash-header { flex-direction: column; align-items: flex-start; }
}

/* /dashboard (manager) — mobile adjustments */
@media (max-width: 599.98px) {
    /* Make section labels (Cash / Profitability / Utilization) actually visible
       on mobile — overline-tiny text gets lost between full-width cards. */
    .manager-dashboard > .mud-typography-overline {
        font-size: 0.875rem;
        font-weight: 600;
        letter-spacing: 0.04em;
        color: var(--mud-palette-text-primary);
        margin-top: 8px;
    }

    /* Tighten KPI card padding on phones — pa-4 (32px) is generous for desktop. */
    .manager-dashboard .mud-paper.pa-4 {
        padding: 16px !important;
    }

    /* KPI numbers default to h4 (~34px) which is huge when one card = full width.
       Step it down so the card breathes. */
    .manager-dashboard .mud-paper .mud-typography-h4 {
        font-size: 1.5rem;
        line-height: 1.2;
    }

    /* Reduce row spacing — mb-4 (32px) → 16px between sections on mobile. */
    .manager-dashboard .mud-grid.mb-4 {
        margin-bottom: 16px !important;
    }
}

/* /time — mobile is locked to Day view; hide desktop-only chrome. */
@media (max-width: 959.98px) {
    .my-time-desktop-only { display: none !important; }

    /* Tighten the glass toolbar on mobile and let it wrap cleanly. */
    .my-time-toolbar {
        padding: 8px 10px;
        gap: 6px;
    }
    .my-time-toolbar > .mud-button,
    .my-time-toolbar > .mud-icon-button {
        flex: 0 0 auto;
    }
}
