/*
 * fia.css — Shared stylesheet for all FIA portals
 * Covers: /office/, /inspector/, /client/
 *
 * Class naming conventions:
 *   .fia-*   — office and client portals
 *   .insp-*  — inspector portal
 * Both sets live here intentionally; browsers ignore rules whose selectors
 * don't appear in the page. No portal loads more than this one file.
 */

/* ══════════════════════════════════════════════════════════════════════════
   VARIABLES
   ══════════════════════════════════════════════════════════════════════════ */

:root {
    --fia-blue:      #6699CC;
    --fia-blue-dark: #4d7aaa;
    --fia-dark:      #333333;
    --fia-yellow:    #FFFFCC;
    --fia-red:       #BA0000;
    --fia-form-bg:   #eef1f6;   /* editable form section background */
    --sidebar-width: 220px;
}

/* ══════════════════════════════════════════════════════════════════════════
   BODY
   ══════════════════════════════════════════════════════════════════════════ */

body {
    font-family: 'Segoe UI', Arial, Helvetica, sans-serif;
    font-size: 0.9rem;
    background-color: #f4f6f8;
    color: #222;
}

/* ══════════════════════════════════════════════════════════════════════════
   FORMS  — tighten label→field gap so labels read as captions above inputs,
   not floating between fields. Row gap provides the space between groups.
   ══════════════════════════════════════════════════════════════════════════ */

.form-label {
    margin-bottom: 0.1rem;
    font-size: 0.82rem;
    color: #0473c5;
}

/* ══════════════════════════════════════════════════════════════════════════
   NAVBAR  (.fia-navbar — shared base  |  portal modifier classes for color)
   ══════════════════════════════════════════════════════════════════════════ */

.fia-navbar,
.insp-navbar {
    position: sticky;
    top: 0;
    z-index: 1030;
}

