/* ============================================================
   WORK ORDERS PRO STYLES
   ------------------------------------------------------------
   Loaded AFTER style.css and workorders.css so it can extend
   and override cleanly.

   PURPOSE:
     The work orders page previously reused generic styling.
     This stylesheet gives it the same professional polish as
     the maintenance page and the dashboard landing page.

   CONTAINS:
     1. Page hero strip (title + actions + filter chips + KPIs)
     2. Refined filter chip group
     3. Table refinements (sticky header, hover, spacing)
     4. Statistics card upgrade (matches dashboard & maintenance)
     5. Modal consistency tweaks

   IMPORTANT:
     Every selector here is scoped to classes that already exist
     in workorders.html — we never change IDs, we never touch
     onclick handlers, and we never modify the work order JS.
   ============================================================ */

/* ============================================================
   1) PAGE HERO STRIP
   ------------------------------------------------------------
   Replaces the plain <h1> + <p> + row of 6 buttons with a
   dashboard-style header:
     • Left  : eyebrow, title, subtitle, primary CTA, filter chips
     • Right : four KPI chips (Total / New / In Progress / Overdue)
   ============================================================ */
.workorders-hero {
    position: relative;
    background: linear-gradient(135deg, #1e3a5f 0%, #152b47 60%, #2a4d7a 100%);
    color: #ffffff;
    border-radius: 14px;
    padding: 24px 28px;
    margin-bottom: 24px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(30, 58, 95, 0.22);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

/* Same diagonal light streak as the maintenance hero */
.workorders-hero::before {
    content: "";
    position: absolute;
    top: -50%;
    right: -10%;
    width: 55%;
    height: 200%;
    background: linear-gradient(
        120deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(240, 176, 93, 0.10) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(15deg);
    pointer-events: none;
}

.workorders-hero-text {
    position: relative;
    z-index: 1;
    min-width: 280px;
    flex: 1;
}

.workorders-hero-eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #f0b05d;
    margin-bottom: 6px;
}

.workorders-hero-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 6px 0;
    color: #ffffff;
    letter-spacing: -0.2px;
}

.workorders-hero-subtitle {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.75);
    margin: 0;
}

/* ---- Action buttons row inside the hero ---- */
.workorders-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    position: relative;
    z-index: 1;
    align-items: center;
}

/* Primary CTA: amber gradient — same as maintenance page */
.wo-hero-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: linear-gradient(135deg, #f0b05d 0%, #e09d3e 100%);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.2px;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(240, 176, 93, 0.35);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.wo-hero-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(240, 176, 93, 0.5);
}

.wo-hero-btn-primary:active {
    transform: translateY(0);
}

/* Ghost filter chip: compact, subtle, readable on dark hero */
.wo-hero-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.wo-hero-chip:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
}

