/* ============================================================
   DASHBOARD PRO STYLES
   ------------------------------------------------------------
   Professional styling for the main landing page (index.html).
   Loaded AFTER style.css so it can override/extend cleanly.
   ============================================================ */

/* ---------- Hero Welcome Banner ---------- */
/* ============================================================
   COLOUR UPDATE (was dark teal, now slate blue).
   ------------------------------------------------------------
   The original hero used the brand's primary teal
   (#244855 → #1a3640 → #2d5a68), which duplicated the sidebar
   and header colours and made the whole page feel monochrome.

   We now use a slate/navy blue palette instead. It is still
   professional and corporate, but it separates the hero from
   the header visually — giving the landing page a clearer
   hierarchy: header (brand) → hero (welcome) → content (cards).

   Palette:
     left   #1e3a5f  deep slate blue
     middle #152b47  darker slate (60% mark)
     right  #2a4d7a  slate blue highlight

   The amber accent pill (#f0b05d) and green status dot
   (#28a745) both read well against this darker background,
   so no changes were needed to those elements.
   ============================================================ */
.hero-banner {
    position: relative;
    background: linear-gradient(135deg, #1e3a5f 0%, #152b47 60%, #2a4d7a 100%);
    color: #ffffff;
    padding: 32px 40px;
    border-radius: 14px;
    margin-bottom: 28px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(30, 58, 95, 0.30);
}

/* Subtle diagonal light streak across the hero */
.hero-banner::before {
    content: "";
    position: absolute;
    top: -50%;
    right: -10%;
    width: 60%;
    height: 200%;
    background: linear-gradient(
        120deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(240, 176, 93, 0.12) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(15deg);
    pointer-events: none;
}

.hero-greeting {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #f0b05d;
    margin-bottom: 6px;
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 8px 0;
    position: relative;
    z-index: 1;
    color: #ffffff;
}

.hero-subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.75);
    margin: 0;
    position: relative;
    z-index: 1;
}

/* Live system status pill inside the hero */
.hero-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(40, 167, 69, 0.5);
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: #b8e6c1;
    margin-top: 16px;
    position: relative;
    z-index: 1;
}

.hero-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #28a745;
    box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%   { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7); }
    70%  { box-shadow: 0 0 0 10px rgba(40, 167, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); }
}

/* ---------- Quick Actions Row ---------- */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 28px;
}

.quick-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    color: #244855;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.quick-action-btn:hover {
    border-color: #f0b05d;
    background: #fffdf7;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(240, 176, 93, 0.2);
    color: #1a3640;
}

.quick-action-btn .qa-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #244855;
}

.quick-action-btn .qa-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
}

/* ---------- Enhanced Stat Cards ---------- */
.stats-grid.pro-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.pro-stat-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px 22px;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid #eef1f3;
    transition: all 0.2s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pro-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(36, 72, 85, 0.10);
    border-color: #f0b05d;
}

/* Colored left accent bar */
.pro-stat-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #244855;
}