/* Per-portal navbar background colours */
.office-navbar  { background-color: #1d007d; }
.client-navbar  { background-color: #c85500; }
.insp-navbar    { background-color: #1a6b1a; }

.fia-navbar .navbar-brand img,
.insp-navbar .navbar-brand img {
    max-height: 42px;
    border-radius: 6px;
}

.fia-navbar .nav-link,
.insp-navbar .nav-link {
    color: #ddd !important;
    font-size: 0.85rem;
}

.fia-navbar .nav-link:hover,
.fia-navbar .nav-link.active,
.insp-navbar .nav-link:hover,
.insp-navbar .nav-link.active {
    color: #fff !important;
}

.fia-navbar .navbar-text,
.insp-navbar .navbar-text {
    color: #aaa;
    font-size: 0.8rem;
}

/* ══════════════════════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════════════════════ */

.btn-fia {
    background-color: var(--fia-blue);
    border-color: var(--fia-blue-dark);
    color: #fff;
    font-size: 0.85rem;
}

.btn-fia:hover {
    background-color: var(--fia-blue-dark);
    color: #fff;
}

.btn-fia-danger {
    background-color: var(--fia-red);
    border-color: #8a0000;
    color: #fff;
    font-size: 0.85rem;
}

/* ══════════════════════════════════════════════════════════════════════════
   CARDS
   .fia-card — office/client     .insp-card — inspector
   ══════════════════════════════════════════════════════════════════════════ */

.fia-card {
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    margin-bottom: 1.25rem;
}

.fia-card .fia-page-header {
    margin: 0;
}

.fia-card-body {
    padding: 0.75rem 1rem;
}

/* Inspector card */

.insp-card {
    background: #fff;
    border: 1px solid #dde;
    border-radius: 6px;
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.insp-card-header {
    background-color: var(--fia-blue);
    color: #fff;
    padding: 0.5rem 1rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.insp-card-body {
    padding: 0.85rem 1rem;
}

/* ══════════════════════════════════════════════════════════════════════════
   PAGE HEADER BAND  (office/client)
   ══════════════════════════════════════════════════════════════════════════ */

.fia-page-header {
    background-color: var(--fia-blue);
    color: #fff;
    padding: 0.55rem 1rem;
    border-radius: 4px 4px 0 0;
    font-size: 0.95rem;
    font-weight: 600;
}

.fia-page-header .subtext {
    font-size: 0.78rem;
    color: #dce8f5;
}

/* ══════════════════════════════════════════════════════════════════════════
   DATA TABLES
   .fia-table — office/client    .insp-table — inspector
   ══════════════════════════════════════════════════════════════════════════ */

.fia-table,
.insp-table {
    width: 100%;
    font-size: 0.82rem;
    border-collapse: collapse;
    margin: 0;
}

.fia-table thead th,
.insp-table thead th {
    background-color: var(--fia-dark);
    color: #fff;
    font-weight: 600;
    padding: 0.4rem 0.5rem;
    white-space: nowrap;
}

.fia-table thead th { text-align: left; }
.insp-table thead th { text-align: left; padding: 0.4rem 0.6rem; }

.fia-table tbody tr,
.insp-table tbody tr {
    border-bottom: 1px solid #e0e0e0;
}

.fia-table tbody tr:hover,
.insp-table tbody tr:hover {
    background-color: #eef3f9;
}

.fia-table td {
    padding: 0.4rem 0.5rem;
    vertical-align: middle;
}

.insp-table td {
    padding: 0.45rem 0.6rem;
    vertical-align: middle;
}

/* client portal centers table cells by default */
.fia-table td              { text-align: left; }
.fia-table td.text-start   { text-align: left; font-size: medium; }

/* ══════════════════════════════════════════════════════════════════════════
   PHOTO GRID  (shared — inspector and office both use this)
   ══════════════════════════════════════════════════════════════════════════ */

.photo-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    padding: 0.5rem 0;
}

@media (min-width: 480px)  { .photo-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 768px)  { .photo-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1024px) { .photo-grid { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 1400px) { .photo-grid { grid-template-columns: repeat(6, 1fr); } }

.photo-item {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.07);
    display: flex;
    flex-direction: column;
}

.photo-item img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
    cursor: pointer;
}

.photo-item .photo-caption {
    padding: 0.35rem 0.5rem;
    flex: 1;
}

.photo-item .photo-caption input {
    font-size: 0.78rem;
    border: none;
    border-bottom: 1px solid #ccc;
    width: 100%;
    background: transparent;
    outline: none;
    padding: 0.1rem 0;
}

.photo-item .photo-caption input:focus {
    border-bottom-color: var(--fia-blue);
}

.photo-item .photo-actions {
    display: flex;
    justify-content: flex-end;
    padding: 0.25rem 0.5rem 0.4rem;
    gap: 0.3rem;
}

/* ══════════════════════════════════════════════════════════════════════════
   UPLOAD / DROP ZONE
   ══════════════════════════════════════════════════════════════════════════ */

.upload-zone {
    border: 2px dashed var(--fia-blue);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    background: #f8faff;
    cursor: pointer;
    transition: background 0.2s;
}

.upload-zone:hover,
.upload-zone.drag-over {
    background: #e8f0fb;
}

.upload-zone i {
    font-size: 2rem;
    color: var(--fia-blue);
    display: block;
    margin-bottom: 0.5rem;
}

/* ══════════════════════════════════════════════════════════════════════════
   LEGEND / HIGHLIGHT  (office/client)
   ══════════════════════════════════════════════════════════════════════════ */

.fia-legend {
    background-color: var(--fia-yellow);
    border: 1px solid #e0d880;
    border-radius: 4px;
    padding: 0.6rem 0.9rem;
    font-size: 0.8rem;
    line-height: 1.9;
}

/* ══════════════════════════════════════════════════════════════════════════
   SEARCH BAR  (office/client)
   ══════════════════════════════════════════════════════════════════════════ */

.fia-search-bar {
    background-color: var(--fia-yellow);
    border: 1px solid #e0d880;
    border-radius: 4px;
    padding: 0.6rem 1rem;
}

/* ══════════════════════════════════════════════════════════════════════════
   FORM SECTION  (all portals — editable forms)
   Light background so white form fields visually pop.
   ══════════════════════════════════════════════════════════════════════════ */

.fia-form-section {
    background-color: var(--fia-form-bg);
    border-radius: 4px;
    padding: 0.85rem 1rem;
}

/* Keep individual fields white so they stand out against the section bg */
.fia-form-section .form-control,
.fia-form-section .form-select {
    background-color: #fff;
}

/* Disabled / read-only fields stay visually muted */
.fia-form-section .form-control:disabled,
.fia-form-section .form-control[readonly],
.fia-form-section .form-select:disabled {
    background-color: #e9ecef;
}

/* ══════════════════════════════════════════════════════════════════════════
   PAGINATION  (office/client)
   ══════════════════════════════════════════════════════════════════════════ */

.fia-pagination {
    font-size: 0.82rem;
    color: #555;
}

.fia-pagination a {
    color: var(--fia-blue-dark);
}

/* ══════════════════════════════════════════════════════════════════════════
   STATUS / UPLOAD BADGES  (client portal)
   ══════════════════════════════════════════════════════════════════════════ */

.status-badge {
    display: inline-block;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    vertical-align: middle;
}

.status-assigned { background-color: #f0a500; }
.status-complete  { background-color: #28a745; }

.upload-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 3px;
    text-decoration: none;
}

.upload-badge.has-photos { background-color: #28a745; color: #fff; }
.upload-badge.no-photos  { background-color: #dc3545; color: #fff; }

/* ══════════════════════════════════════════════════════════════════════════
   MESSAGE CARD  (inspector portal)
   ══════════════════════════════════════════════════════════════════════════ */

.msg-card {
    border-left: 4px solid var(--fia-blue);
    background: var(--fia-yellow);
    padding: 0.6rem 0.85rem;
    border-radius: 0 4px 4px 0;
    margin-bottom: 0.6rem;
    font-size: 0.85rem;
}

.msg-card .msg-subject {
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.msg-card .msg-date {
    font-size: 0.75rem;
    color: #666;
}

/* ══════════════════════════════════════════════════════════════════════════
   FLASH / ALERTS
   ══════════════════════════════════════════════════════════════════════════ */

.fia-flash {
    margin-bottom: 0.75rem;
}

/* ══════════════════════════════════════════════════════════════════════════
   LOGIN PAGE
   office: .login-wrapper / .login-card
   inspector: .login-wrap / .login-box
   ══════════════════════════════════════════════════════════════════════════ */

.login-wrapper,
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #e8edf2;
}

.login-card,
.login-box {
    width: 100%;
    max-width: 400px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: #fff;
    padding: 2rem 2.25rem 1.75rem;
    box-shadow: 0 2px 12px rgba(0,0,0,.12);
}

.login-card .login-logo,
.login-box .logo {
    display: block;
    max-width: 340px;
    margin: 0 auto 1.5rem;
}

.login-card h1,
.login-box h1 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--fia-dark);
    text-align: center;
    margin-bottom: 1.25rem;
}

/* ══════════════════════════════════════════════════════════════════════════
   FOOTER
   ══════════════════════════════════════════════════════════════════════════ */

.fia-footer,
.insp-footer {
    font-size: 0.75rem;
    color: #999;
    text-align: center;
    padding: 1rem 0 1.5rem;
    border-top: 1px solid #ddd;
    margin-top: 2rem;
}

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — table stacking on mobile
   ══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 575px) {

    /* office/client table stacking */
    .fia-table thead { display: none; }

    .fia-table tbody tr {
        display: block;
        margin-bottom: 0.75rem;
        border: 1px solid #ccc;
        border-radius: 4px;
        padding: 0.5rem;
        background: #fff;
    }

    .fia-table td {
        display: flex;
        justify-content: space-between;
        text-align: right;
        padding: 0.25rem 0.4rem;
        border-bottom: 1px solid #eee;
    }

    .fia-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--fia-dark);
        text-align: left;
        flex: 1;
    }

    .fia-table td:last-child { border-bottom: none; }

    /* inspector table stacking */
    .insp-table thead { display: none; }

    .insp-table td {
        display: block;
        padding: 0.25rem 0.6rem;
    }

    .insp-table td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.75rem;
        color: #888;
        display: block;
    }
}