/* Active filter chip — highlighted with amber */
.wo-hero-chip.active {
    background: linear-gradient(135deg, #f0b05d 0%, #e09d3e 100%);
    border-color: transparent;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(240, 176, 93, 0.4);
}

/* Small divider between filter chips and other actions */
.wo-hero-divider {
    width: 1px;
    height: 22px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 4px;
    align-self: center;
}

/* ---- KPI chips on the right side of the hero ---- */
.workorders-hero-kpis {
    display: flex;
    gap: 12px;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.wo-kpi {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 12px 16px;
    min-width: 90px;
    text-align: center;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.wo-kpi-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 4px;
}

.wo-kpi-value {
    font-size: 22px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1;
}

.wo-kpi-value.kpi-new        { color: #8fc8ff; }   /* soft blue */
.wo-kpi-value.kpi-inprogress { color: #f0b05d; }   /* amber */
.wo-kpi-value.kpi-overdue    { color: #ff8a75; }   /* coral */
.wo-kpi-value.kpi-completed  { color: #86e29b; }   /* green */

/* ============================================================
   2) WORK ORDERS TABLE POLISH
   ------------------------------------------------------------
   Same treatment as the maintenance table:
     • Rounded container card
     • Sticky header that stays visible on scroll
     • Softer row hover
     • Better vertical rhythm
   ============================================================ */
.workorders-table-card {
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid #eef1f3;
    background: #ffffff;
    padding: 22px;
    margin-bottom: 24px;
}

.workorders-table-card h2 {
    font-size: 17px;
    font-weight: 700;
    color: #244855;
    margin: 0 0 18px 0;
    padding-bottom: 14px;
    border-bottom: 1px solid #eef1f3;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Sticky header on the work orders table */
.workorders-table-card .data-table thead th {
    position: sticky;
    top: 0;
    background: #f8f9fa;
    color: #495057;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 12px 14px;
    border-bottom: 2px solid #eef1f3;
    z-index: 2;
    text-align: left;
}

.workorders-table-card .data-table tbody td {
    padding: 14px;
    font-size: 13px;
    color: #343a40;
    border-bottom: 1px solid #f1f3f5;
    vertical-align: middle;
}

.workorders-table-card .data-table tbody tr {
    transition: background 0.15s ease;
}

.workorders-table-card .data-table tbody tr:hover {
    background: #f8fafb;
}

/* Order ID — read as a code tag */
.workorders-table-card .data-table tbody td:first-child {
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 12px;
    color: #244855;
    font-weight: 600;
    letter-spacing: 0.2px;
}

/* Actions cell stays centered */
.workorders-table-card .data-table td:last-child {
    text-align: center;
}

/* ============================================================
   3) STATISTICS CARDS UPGRADE
   ------------------------------------------------------------
   The bottom stats-grid for work orders gets the same
   dashboard-style treatment as maintenance.
   ============================================================ */
.wo-stats-card {
    background: transparent;
    box-shadow: none;
    border: none;
    padding: 0;
    margin-bottom: 24px;
}

.wo-stats-card > h2 {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: #244855;
    margin: 0 0 14px 0;
    padding: 0 4px;
}

.wo-stats-card .stats-grid .stat-card {
    position: relative;
    border-left: none;                  /* remove old red bar */
    border-radius: 12px;
    padding: 20px 22px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid #eef1f3;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
    background: #ffffff;
}

.wo-stats-card .stats-grid .stat-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #244855;                /* default */
}

/* Color-code each card */
.wo-stats-card .stats-grid .stat-card:nth-child(1)::before { background: #90AEAD; } /* Total */
.wo-stats-card .stats-grid .stat-card:nth-child(2)::before { background: #1976d2; } /* New */
.wo-stats-card .stats-grid .stat-card:nth-child(3)::before { background: #f0b05d; } /* In Progress */
.wo-stats-card .stats-grid .stat-card:nth-child(4)::before { background: #28a745; } /* Completed */

.wo-stats-card .stats-grid .stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(36, 72, 85, 0.10);
}

.wo-stats-card .stats-grid .stat-card h3 {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #6c757d;
    margin-bottom: 10px;
}

.wo-stats-card .stats-grid .stat-card .stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #1a3640;
    line-height: 1;
    margin-bottom: 6px;
}

.wo-stats-card .stats-grid .stat-card .stat-change {
    font-size: 12px;
    color: #6c757d;
}

/* ============================================================
   4) MODAL CONSISTENCY
   ------------------------------------------------------------
   Slight polish on the create-work-order modal so its header
   separator matches the rest of the app.
   ============================================================ */
.work-order-modal .modal-header {
    border-bottom-color: #eef1f3;      /* softer, was #f0b05d */
    background: #ffffff;
}

.work-order-modal .modal-header h2 {
    color: #244855;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.1px;
}

.work-order-modal .form-section-title {
    color: #244855;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    padding-bottom: 12px;
    border-bottom: 1px solid #eef1f3;  /* softer than amber line */
    margin-bottom: 18px;
}

.work-order-modal .modal-footer {
    background: #ffffff;
    border-top: 1px solid #eef1f3;
}

/* ============================================================
   5) RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    .workorders-hero {
        flex-direction: column;
        align-items: flex-start;
        padding: 22px 20px;
    }

    .workorders-hero-kpis {
        width: 100%;
    }

    .wo-kpi {
        flex: 1;
        min-width: 0;
        padding: 10px 12px;
    }

    .wo-kpi-value {
        font-size: 18px;
    }
}

@media (max-width: 600px) {
    .workorders-hero-title {
        font-size: 20px;
    }

    .workorders-hero-actions {
        width: 100%;
    }

    .wo-hero-btn-primary {
        flex: 1 1 100%;
        justify-content: center;
    }

    .wo-hero-chip {
        flex: 0 0 auto;
        padding: 8px 12px;
        font-size: 11px;
    }

    .wo-hero-divider {
        display: none;
    }

    .workorders-hero-kpis {
        flex-wrap: wrap;
    }

    .wo-kpi {
        flex: 1 1 calc(50% - 6px);
    }
}