/* TechService Platform — Global Styles */

html, body {
    font-family: 'Roboto', sans-serif;
    height: 100%;
}

/* ============================================================
   KPI Dashboard Cards
   ============================================================ */
.kpi-card {
    position: relative;
    overflow: hidden;
    border-radius: 12px !important;
    display: flex;
    flex-direction: column;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12) !important;
}

.kpi-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 12px;
    margin: 20px 20px 8px 20px;
}

.kpi-body {
    padding: 4px 20px 20px 20px;
    flex: 1;
}

.kpi-footer {
    height: 4px;
    width: 100%;
    border-radius: 0 0 12px 12px;
}

/* ============================================================
   Login Page
   ============================================================ */
.login-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.login-left {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 50%, #1e3a8a 100%);
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px 48px;
    min-width: 0;
}

.login-right {
    width: 480px;
    min-width: 380px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    padding: 40px;
    box-shadow: -4px 0 24px rgba(0,0,0,0.08);
}

.login-form-wrap {
    width: 100%;
    max-width: 380px;
}

.login-logo {
    width: 64px;
    height: 64px;
    background: rgba(255,255,255,0.2);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    letter-spacing: 1px;
}

.login-brand {
    margin-bottom: 48px;
}

.login-features {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-feature-item {
    display: flex;
    align-items: center;
    gap: 14px;
}

@media (max-width: 768px) {
    .login-left {
        display: none;
    }
    .login-right {
        width: 100%;
        min-width: 0;
    }
}

/* ============================================================
   MudTable enhancements
   ============================================================ */
.mud-table-head .mud-table-cell {
    background-color: #f8fafc !important;
    font-weight: 600 !important;
    font-size: 0.78rem !important;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #6b7280 !important;
}

.row-selected td {
    background-color: #eff6ff !important;
    border-top: 1px solid #bfdbfe !important;
    border-bottom: 1px solid #bfdbfe !important;
}

/* ============================================================
   Google Calendar-style Appointments Calendar
   ============================================================ */

/* Container */
.gcal-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ── Toolbar (two-row layout) ─────────────────────────────── */
.gcal-toolbar {
    display: flex;
    flex-direction: column;
    padding: 10px 16px;
    border-bottom: 1px solid #e0e0e0;
    gap: 8px;
}

/* Row 1: nav + view switcher + new button */
.gcal-toolbar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    flex-wrap: wrap;
}

.gcal-toolbar-left,
.gcal-toolbar-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.gcal-period-title {
    font-size: 1.15rem;
    font-weight: 400;
    color: #3c4043;
    margin-left: 6px;
    white-space: nowrap;
}

/* Row 2: filters */
.gcal-toolbar-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* View switcher */
.gcal-view-switcher {
    display: flex;
    border: 1px solid #dadce0;
    border-radius: 6px;
    overflow: hidden;
}

.gcal-view-switcher button {
    padding: 5px 13px;
    font-size: 0.8rem;
    background: #fff;
    border: none;
    border-right: 1px solid #dadce0;
    cursor: pointer;
    color: #3c4043;
    transition: background 0.15s;
    font-family: inherit;
}

.gcal-view-switcher button:last-child { border-right: none; }
.gcal-view-switcher button:hover      { background: #f1f3f4; }
.gcal-view-switcher button.gcal-vs-active {
    background: #e8f0fe;
    color: #1967d2;
    font-weight: 600;
}


/* ── Technician legend ────────────────────────── */
.gcal-tech-legend {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 16px;
    background: #fafafa;
    border-top: 1px solid #e0e0e0;
    flex-wrap: wrap;
    margin-top: 4px;
}

.gcal-tech-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: #5f6368;
    transition: opacity 0.2s;
}

.gcal-tech-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Loading */
.gcal-loading {
    display: flex;
    justify-content: center;
    padding: 60px;
}

/* Today circle (shared) */
.gcal-today-circle {
    background: #1a73e8 !important;
    color: #fff !important;
    border-radius: 50% !important;
}

/* ── Month View ───────────────────────────────── */
.gcal-month-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid #e0e0e0;
    background: #fafafa;
}

.gcal-month-dayname {
    text-align: center;
    padding: 8px 0;
    font-size: 0.68rem;
    font-weight: 500;
    color: #70757a;
    letter-spacing: 0.5px;
}

.gcal-month-body {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: minmax(110px, 1fr);
}

.gcal-month-cell {
    border-right: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    padding: 4px;
    cursor: pointer;
    transition: background 0.1s;
    min-height: 110px;
}