.pro-stat-card.accent-orange::before { background: #f0b05d; }
.pro-stat-card.accent-green::before  { background: #28a745; }
.pro-stat-card.accent-coral::before  { background: #E64833; }
.pro-stat-card.accent-blue::before   { background: #90AEAD; }

.pro-stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 4px;
}

.pro-stat-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #6c757d;
    margin: 0;
}

.pro-stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(36, 72, 85, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #244855;
    flex-shrink: 0;
}

.pro-stat-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.pro-stat-card.accent-orange .pro-stat-icon { background: rgba(240, 176, 93, 0.15); color: #b8781e; }
.pro-stat-card.accent-green  .pro-stat-icon { background: rgba(40, 167, 69, 0.12);  color: #1c7c34; }
.pro-stat-card.accent-coral  .pro-stat-icon { background: rgba(230, 72, 51, 0.12);  color: #b9372a; }
.pro-stat-card.accent-blue   .pro-stat-icon { background: rgba(144, 174, 173, 0.20); color: #244855; }

.pro-stat-value {
    font-size: 30px;
    font-weight: 700;
    color: #1a3640;
    line-height: 1.1;
    margin: 2px 0;
}

.pro-stat-change {
    font-size: 12px;
    color: #6c757d;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pro-stat-change .trend-up   { color: #1c7c34; font-weight: 600; }
.pro-stat-change .trend-down { color: #b9372a; font-weight: 600; }

/* ---------- Enhanced Dashboard View Button ---------- */
.dashboard-view-wrapper {
    margin-bottom: 24px;
}

.dashboard-view-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 14px 26px;
    background: linear-gradient(135deg, #f0b05d 0%, #e09d3e 100%);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.3px;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(240, 176, 93, 0.35);
    transition: all 0.2s ease;
    position: relative;
}

.dashboard-view-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 26px rgba(240, 176, 93, 0.5);
}

.dashboard-view-btn:active {
    transform: translateY(0);
}

/* Soft pulse ring so the button draws the eye */
.dashboard-view-btn::after {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: 12px;
    border: 2px solid rgba(240, 176, 93, 0.5);
    animation: pulse-ring 2.5s infinite;
    pointer-events: none;
}

@keyframes pulse-ring {
    0%   { opacity: 0.8; transform: scale(1); }
    70%  { opacity: 0;   transform: scale(1.06); }
    100% { opacity: 0;   transform: scale(1.06); }
}

.dashboard-view-btn svg {
    stroke: currentColor;
    flex-shrink: 0;
}

/* ---------- Recent Activity Section ---------- */
.activity-section {
    background: #ffffff;
    border-radius: 12px;
    padding: 22px 24px;
    margin-bottom: 28px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid #eef1f3;
}

.activity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid #eef1f3;
}

.activity-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: #244855;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.activity-header h3 .icon-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f0b05d;
}

.activity-header a {
    font-size: 13px;
    font-weight: 600;
    color: #244855;
    text-decoration: none;
    transition: color 0.2s;
}

.activity-header a:hover {
    color: #f0b05d;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 300px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 10px;
    border-radius: 8px;
    transition: background 0.15s ease;
}

.activity-item:hover {
    background: #f8f9fa;
}

.activity-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(36, 72, 85, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #244855;
    flex-shrink: 0;
}

.activity-item-icon.type-maintenance { background: rgba(240, 176, 93, 0.18); color: #b8781e; }
.activity-item-icon.type-workorder   { background: rgba(230, 72, 51, 0.12);  color: #b9372a; }
.activity-item-icon.type-asset       { background: rgba(144, 174, 173, 0.22); color: #244855; }

.activity-item-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.activity-item-body {
    flex: 1;
    min-width: 0;
}

.activity-item-title {
    font-size: 14px;
    font-weight: 600;
    color: #1a3640;
    margin: 0 0 2px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-item-meta {
    font-size: 12px;
    color: #6c757d;
    margin: 0;
}

.activity-empty {
    text-align: center;
    padding: 30px 20px;
    color: #adb5bd;
    font-size: 13px;
    font-style: italic;
}

/* ---------- Two-Column Layout on Wide Screens ---------- */
@media (min-width: 1100px) {
    .dashboard-main-grid {
        display: grid;
        grid-template-columns: 2fr 1fr;
        gap: 24px;
        align-items: start;
    }
}

/* ---------- Mobile Responsive ---------- */
@media (max-width: 768px) {
    .hero-banner {
        padding: 22px 20px;
    }
    .hero-title {
        font-size: 20px;
    }
    .hero-subtitle {
        font-size: 13px;
    }
    .pro-stat-value {
        font-size: 24px;
    }
    .quick-action-btn {
        flex: 1 1 calc(50% - 6px);
        justify-content: center;
        padding: 12px 14px;
        font-size: 13px;
    }
    .activity-section {
        padding: 18px 16px;
    }
}

/* ============================================================
   FIX: Chart Container Heights (v2 — no !important on canvas)
   ------------------------------------------------------------
   WHY THIS WAS CHANGED FROM v1:
     The first version of this block forced the <canvas> to
     `width: 100% !important; height: 100% !important`.
     Chart.js already manages the canvas dimensions internally
     by writing inline width/height attributes to match the
     parent's pixel size. Our `!important` rules were overriding
     that, so the browser had to SCALE the canvas bitmap to fit —
     which is what made the charts look blurry and stretched.

   THE CORRECT APPROACH:
     1. Give the chart CARD a fixed pixel height (not min-height),
        so the layout is stable regardless of content.
     2. Insert a `.chart-canvas-wrapper` div between the card and
        the canvas. Chart.js measures its DIRECT PARENT to decide
        how big to draw the bitmap, and the wrapper is a clean,
        correctly-sized box (no padding, no title above it).
     3. Let Chart.js own the canvas — no width/height overrides.

   This keeps the charts crisp at any zoom level and any window
   size, and eliminates the stretch/blur artifact.

   ⚠️  The HTML must wrap each <canvas> in:
         <div class="chart-canvas-wrapper"> ... </div>
   See index.html for the updated markup.
   ============================================================ */

/* ----- Charts grid: one column by default, three across on wide screens ----- */
.charts-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    margin-top: 8px;
}

@media (min-width: 900px) {
    .charts-section {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ----- Chart card: fixed height so Chart.js has a stable target ----- */
.chart-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 18px 18px 12px 18px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid #eef1f3;

    /* flex column so the title takes its natural size and the
       wrapper below fills the rest */
    display: flex;
    flex-direction: column;

    /* ✅ FIXED height (was min-height). The card no longer grows
       or shrinks with its content, so Chart.js always has the
       exact same pixel box to draw into. */
    height: 300px;
}

/* ----- Card title: fixed height so it never squeezes the chart ----- */
.chart-title {
    font-size: 14px;
    font-weight: 700;
    color: #244855;
    margin: 0 0 12px 0;
    letter-spacing: 0.3px;
    flex-shrink: 0;   /* never let flex compress the title */
}

/* ----- NEW: canvas wrapper -----
   This div sits between `.chart-card` and `<canvas>`.
   Chart.js reads the wrapper's pixel dimensions to size the
   bitmap — that is what keeps the render crisp.

   `position: relative` is required so Chart.js can absolutely
   position its internal resize observer.

   `min-height: 0` is a flexbox quirk fix: without it, the
   wrapper refuses to shrink below its content's natural size
   and pushes the card taller than 300px. */
.chart-canvas-wrapper {
    position: relative;
    flex: 1;
    min-height: 0;
    width: 100%;
}

/* ----- Canvas: let Chart.js manage sizing -----
   We only set `display: block` to remove inline-element
   whitespace. No width/height, no max-height, no !important. */
.chart-card canvas {
    display: block;
}