/* ============================================================================
   pvi-dashboard.css
   ----------------------------------------------------------------------------
   Block 2 — per-page styles. Loaded by the master frame via the <<stylesheet>>
   injection point, AFTER pvi-master-frame.css. References :root design tokens
   defined in the master CSS.

   Every selector in this file is scoped to the .pvi-dashboard container so it
   cannot leak into other pages that share the master frame.

   Extracted and refactored from photography_analysis_platform.html lines 9–225
   per pvi-dashboard-audit.md §7.2 ("CSS extraction").
   ============================================================================ */


/* ----------------------------------------------------------------------------
   1. Page-scoped tokens
   Tokens that don't exist in the master :root and are dashboard-local.
   ---------------------------------------------------------------------------- */
.pvi-dashboard {
    --tab-active-bg:    var(--dark-grey);   /* dark active pill (was off-palette #007bff) */
    --tab-active-text:  var(--white);
    --upload-border:    #007bff;
    --upload-bg:        #f8f9ff;
    --upload-bg-hover:  #e6f3ff;
    --upload-border-hover: #0056b3;
    --sidebar-bg:       #ffffff;
    --sidebar-border:   #dee2e6;
    --sidebar-heading-color: var(--mid-grey);
    --nav-link-color:   #495057;
    --nav-link-hover:   #e9ecef;
    --filter-bg:        #f8f9fa;
    --stat-number-color: #495057;
    --stat-label-color: var(--mid-grey);
    --thumb-bg:         #e9ecef;
    --thumb-icon-color: var(--mid-grey);

    /* Layout knobs */
    --content-max:          1200px; /* centered content column width */
    --sidebar-width:        260px;
    --sidebar-width-md:     280px;
    --topbar-height:        56px;  /* used by mobile sidebar offset */

    /* Drop the Bootstrap .container-fluid side padding so the white top action
       bar runs edge-to-edge, lining up with the full-width master-frame header.
       The top bar's inner content and the main panel each re-center themselves
       on --content-max, so removing the gutter here doesn't shift the content. */
    padding-left: 0;
    padding-right: 0;
}


/* ----------------------------------------------------------------------------
   2. Top action bar — tab strip + user menu
   Replaces the legacy top-dark navbar; lives inside the fragment, not the
   master frame.
   ---------------------------------------------------------------------------- */
.pvi-dashboard .dashboard-topbar {
    padding: 12px 20px;
    border-bottom: 1px solid var(--sidebar-border);
    background-color: #ffffff;
    margin-bottom: 20px;
}

/* Two-zone grid: left-aligned tabs | right-aligned user menu.
   Constrained to the content column and given the same 30px side padding as
   .main-panel, so the start of the first tab lines up with the left edge of the
   welcome box and stat cards below. The white bar itself stays full-width via
   .dashboard-topbar. */
.pvi-dashboard .dashboard-topbar-inner {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 12px;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 0 30px;
}
.pvi-dashboard .dashboard-topbar-inner .pv-tabs {
    grid-column: 1;
    justify-self: start;
}
.pvi-dashboard .dashboard-topbar-inner .user-menu {
    grid-column: 2;
    justify-self: end;
}

.pvi-dashboard .pv-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.pvi-dashboard .pv-tab {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    color: var(--nav-link-color);
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
    transition: background-color .15s ease-in-out, color .15s ease-in-out;
}
.pvi-dashboard .pv-tab:hover {
    background-color: var(--nav-link-hover);
    color: var(--nav-link-color);
}
.pvi-dashboard .pv-tab.active {
    background-color: var(--tab-active-bg);
    color: var(--tab-active-text);
}

/* Yellow/gold folder glyph on the Projects tab (matches the mockup). */
.pvi-dashboard .pv-tab .pv-tab-folder {
    color: var(--orange);
}
/* When Projects is the active (dark) tab, keep the glyph legible. */
.pvi-dashboard .pv-tab.active .pv-tab-folder {
    color: var(--tab-active-text);
}

.pvi-dashboard .user-menu .btn {
    color: var(--nav-link-color);
    text-decoration: none;
}
.pvi-dashboard .user-menu .user-name {
    margin-left: 6px;
    font-weight: 500;
}


/* ----------------------------------------------------------------------------
   3. Welcome banner — post-login success greeting (dismissible)
   ---------------------------------------------------------------------------- */