.gcal-month-cell:nth-child(7n) { border-right: none; }
.gcal-month-cell:hover         { background: #f8f9fa; }
.gcal-month-today              { background: #e8f0fe; }
.gcal-month-other              { background: #fafafa; }
.gcal-month-other .gcal-month-cellnum { color: #bdc1c6; }
.gcal-month-other .gcal-month-appt   { opacity: 0.55; }

.gcal-month-cellnum {
    font-size: 0.78rem;
    font-weight: 500;
    color: #3c4043;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-bottom: 3px;
}

.gcal-month-today .gcal-month-cellnum {
    background: #1a73e8;
    color: #fff;
}

.gcal-month-appt {
    font-size: 0.71rem;
    padding: 2px 5px;
    border-radius: 3px;
    margin-bottom: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    overflow: hidden;
    white-space: nowrap;
    border-left: 3px solid transparent;
    transition: filter 0.1s;
}

.gcal-month-appt:hover { filter: brightness(0.93); }

.gcal-month-appt-time {
    font-weight: 700;
    flex-shrink: 0;
    font-size: 0.67rem;
}

.gcal-month-appt-name {
    overflow: hidden;
    text-overflow: ellipsis;
}

.gcal-month-more {
    font-size: 0.7rem;
    color: #1967d2;
    padding: 1px 5px;
    cursor: pointer;
    border-radius: 3px;
}

.gcal-month-more:hover { background: #e8f0fe; }

/* ── Time Grid (Week / Day) ───────────────────── */
.gcal-timegrid-wrap {
    display: flex;
    flex-direction: column;
}

.gcal-tg-header {
    display: flex;
    border-bottom: 1px solid #e0e0e0;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 10;
}

.gcal-tg-gutter-top {
    width: 56px;
    flex-shrink: 0;
    border-right: 1px solid #e0e0e0;
}

.gcal-tg-hday {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 0;
    border-right: 1px solid #e0e0e0;
    cursor: default;
}

.gcal-tg-hday:last-child { border-right: none; }

.gcal-tg-hdayname {
    font-size: 0.63rem;
    font-weight: 500;
    color: #70757a;
    letter-spacing: 0.5px;
}

.gcal-tg-hdaynum {
    font-size: 1.4rem;
    font-weight: 300;
    color: #3c4043;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.15s;
}

.gcal-tg-hday-today .gcal-tg-hdayname { color: #1a73e8; }
.gcal-tg-hday-today .gcal-tg-hdaynum  { background: #1a73e8; color: #fff; }

/* Scrollable area */
.gcal-tg-scroll {
    max-height: 640px;
    overflow-y: auto;
    position: relative;
}

/* Time gutter */
.gcal-tg-gutter {
    width: 56px;
    flex-shrink: 0;
    border-right: 1px solid #e0e0e0;
    position: relative;
}

.gcal-tg-hour-label {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    font-size: 0.62rem;
    color: #70757a;
    box-sizing: border-box;
}

/* Day column */
.gcal-tg-day {
    flex: 1;
    position: relative;
    border-right: 1px solid #e0e0e0;
    cursor: pointer;
    min-width: 0;
}

.gcal-tg-day:last-child { border-right: none; }
.gcal-tg-today-col      { background: #fafbff; }

/* Hour lines */
.gcal-tg-hline {
    position: absolute;
    left: 0; right: 0;
    border-top: 1px solid #e8eaed;
    pointer-events: none;
}

.gcal-tg-hline-half {
    position: absolute;
    left: 0; right: 0;
    border-top: 1px dashed #f1f3f4;
    pointer-events: none;
}

/* Current time line */
.gcal-now-line {
    position: absolute;
    left: 0; right: 0;
    height: 2px;
    background: #ea4335;
    z-index: 5;
    pointer-events: none;
}

.gcal-now-dot {
    position: absolute;
    left: -5px;
    top: -4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ea4335;
}

/* Appointments in time grid */
.gcal-appt {
    position: absolute;
    border-radius: 4px;
    padding: 3px 6px;
    cursor: pointer;
    overflow: hidden;
    z-index: 4;
    border-left: 3px solid transparent;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    transition: filter 0.12s, box-shadow 0.12s;
    box-sizing: border-box;
}

.gcal-appt:hover {
    filter: brightness(0.93);
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    z-index: 6;
}

.gcal-appt-draggable {
    cursor: grab;
}

.gcal-appt-draggable:active {
    cursor: grabbing;
}

.gcal-appt-title {
    font-size: 0.74rem;
    font-weight: 600;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gcal-appt-time {
    font-size: 0.64rem;
    opacity: 0.85;
    white-space: nowrap;
}

.gcal-appt-sub {
    font-size: 0.62rem;
    opacity: 0.72;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Appointment status colors (month + time grid) */
.appt-pending     { background:#dbeafe; color:#1e40af; border-color:#3b82f6; }
.appt-confirmed   { background:#e0f2fe; color:#0369a1; border-color:#0ea5e9; }
.appt-inprogress  { background:#fef3c7; color:#92400e; border-color:#f59e0b; }
.appt-completed   { background:#dcfce7; color:#14532d; border-color:#22c55e; }
.appt-cancelled   { background:#f1f5f9; color:#94a3b8; border-color:#cbd5e1; }
.appt-rescheduled { background:#f3e8ff; color:#7e22ce; border-color:#a855f7; }

/* ============================================================
   Page Headers
   ============================================================ */
.page-header {
    display: flex;
    align-items: center;
    margin-bottom: 24px;
    gap: 8px;
}

/* ============================================================
   MudNavLink active styles
   ============================================================ */
.mud-nav-link.active {
    background-color: #eff6ff !important;
    color: #1d4ed8 !important;
    font-weight: 600 !important;
}

.mud-nav-link.active .mud-icon-root {
    color: #1d4ed8 !important;
}

/* ============================================================
   Blazor error UI
   ============================================================ */
#blazor-error-ui {
    background: #fff3cd;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    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;
}

/* ============================================================
   Calendar — time-grid horizontal scroll wrapper
   ============================================================ */
.gcal-tg-outer {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* View switcher responsive helpers */
.gcal-vs-mobile  { display: none; }
.gcal-vs-desktop { display: flex; }

/* Drag-and-drop tooltip inside ghost appointment */
.gcal-drag-tip {
    font-size: 0.68rem;
    font-weight: 700;
    background: rgba(0,0,0,0.55);
    color: #fff;
    border-radius: 3px;
    padding: 1px 5px;
    display: inline-block;
    margin-bottom: 2px;
    pointer-events: none;
}

/* ============================================================
   Calendar — Floating action button (FAB) for mobile
   ============================================================ */
.gcal-fab {
    display: none; /* desktop: hidden — use the toolbar button */
}

/* ============================================================
   Desktop/Mobile show-hide helpers (shared pattern)
   ============================================================ */
.cust-desktop-table  { display: block; }
.cust-mobile-grid    { display: none; }

.inv-desktop-table   { display: block; }
.inv-mobile-grid     { display: none; }

.tech-desktop-table  { display: block; }
.tech-mobile-grid    { display: none; }

/* ============================================================
   Responsive — Mobile (≤ 600 px / xs)
   ============================================================ */
@media (max-width: 600px) {

    /* ── Forms: full-width on mobile ── */
    .mud-paper[style*="max-width:860px"] {
        max-width: 100% !important;
    }

    /* ── Calendar toolbar: compact nav row ── */
    .gcal-toolbar {
        padding: 8px 10px;
        gap: 6px;
    }

    .gcal-toolbar-nav {
        gap: 4px;
    }

    .gcal-toolbar-left {
        flex: 1;
        min-width: 0;
        flex-wrap: nowrap;
        overflow: hidden;
    }

    .gcal-period-title {
        font-size: 0.92rem;
        margin-left: 2px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        flex: 1;
    }

    /* ── Calendar filters row: full-width selects stacked ── */
    .gcal-toolbar-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .gcal-toolbar-filters .mud-input-control {
        width: 100% !important;
        min-width: 0 !important;
    }

    /* Switch to dropdown on mobile */
    .gcal-vs-desktop { display: none; }
    .gcal-vs-mobile  { display: block; }

    /* ── Calendar "Νέο ραντεβού" button: hide on mobile (use FAB) ── */
    .gcal-new-btn-desktop { display: none !important; }

    /* ── Calendar FAB: visible on mobile ── */
    .gcal-fab {
        display: flex;
        position: fixed;
        bottom: 22px;
        right: 18px;
        z-index: 1200;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: #1d4ed8;
        color: #fff;
        box-shadow: 0 4px 16px rgba(29,78,216,0.38);
        align-items: center;
        justify-content: center;
        border: none;
        font-size: 1.7rem;
        line-height: 1;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        transition: transform 0.12s, box-shadow 0.12s;
    }

    .gcal-fab:active {
        transform: scale(0.94);
        box-shadow: 0 2px 8px rgba(29,78,216,0.32);
    }

    /* ── Calendar time-grid: Week view needs horizontal scroll ── */
    .gcal-timegrid-wrap {
        min-width: 520px;
    }

    /* Day view: single column — no horizontal scroll needed */
    .gcal-timegrid-wrap.gcal-tg-day-view {
        min-width: 0;
    }

    .gcal-tg-day,
    .gcal-tg-hday {
        min-width: 68px;
    }

    .gcal-tg-day-view .gcal-tg-day,
    .gcal-tg-day-view .gcal-tg-hday {
        min-width: 0;
    }

    /* ── Calendar month: shorter cells, tighter content ── */
    .gcal-month-body {
        grid-auto-rows: minmax(76px, 1fr);
    }

    .gcal-month-cell {
        min-height: 76px;
        padding: 2px;
    }

    .gcal-month-dayname {
        font-size: 0.58rem;
        padding: 5px 0;
    }

    .gcal-month-cellnum {
        width: 22px;
        height: 22px;
        font-size: 0.72rem;
    }

    .gcal-month-appt {
        font-size: 0.65rem;
        padding: 1px 3px;
    }

    .gcal-month-appt-time {
        font-size: 0.62rem;
    }

    .gcal-month-more {
        font-size: 0.65rem;
    }

    /* ── Tech legend: compact ── */
    .gcal-tech-legend {
        gap: 10px;
        padding: 6px 12px;
    }

    .gcal-tech-legend-item {
        font-size: 0.7rem;
    }

    /* ── KPI cards: reduce icon wrap size ── */
    .kpi-icon-wrap {
        width: 48px;
        height: 48px;
        margin: 14px 14px 6px 14px;
    }

    /* ── Page header on mobile ── */
    .page-header {
        margin-bottom: 16px;
    }

    /* ── Customers/Suppliers/Inventory/Technicians: hide table, show cards ── */
    .cust-desktop-table  { display: none; }
    .cust-mobile-grid    { display: block; }

    .inv-desktop-table   { display: none; }
    .inv-mobile-grid     { display: block; }

    .tech-desktop-table  { display: none; }
    .tech-mobile-grid    { display: block; }
}

/* ============================================================
   Customers — Mobile card grid
   ============================================================ */
.cust-card-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cust-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: background 0.1s;
    -webkit-tap-highlight-color: transparent;
}

.cust-card:active { background: #f1f5f9; }

.cust-card-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #3b82f6;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    flex-shrink: 0;
}

.cust-card-info {
    flex: 1;
    min-width: 0;
}

.cust-card-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cust-card-phone {
    font-size: 0.83rem;
    color: #475569;
    margin-top: 2px;
}

.cust-card-company {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================================
   Inventory — Mobile card grid
   ============================================================ */
.inv-card-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.inv-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: background 0.1s;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.inv-card:active { background: #f1f5f9; }

.inv-card-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: #e0f2fe;
    color: #0369a1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    flex-shrink: 0;
}

.inv-card-icon.inv-card-lowstock {
    background: #fee2e2;
    color: #dc2626;
}

.inv-card-info {
    flex: 1;
    min-width: 0;
}

.inv-card-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.inv-card-code {
    font-size: 0.75rem;
    color: #6b7280;
    font-family: monospace;
    margin-top: 1px;
}

.inv-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 3px;
    flex-wrap: wrap;
}

.inv-card-price {
    font-size: 0.82rem;
    font-weight: 600;
    color: #0369a1;
}

.inv-card-stock {
    font-size: 0.78rem;
    color: #64748b;
}

.inv-card-stock.inv-card-stock-low {
    color: #dc2626;
    font-weight: 700;
}

.inv-card-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}

/* ============================================================
   Technicians — Mobile card grid
   ============================================================ */
.tech-card-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tech-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: background 0.1s;
    -webkit-tap-highlight-color: transparent;
}

.tech-card:active { background: #f1f5f9; }

.tech-card-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    flex-shrink: 0;
    color: #fff;
}

.tech-card-info {
    flex: 1;
    min-width: 0;
}

.tech-card-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tech-card-branch {
    font-size: 0.78rem;
    color: #475569;
    margin-top: 2px;
}

.tech-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 3px;
    flex-wrap: wrap;
}

.tech-card-phone {
    font-size: 0.78rem;
    color: #64748b;
}

.tech-card-rate {
    font-size: 0.78rem;
    color: #0369a1;
    font-weight: 600;
}

.tech-card-inactive {
    opacity: 0.5;
}

/* ============================================================
   Responsive — Tablet (601–960 px / sm)
   ============================================================ */
@media (min-width: 601px) and (max-width: 960px) {

    /* Calendar week view scrolls if needed */
    .gcal-timegrid-wrap {
        min-width: 480px;
    }

    .gcal-toolbar-filters .mud-input-control {
        min-width: 160px !important;
    }
}
