/* ── Base & Reset ── */
html, body {
    font-family: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: #f7f9fc;
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    color: #1f2937;
    font-size: 0.94rem;
    line-height: 1.55;
    overscroll-behavior-y: contain;
}

#app {
    min-height: 100vh;
}

h1:focus {
    outline: none;
}

a {
    text-decoration: none;
}

/* ── Brand selection & highlight ── */
::selection {
    background: rgba(30, 115, 190, 0.18);
    color: inherit;
}

/* ── Reusable utilities ── */
.fill-height {
    height: 100%;
}

.cursor-pointer {
    cursor: pointer;
}

/* ── Card hover-lift for interactive cards ── */
.card-lift {
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.card-lift:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(30, 115, 190, 0.13);
}

.card-lift:active {
    transform: translateY(0);
    box-shadow: none;
}

/* ── Touch-friendly tap targets ── */
.touch-target {
    min-width: 44px;
    min-height: 44px;
}

/* ── Validation styling ── */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #ef4444;
}

.validation-message {
    color: #ef4444;
}

/* ── Focus outlines for accessibility ── */
:focus-visible {
    outline: 2px solid var(--mud-palette-primary, #1e73be);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--mud-palette-primary, #1e73be);
    outline-offset: 2px;
}

/* ── Blazor error UI ── */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

code {
    color: #c02d76;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ── Scrollbar styling ── */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

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

::-webkit-scrollbar-thumb {
    background: rgba(30, 115, 190, 0.22);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(30, 115, 190, 0.38);
}

/* ── MudBlazor global compact overrides ── */
.mud-nav-link {
    min-height: 44px !important;
}

.mud-chip {
    font-weight: 500;
}

/* ── DataGrid row touch-friendly height ── */
.mud-table-body .mud-table-row td {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

/* ── Smooth page-rise animation on navigation ── */
@keyframes page-rise {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-rise {
    animation: page-rise 0.25s ease-out backwards;
}

/* ── Page header consistent styling ── */
.page-header {
    margin-bottom: 0.25rem;
}

/* ── Responsive adjustments ── */
@media (max-width: 959.98px) {
    .mud-table-body .mud-table-row td {
        padding-top: 0.65rem;
        padding-bottom: 0.65rem;
    }

    /* Reset the left-drawer offset — drawer is hidden on mobile via d-none */
    .mud-main-content {
        padding-left: 0 !important;
        margin-left: 0 !important;
    }
}

@media (max-width: 599.98px) {
    .mud-dialog {
        margin: 8px !important;
    }

    .mud-dialog .mud-dialog-content {
        padding: 12px !important;
    }
}

/* ── Tablet-optimized touch (portrait) ── */
@media (min-width: 600px) and (max-width: 1279.98px) {
    .mud-input .mud-input-slot,
    .mud-select .mud-input-slot {
        min-height: 44px;
    }
}

/* ── Dashboard Stat Cards ── */
.stat-card {
    border-left: 4px solid #1e73be;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(22, 52, 79, 0.06);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(30, 115, 190, 0.13);
}

.stat-card-primary { border-left-color: #1e73be; }
.stat-card-success { border-left-color: #3AA676; }
.stat-card-info    { border-left-color: #6EC1E4; }
.stat-card-warning { border-left-color: #F2A93B; }
.stat-card-error   { border-left-color: #D64545; }
.stat-card-dark    { border-left-color: #16344F; }

/* ── KPI Typography ── */
.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    color: #16344F;
}

.kpi-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07rem;
    color: #5E7388;
}

/* ── Dashboard Welcome Banner ── */
.dashboard-banner {
    background: linear-gradient(135deg, #1e73be 0%, #003388 100%);
    border-radius: 12px;
    padding: 1.5rem 2rem;
    color: white;
    position: relative;
    overflow: hidden;
}

.dashboard-banner::after {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    width: 180px;
    height: 180px;
    background: rgba(255,255,255,0.07);
    border-radius: 50%;
    pointer-events: none;
}

.dashboard-banner .banner-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
    margin: 0;
}

.dashboard-banner .banner-sub {
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.82);
    margin: 0;
}

/* ── Section Label ── */
.section-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1rem;
    color: #5E7388;
}

/* ── Progress Bar for Stats ── */
.stat-progress-track {
    height: 5px;
    background: rgba(30, 115, 190, 0.12);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.stat-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
    background: #1e73be;
}

.stat-progress-fill-success { background: #3AA676; }
.stat-progress-fill-info    { background: #6EC1E4; }
.stat-progress-fill-warning { background: #F2A93B; }
.stat-progress-fill-error   { background: #D64545; }

/* ── Card Top Color Band ── */
.card-top-band {
    border-top: 3px solid;
}

.card-top-band-primary { border-top-color: #1e73be; }
.card-top-band-success { border-top-color: #3AA676; }
.card-top-band-info    { border-top-color: #6EC1E4; }
.card-top-band-warning { border-top-color: #F2A93B; }
.card-top-band-error   { border-top-color: #D64545; }
.card-top-band-dark    { border-top-color: #16344F; }

/* ── Filter Section Header Label ── */
.filter-section-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06rem;
    color: #5E7388;
    margin-bottom: 0.5rem;
    display: block;
}

/* ── Avatar Initials (small colored circle in table) ── */
.avatar-initials {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(30, 115, 190, 0.14);
    color: #1e73be;
    font-size: 0.72rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-transform: uppercase;
}

/* ── Colored Nav Icon Pill ── */
.nav-icon-pill {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
}

/* ── Nav card with icon block ── */
.nav-quick-card {
    border-radius: 10px;
    border: 1.5px solid rgba(30, 115, 190, 0.10);
    background: #fff;
    transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
    cursor: pointer;
}

.nav-quick-card:hover {
    border-color: rgba(30, 115, 190, 0.35);
    box-shadow: 0 4px 18px rgba(30, 115, 190, 0.10);
    transform: translateY(-2px);
}

/* ── Responsive adjustments for new components ── */
@media (max-width: 599.98px) {
    .dashboard-banner {
        padding: 1rem 1.25rem;
    }

    .dashboard-banner .banner-title {
        font-size: 1.15rem;
    }

    .kpi-value {
        font-size: 1.6rem;
    }
}

/* ── Accessibility: screen-reader only ── */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* ── KPI trend delta badges ── */
.kpi-delta {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.74rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 999px;
    margin-top: 4px;
}

.kpi-delta-up {
    background: rgba(58, 166, 118, 0.12);
    color: #3AA676;
}

.kpi-delta-down {
    background: rgba(214, 69, 69, 0.12);
    color: #D64545;
}

.kpi-delta-neutral {
    background: rgba(94, 115, 136, 0.12);
    color: #5E7388;
}

/* ── Chart section header ── */
.chart-section-header {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08rem;
    color: #5E7388;
    margin-bottom: 0.25rem;
}

/* ── Empty state container ── */
.empty-state-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    gap: 0.5rem;
    text-align: center;
}

/* ── Stagger animation for stat cards ── */
.stat-card:nth-child(1) { animation-delay: 0s; }
.stat-card:nth-child(2) { animation-delay: 0.05s; }
.stat-card:nth-child(3) { animation-delay: 0.10s; }
.stat-card:nth-child(4) { animation-delay: 0.15s; }

/* ── Mobile Responsiveness (phones < 600px) ── */
@media (max-width: 599.98px) {

    /* Prevent horizontal scroll globally */
    body {
        overflow-x: hidden;
    }
    .mud-main-content,
    .mud-container,
    .mud-card,
    .mud-table-container {
        max-width: 100%;
        overflow-x: hidden;
    }

    /* Typography reduction */
    .mud-typography-h4 {
        font-size: 1.25rem !important;
    }
    .mud-typography-h5 {
        font-size: 1.05rem !important;
    }
    .mud-typography-h6 {
        font-size: 0.95rem !important;
    }
    .mud-typography-body1 {
        font-size: 0.875rem !important;
    }
    .mud-typography-body2 {
        font-size: 0.8rem !important;
    }
    .mud-typography-caption {
        font-size: 0.7rem !important;
    }

    /* ── Home page nav cards: fix icon+text row overflow ── */
    .nav-quick-card .mud-card-content {
        padding: 10px !important;
    }
    /* Shrink avatar so text has room */
    .nav-quick-card .mud-avatar {
        width: 28px !important;
        height: 28px !important;
        min-width: 28px !important;
        flex-shrink: 0;
    }
    .nav-quick-card .mud-avatar .mud-icon-root {
        font-size: 0.95rem !important;
    }
    /* Text wraps instead of overflowing */
    .nav-quick-card .mud-typography-subtitle1 {
        font-size: 0.78rem !important;
        line-height: 1.2;
        word-break: break-word;
        overflow-wrap: break-word;
        min-width: 0;
        flex: 1;
    }
    .nav-quick-card .mud-typography-caption {
        font-size: 0.68rem !important;
        line-height: 1.2;
    }

    /* DataGrid inline selects — remove min-width constraints */
    .mud-table .mud-select,
    .mud-table .mud-input-control {
        min-width: unset !important;
        width: 100%;
    }
    .mud-table td[style*="min-width"] {
        min-width: unset !important;
    }
    /* DataGrid card mode — no horizontal scroll */
    .mud-table-card,
    .mud-table-card .mud-table-container {
        overflow-x: hidden !important;
    }
    /* Remove white-space:nowrap in card mode cells */
    .mud-table .mud-table-cell .mud-text {
        white-space: normal !important;
    }

    /* Page headers — ensure stacking on mobile */
    .page-header-row {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    /* Tab headers — compact for long Greek text */
    .mud-tabs .mud-tab {
        font-size: 0.75rem !important;
        padding: 8px 10px !important;
        min-width: unset !important;
    }

    /* Filter rows — full-width stacking */
    .filter-bar-row {
        flex-direction: column !important;
        gap: 8px !important;
    }

    /* Button groups — full-width on mobile */
    .mud-button-group-root {
        width: 100%;
    }
    .mud-button-group-root .mud-button-root {
        flex: 1;
    }

    /* DataGrid action columns — compact spacing */
    .mud-table-cell .mud-stack[class*="d-flex"] {
        gap: 2px !important;
    }
}