.pvi-dashboard .welcome-banner {
    display: flex;
    align-items: center;
    gap: 16px;
    background-color: var(--green);
    color: var(--white);
    border-radius: 8px;
    padding: 18px 22px;
    margin-bottom: 24px;
}
.pvi-dashboard .welcome-banner-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}
.pvi-dashboard .welcome-banner-title {
    font-weight: 700;
    font-size: 1.05rem;
}
.pvi-dashboard .welcome-banner-sub {
    font-size: .9rem;
    opacity: .95;
}
.pvi-dashboard .welcome-banner-close {
    margin-left: auto;
    align-self: flex-start;
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    opacity: .85;
    padding: 0;
}
.pvi-dashboard .welcome-banner-close:hover {
    opacity: 1;
}


/* ----------------------------------------------------------------------------
   3b. Tab content sections — only the active one is visible
   ---------------------------------------------------------------------------- */
.pvi-dashboard .content-section {
    display: none;
}
.pvi-dashboard .content-section.active {
    display: block;
}


/* ----------------------------------------------------------------------------
   4. Main panel — centered content column
   ---------------------------------------------------------------------------- */
.pvi-dashboard .main-panel {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 0 30px;
}


/* ----------------------------------------------------------------------------
   5. Cards & activity boxes — rounded surfaces
   Bump every dashboard card to a softer corner radius, and render the Recent
   Activity rows as discrete rounded boxes with a colored left accent.
   ---------------------------------------------------------------------------- */
.pvi-dashboard .card {
    --bs-card-border-radius: .75rem;   /* softer corners than the Bootstrap 6px default */
}

.pvi-dashboard .activity-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--surface);
    border-radius: 8px;
    border-left: 4px solid var(--mid-grey);
    padding: 12px 16px;
    margin-bottom: 12px;
}
.pvi-dashboard .activity-item:last-child {
    margin-bottom: 0;
}
.pvi-dashboard .activity-item-blue  { border-left-color: var(--bs-primary); }
.pvi-dashboard .activity-item-green { border-left-color: var(--bs-success); }
.pvi-dashboard .activity-item-info  { border-left-color: var(--bs-info); }


/* ----------------------------------------------------------------------------
   6. Stat cards — top-of-dashboard counter row
   Bound to <<total_photos>>, <<analyzed_count>>, <<processing_count>>,
   <<projects_count>>.
   ---------------------------------------------------------------------------- */
.pvi-dashboard .stat-card {
    border: none;
    box-shadow: 0 .125rem .25rem rgba(0, 0, 0, .075);
    transition: transform .15s ease-in-out, box-shadow .15s ease-in-out;
}
.pvi-dashboard .stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .15);
}
.pvi-dashboard .stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.25rem;
}
.pvi-dashboard .stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--stat-number-color);
}
.pvi-dashboard .stat-label {
    font-size: .875rem;
    color: var(--stat-label-color);
}


/* ----------------------------------------------------------------------------
   7. Photo grid (Photos tab)
   ---------------------------------------------------------------------------- */
.pvi-dashboard .photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}
.pvi-dashboard .photo-card {
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .1);
    transition: transform .2s, box-shadow .2s;
}
.pvi-dashboard .photo-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, .15);
}
.pvi-dashboard .photo-thumbnail {
    width: 100%;
    height: 150px;
    object-fit: cover;
    background-color: var(--thumb-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--thumb-icon-color);
    font-size: 2rem;
}


/* ----------------------------------------------------------------------------
   8. Quick Upload area (Dashboard tab)
   ---------------------------------------------------------------------------- */
.pvi-dashboard .upload-area {
    border: 2px dashed var(--upload-border);
    border-radius: 10px;
    padding: 40px;
    text-align: center;
    background-color: var(--upload-bg);
    cursor: pointer;
    transition: background-color .3s ease, border-color .3s ease;
}
.pvi-dashboard .upload-area:hover,
.pvi-dashboard .upload-area.drag-over {
    background-color: var(--upload-bg-hover);
    border-color: var(--upload-border-hover);
}


/* ============================================================================
   9. Responsive breakpoints
   ============================================================================ */

/* --- Tablet and below: tighten the main panel gutters --------------------- */
@media (max-width: 1080px) {

    .pvi-dashboard .main-panel {
        padding: 0 15px;
    }
}

/* --- Phone-size: tighter photo grid + smaller stat numbers ---------------- */
@media (max-width: 768px) {

    .pvi-dashboard .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 15px;
    }

    .pvi-dashboard .stat-card .card-body {
        padding: 15px;
    }

    .pvi-dashboard .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .pvi-dashboard .stat-number {
        font-size: 1.5rem;
    }

    .pvi-dashboard .main-panel {
        padding: 0 10px;
    }

    .pvi-dashboard .dashboard-topbar {
        padding: 10px 12px;
    }
}

/* --- Small phone: tighter still ------------------------------------------- */
@media (max-width: 576px) {

    .pvi-dashboard .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }

    .pvi-dashboard .stat-number {
        font-size: 1.25rem;
    }
}
