/* InspectKit - Fire Inspection System - Styles */

:root {
    --primary-blue: #1e3a8a;
    --secondary-blue: #00B4D8;
    --accent-orange: #f97316;
    --dark-bg: #000000;
    --text-dark: #333333;
    --text-light: #475569;
    --border-color: #e2e8f0;
    --success-green: #10b981;
    --warning-yellow: #f59e0b;
    --danger-red: #dc2626;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background: #f8fafc;
}

/* Demo Banner */
.demo-banner {
    background: linear-gradient(135deg, var(--accent-orange), #ea580c);
    color: white;
    padding: 0.75rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    position: sticky;
    top: 0;
    z-index: 1001;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.demo-banner i {
    margin-right: 0.5rem;
}

/* Header/Navigation - See industrial.css for primary styles */
/* Legacy overrides removed - using industrial design system */

nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    align-items: center;
}

nav a {
    color: white;
    text-decoration: none;
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.3s ease;
}

nav a:hover,
nav a.active {
    background: var(--secondary-blue);
    color: white;
}

nav a i {
    font-size: 1rem;
}

/* Dropdown Navigation */
nav li {
    position: relative;
}

nav li.dropdown > a::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.7rem;
    margin-left: 0.5rem;
}

nav .dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    min-width: 200px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 1000;
    padding: 0.5rem 0;
    margin-top: 0.25rem;
}

nav li.dropdown:hover .dropdown-menu {
    display: block;
}

nav .dropdown-menu a {
    color: var(--text-color);
    padding: 0.75rem 1rem;
    border-radius: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

nav .dropdown-menu a:hover {
    background: #f1f5f9;
    color: var(--primary-red);
}

nav .dropdown-menu a i {
    width: 20px;
    text-align: center;
    color: var(--primary-red);
}

/* Mobile Navigation */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: 2px solid white;
    color: white;
    font-size: 1.5rem;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 6px;
}

/* Medium screens - slightly smaller nav items */
@media (max-width: 1200px) {
    nav a {
        padding: 0.6rem 0.9rem;
        font-size: 0.85rem;
        gap: 0.4rem;
    }

    nav a i {
        font-size: 0.9rem;
    }
}

@media (max-width: 992px) {
    .mobile-menu-toggle {
        display: block;
    }

    header nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--dark-bg);
        padding: 1rem;
        display: none;
        border-top: 2px solid var(--secondary-blue);
    }

    header nav.active {
        display: block;
    }

    header nav ul {
        flex-direction: column;
        gap: 0.5rem;
    }

    header nav a {
        padding: 1rem;
        font-size: 1rem;
    }
}

/* Main Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Page Title */
.page-title {
    color: var(--primary-blue);
    font-size: 2rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.page-subtitle {
    color: var(--text-light);
    font-size: 1rem;
    margin-bottom: 2rem;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-left: 4px solid var(--secondary-blue);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.stat-card.warning {
    border-left-color: var(--warning-yellow);
}

.stat-card.danger {
    border-left-color: var(--danger-red);
}

.stat-card.success {
    border-left-color: var(--success-green);
}

.stat-label {
    color: var(--text-light);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.stat-value {
    color: var(--primary-blue);
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-icon {
    font-size: 2rem;
    opacity: 0.3;
    float: right;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: var(--primary-blue);
    color: white;
}

.btn-primary:hover {
    background: #1e40af;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.3);
}

.btn-secondary {
    background: var(--secondary-blue);
    color: white;
}

.btn-secondary:hover {
    background: #0096B8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 180, 216, 0.3);
}

.btn-success {
    background: var(--success-green);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--danger-red);
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-outline {
    background: white;
    color: var(--primary-blue);
    border: 2px solid var(--primary-blue);
}

.btn-outline:hover {
    background: var(--primary-blue);
    color: white;
}

.btn-outline-success {
    background: transparent;
    color: #22c55e;
    border: 1px solid #22c55e;
}

.btn-outline-success:hover {
    background: #22c55e;
    color: white;
}

/* Portal published badge */
.portal-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-left: 0.5rem;
    background: #22c55e;
    color: white;
    border-radius: 50%;
    font-size: 0.7rem;
    vertical-align: middle;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1rem;
    min-height: 56px;
}

.btn-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    min-height: auto;
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.25rem;
    color: var(--primary-blue);
    margin-bottom: 1rem;
    font-weight: 600;
}

/* Tables */
.table-container {
    background: white;
    border-radius: 12px;
    overflow-x: auto;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px; /* Ensure table has minimum width on mobile */
}

@media (max-width: 768px) {
    /* Only force min-width on tables without mobile alternatives */
    table:not(.desktop-table) {
        min-width: 600px;
    }

    /* Desktop tables are hidden on mobile (mobile cards shown instead) */
    table.desktop-table {
        min-width: auto;
    }

    /* Prevent horizontal scrolling on body */
    body {
        overflow-x: hidden;
    }
}

thead {
    background: var(--primary-blue);
    color: white;
}

thead th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

tbody tr:hover {
    background: #f8fafc;
}

tbody tr[style*="cursor: pointer"]:hover {
    background: #e0f2fe;
    transform: scale(1.01);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

tbody tr[style*="cursor: pointer"] {
    transition: all 0.2s ease;
}

tbody td {
    padding: 1rem;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-scheduled {
    background: #dbeafe;
    color: #1e40af;
}

.status-completed {
    background: #d1fae5;
    color: #065f46;
}

.status-pass {
    background: #d1fae5;
    color: #065f46;
}

.status-fail {
    background: #fee2e2;
    color: #991b1b;
}

.status-open {
    background: #fed7aa;
    color: #92400e;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--primary-blue);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background: #f8fafc;
}

/* Form inputs - show enhanced border on all focus */
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--secondary-blue);
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.1);
}

/* Form inputs - add outline only for keyboard focus */
.form-group input:focus-visible,
.form-group select:focus-visible,
.form-group textarea:focus-visible {
    outline: 3px solid #f97316;
    outline-offset: 2px;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* Story 7.1: Criteria field display - shows expected answer criteria for inspection questions */
.field-criteria {
    font-size: 0.85rem;
    color: #059669;
    font-style: italic;
    padding: 0.5rem 0.75rem;
    margin: 0.25rem 0 0.5rem 0;
    background: #ecfdf5;
    border-left: 3px solid #10b981;
    border-radius: 0 4px 4px 0;
}

.field-criteria i {
    margin-right: 0.5rem;
    color: #10b981;
}

/* Inspection Form */
.inspection-form {
    max-width: 800px;
    margin: 0 auto;
}

.form-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.form-section-title {
    font-size: 1.25rem;
    color: var(--primary-blue);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    width: 24px;
    height: 24px;
    cursor: pointer;
}

.checkbox-group label {
    margin: 0;
    cursor: pointer;
    flex: 1;
}

/* Signature Pad */
.signature-pad {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: white;
    cursor: crosshair;
    touch-action: none;
}

.signature-controls {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* Calendar */
.calendar {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
}

.calendar-day {
    aspect-ratio: 1;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
    font-size: 0.9rem;
    position: relative;
    cursor: pointer;
    transition: all 0.2s;
}

.calendar-day:hover {
    background: #f8fafc;
    border-color: var(--secondary-blue);
}

.calendar-day.has-inspection {
    background: #dbeafe;
    border-color: var(--primary-blue);
}

.calendar-day.overdue {
    background: #fee2e2;
    border-color: var(--danger-red);
}

.calendar-day.today {
    background: #fef3c7;
    border-color: var(--warning-yellow);
    font-weight: 700;
}

/* Modal - Improved Full-Screen Experience */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10000; /* Above status-bar (9998) and toast (9999) */
    overflow-y: auto;
    padding: 1rem;
}

.modal.active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 2rem;
}

.modal-content {
    background: white;
    border-radius: 20px;
    max-width: 800px;
    width: 100%;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    position: relative;
    animation: modalSlideIn 0.3s ease-out;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
}

/* Large modal variant */
.modal-content.modal-large {
    max-width: 1000px;
}

/* Full-screen modal on mobile */
@media (max-width: 768px) {
    .modal {
        padding: 0;
        overflow: hidden;
    }

    .modal.active {
        padding-top: 0;
        align-items: stretch;
    }

    .modal-content {
        max-width: 100%;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
        animation: modalSlideUp 0.3s ease-out;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .modal-body {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    /* Ensure modal inputs don't cause zoom */
    .modal input,
    .modal select,
    .modal textarea {
        font-size: 16px !important;
        max-width: 100%;
        touch-action: manipulation;
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.modal-title {
    font-size: 1.25rem;
    color: white;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.modal-body {
    padding: 1.5rem;
    padding-bottom: 80px; /* Extra padding for status bar */
}

@media (max-width: 768px) {
    .modal-header {
        padding: 1rem 1.25rem;
    }

    .modal-title {
        font-size: 1.1rem;
    }

    .modal-body {
        padding: 1.25rem;
    }

    /* Prevent iOS auto-zoom on input focus - must be 16px+ */
    .modal-body input,
    .modal-body select,
    .modal-body textarea {
        font-size: 16px !important;
    }
}

/* Photo Upload */
.photo-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.photo-preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.photo-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-remove-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--danger-red);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .page-title {
        font-size: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    table {
        font-size: 0.85rem;
    }

    thead th,
    tbody td {
        padding: 0.75rem 0.5rem;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .form-section {
        padding: 1rem;
    }
}

/* Touch-Friendly Targets (minimum 48x48px) */
@media (max-width: 992px) {
    .btn {
        min-height: 48px;
        padding: 0.85rem 1.25rem;
    }

    .checkbox-group input[type="checkbox"] {
        width: 32px;
        height: 32px;
    }

    nav a {
        min-height: 48px;
    }
}

/* Mobile Inspection Cards */
.mobile-inspection-list {
    display: none;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.mobile-inspection-card {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.mobile-inspection-card:active {
    transform: scale(0.98);
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}

.inspection-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.inspection-card-header h3 {
    color: var(--primary-blue);
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.inspection-card-header p {
    color: var(--text-light);
    font-size: 0.9rem;
    margin: 0;
}

.inspection-card-body {
    margin-bottom: 1rem;
}

.inspection-card-body p {
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.inspection-card-body i {
    color: var(--secondary-blue);
    width: 20px;
}

.inspection-card-footer {
    text-align: center;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.tap-to-view {
    color: var(--secondary-blue);
    font-size: 0.9rem;
    font-weight: 600;
}

.desktop-inspection-table {
    display: block;
}

.desktop-inspection-table table {
    margin: 0;
}

.desktop-inspection-table th {
    white-space: nowrap;
    padding: 0.875rem 1rem;
}

.desktop-inspection-table td {
    padding: 0.875rem 1rem;
    vertical-align: middle;
}

.desktop-inspection-table tbody tr:nth-child(even) {
    background: #f8fafc;
}

.desktop-inspection-table tbody tr:hover {
    background: #e0f2fe;
}

/* Mobile/Tablet responsive behavior */
@media (max-width: 992px) {
    .mobile-inspection-list {
        display: grid;
    }

    .desktop-inspection-table {
        display: none;
    }
}

/* Footer Styles */
footer {
    background: #000000;
    color: white;
    padding: 2rem 0 1rem;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h4 {
    color: var(--secondary-blue);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.footer-section p {
    color: #cbd5e1;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.footer-section a {
    color: #cbd5e1;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section a:hover {
    color: var(--secondary-blue);
}

.footer-contact-item {
    display: flex;
    align-items: start;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.footer-contact-item i {
    color: var(--secondary-blue);
    margin-top: 0.25rem;
}

.footer-bottom {
    border-top: 1px solid #334155;
    padding-top: 1.5rem;
    text-align: center;
}

.footer-bottom p {
    color: #94a3b8;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.footer-logo-img {
    max-width: 200px;
    height: auto;
    margin-bottom: 1rem;
}

@media (max-width: 768px) {
    footer {
        padding: 1.5rem 0 1rem;
        margin-top: 2rem;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* Print Styles */
@media print {
    header,
    nav,
    .demo-banner,
    .btn,
    footer {
        display: none !important;
    }

    .container {
        max-width: 100%;
    }
}

/* ===== MOBILE/TABLET RESPONSIVE STYLES FOR HOSPITAL SELECTOR ===== */

/* Tablet Styles (768px - 1024px) */
@media (max-width: 1024px) {
    /* Make hospital selector labels stack on tablets */
    .form-group label {
        font-size: 0.95rem;
    }
    
    /* Ensure JC form info grid stacks properly */
    .form-group div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
}

/* Mobile Styles (below 768px) */
@media (max-width: 768px) {
    /* Hospital selector - stack radio buttons vertically */
    div[style*="display: flex; gap: 1rem"] label {
        display: flex !important;
        width: 100%;
        padding: 0.75rem;
        background: white;
        border: 2px solid #e2e8f0;
        border-radius: 6px;
        margin-bottom: 0.5rem;
    }
    
    div[style*="display: flex; gap: 1rem"] label input[type="radio"] {
        min-width: 20px;
        min-height: 20px;
    }
    
    /* Make form groups more compact on mobile */
    .form-group {
        margin-bottom: 1.25rem;
    }
    
    /* Larger touch targets for radio buttons */
    input[type="radio"] {
        width: 20px;
        height: 20px;
        cursor: pointer;
    }
    
    /* Stack form info displays vertically */
    div[style*="flex: 1; min-width: 200px"] {
        flex: none !important;
        width: 100% !important;
        min-width: 100% !important;
        margin-bottom: 0.75rem;
    }
    
    /* Ensure selects are full width and touch-friendly */
    select {
        min-height: 44px;
        font-size: 16px; /* Prevents iOS zoom */
    }
    
    /* Make buttons stack on very small screens */
    div[style*="display: flex; gap: 1rem"] button {
        flex: 1;
        min-width: 120px;
    }
}

/* Small Mobile (below 480px) */
@media (max-width: 480px) {
    /* Stack all buttons vertically */
    div[style*="display: flex; gap: 1rem; margin-top: 1.5rem"] {
        flex-direction: column !important;
    }
    
    div[style*="display: flex; gap: 1rem; margin-top: 1.5rem"] button {
        width: 100% !important;
    }
    
    /* Make form padding smaller */
    .form-group {
        padding: 0.75rem !important;
    }
    
    /* Reduce font sizes slightly for small screens */
    label {
        font-size: 0.9rem;
    }
    
    /* Ensure modals fit on small screens */
    .modal-content {
        width: 95vw !important;
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* Touch-friendly improvements for all mobile devices */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    button,
    input[type="radio"],
    input[type="checkbox"],
    select {
        min-height: 44px;
        min-width: 44px;
    }

    /* Better spacing for touch */
    .form-group {
        margin-bottom: 1.5rem;
    }

    /* Prevent double-tap zoom */
    button,
    a,
    input,
    select,
    textarea {
        touch-action: manipulation;
    }
}

/* ===== TOAST NOTIFICATION SYSTEM ===== */
/* Story 1.3 - Visual feedback for async operations */

.toast-container {
    position: fixed;
    bottom: 80px; /* Above status bar if present */
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: calc(100vw - 32px);
    width: 400px;
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    font-size: 16px;
    min-height: 48px;
    animation: toastSlideUp 0.3s ease-out;
    cursor: pointer;
}

.toast--exiting {
    animation: toastFadeOut 0.3s ease-out forwards;
}

/* Toast Level Variants */
.toast--success {
    background: #16a34a;
    color: white;
}

.toast--info {
    background: #0284c7;
    color: white;
}

.toast--warning {
    background: #ea580c;
    color: white;
}

.toast--error {
    background: #dc2626;
    color: white;
}

/* Toast Elements */
.toast__icon {
    font-size: 20px;
    flex-shrink: 0;
    line-height: 1;
}

.toast__message {
    flex: 1;
    line-height: 1.4;
}

.toast__retry {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
    min-height: 44px;
    min-width: 44px;
}

.toast__retry:hover,
.toast__retry:focus {
    background: rgba(255, 255, 255, 0.3);
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
}

.toast__dismiss {
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
    flex-shrink: 0;
    opacity: 0.8;
}

.toast__dismiss:hover,
.toast__dismiss:focus {
    background: rgba(255, 255, 255, 0.2);
    opacity: 1;
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
}

/* Toast Animations */
@keyframes toastSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastFadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* Tablet/Mobile responsive */
@media (max-width: 768px) {
    .toast-container {
        bottom: 100px;
        width: calc(100vw - 24px);
        max-width: none;
    }

    .toast {
        padding: 14px 16px;
        gap: 10px;
    }

    .toast__message {
        font-size: 15px;
    }
}

/* ===== STATUS BAR COMPONENT ===== */
/* Story 1.4 - Persistent sync status indicator */

.status-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    display: none; /* Hidden on desktop by default */
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 9998; /* Below toast-container at 9999 */
    background: #1e293b; /* Dark slate for contrast */
    color: white;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.2);
}

/* Only show status bar on mobile/tablet */
@media (max-width: 768px) {
    .status-bar {
        display: flex;
    }
}

/* Status bar states */
.status-bar--online .status-bar__indicator {
    color: #22c55e; /* Green */
}

.status-bar--offline .status-bar__indicator {
    color: #94a3b8; /* Gray */
}

.status-bar--offline {
    background: #334155; /* Slightly lighter dark to indicate offline */
}

.status-bar--pending .status-bar__sync {
    color: #60a5fa; /* Light blue for pending */
}

.status-bar--syncing .status-bar__sync {
    animation: statusBarPulse 1s infinite;
}

/* Status bar elements */
.status-bar__indicator {
    font-size: 16px;
    line-height: 1;
}

.status-bar__status {
    color: white;
}

.status-bar__separator {
    color: #64748b;
    margin: 0 4px;
}

.status-bar__sync {
    color: #94a3b8;
}

/* Syncing pulse animation */
@keyframes statusBarPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ===== SSE CONNECTION STATUS STATES (Story 7.6) ===== */
/* Visual indicators for SSE connection status */

/* SSE Connected - Green indicator */
.status-bar--sse-connected .status-bar__indicator {
    color: #22c55e;
}

/* SSE Disconnected - Red indicator */
.status-bar--sse-disconnected .status-bar__indicator {
    color: #ef4444;
}

/* SSE Disconnected - Also update status text color */
.status-bar--sse-disconnected .status-bar__status {
    color: #fca5a5;
}

/* SSE Reconnecting - Orange indicator with pulse animation */
.status-bar--sse-reconnecting .status-bar__indicator {
    color: #f97316;
    animation: sseReconnectingPulse 1s infinite;
}

.status-bar--sse-reconnecting .status-bar__status {
    color: #fdba74;
    animation: sseReconnectingPulse 1s infinite;
}

.status-bar--sse-reconnecting .status-bar__sync {
    color: #fed7aa;
}

/* SSE Reconnecting pulse animation */
@keyframes sseReconnectingPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Override background for reconnecting state */
.status-bar--sse-reconnecting {
    background: linear-gradient(135deg, #1e293b 0%, #431407 100%);
}

/* Status bar only visible on mobile - body padding only needed there */
@media (max-width: 768px) {
    .status-bar {
        display: flex;
        height: 48px;
        font-size: 13px;
        gap: 6px;
    }

    .status-bar__indicator {
        font-size: 14px;
    }

    body {
        padding-bottom: 48px;
    }

    /* Extra bottom margin for inspection form on mobile */
    #inspectionFormContainer > div:last-child {
        margin-bottom: 70px;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .status-bar {
        padding: 0 12px;
    }

    .status-bar__separator {
        margin: 0 2px;
    }
}

/* Story 3.1: Start Inspection Flow - Selection Cards */
/* Touch-friendly selection cards with outdoor readability (AC #6) */
.customer-result-card,
.building-card,
.equipment-card {
    min-height: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0, 180, 216, 0.2);
    user-select: none;
}

.customer-result-card:active,
.building-card:active,
.equipment-card:active {
    transform: scale(0.98);
    background: #e0f2fe !important;
}

/* High contrast for outdoor readability */
.building-card,
.equipment-card {
    background: white;
    border: 2px solid #e2e8f0;
}

.building-card:hover,
.equipment-card:hover {
    border-color: var(--secondary-blue);
    background: #f0f9ff;
}

/* Selected state styling */
.building-card.selected,
.equipment-card.selected {
    border-color: var(--secondary-blue);
    background: #e0f2fe;
    box-shadow: 0 2px 8px rgba(0, 180, 216, 0.25);
}

/* Customer search input for touch */
#customerSearchInput {
    touch-action: manipulation;
    font-size: 16px; /* Prevents iOS zoom on focus */
}

/* Customer search results scrollable area */
#customerSearchResults {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* Make modal content scroll smoothly on touch devices */
.modal-content {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* ===== JC Form Tablet-Friendly Styles ===== */

/* Prevent horizontal scrolling on tablets (8" = ~800px) */
.inspection-form {
    max-width: 100%;
    overflow-x: hidden;
}

/* Form container smooth scrolling */
#formContent {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* JC Form section headers - sticky for visibility during scroll */
.form-section-title {
    position: sticky;
    top: 0;
    background: white;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    margin-top: -0.5rem;
    z-index: 10;
}

/* Ensure form fields don't overflow on narrow screens */
.form-group input,
.form-group select,
.form-group textarea {
    max-width: 100%;
    box-sizing: border-box;
}

/* Tablet-specific styles (8" tablet ~800px) */
@media (max-width: 850px) {
    /* Ensure inspection form fits without horizontal scroll */
    .inspection-form {
        padding: 0 0.5rem;
    }

    .form-section {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    /* Stack form fields on narrow screens */
    .form-fields {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    /* Ensure grid layouts stack on mobile/tablet */
    .form-group div[style*="grid-template-columns"] {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.75rem !important;
    }

    /* Repeatable section instance styling */
    .repeatable-instance {
        padding: 0.75rem !important;
    }

    /* Ensure buttons don't overflow */
    .btn-outline,
    .btn-sm {
        max-width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* JC Form header grid - stack on narrow screens */
    .form-section > div[style*="grid-template-columns: repeat(auto-fit"] {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.75rem !important;
    }
}

/* Touch-friendly inputs for forms */
@media (max-width: 992px) {
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Prevents iOS zoom on focus */
        min-height: 44px;
        padding: 0.75rem;
    }

    /* Larger touch targets for select options */
    .form-group select option {
        padding: 0.5rem;
        min-height: 44px;
    }
}

/* ===== NFPA Reference Info Icon and Panel ===== */

/* Info button in section headers */
.nfpa-info-btn {
    background: none;
    border: none;
    color: #3b82f6;
    cursor: pointer;
    padding: 0;
    margin-left: 0.5rem;
    font-size: 1.1rem;
    vertical-align: middle;
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.nfpa-info-btn:hover {
    background: #eff6ff;
    color: #1d4ed8;
}

.nfpa-info-btn:focus-visible {
    background: #eff6ff;
    color: #1d4ed8;
    outline: 3px solid #f97316;
    outline-offset: 2px;
}

.nfpa-info-btn:active {
    transform: scale(0.95);
}

/* Field-level info button (inline with field labels) */
.nfpa-field-info-btn {
    background: none;
    border: none;
    color: #3b82f6;
    cursor: pointer;
    padding: 0;
    margin-left: 0.35rem;
    font-size: 0.9rem;
    vertical-align: middle;
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.nfpa-field-info-btn:hover {
    background: #eff6ff;
    color: #1d4ed8;
}

.nfpa-field-info-btn:focus-visible {
    background: #eff6ff;
    color: #1d4ed8;
    outline: 3px solid #f97316;
    outline-offset: 2px;
}

.nfpa-field-info-btn:active {
    transform: scale(0.95);
}

/* Field context display in panel */
.nfpa-field-context {
    background: #fef3c7;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #92400e;
    border-left: 3px solid #f59e0b;
}

/* View NFPA Standards link in section headers */
.nfpa-standards-link {
    display: inline-block;
    font-size: 0.85rem;
    color: #3b82f6;
    text-decoration: underline;
    cursor: pointer;
    margin-left: 1rem;
    padding: 0.5rem;
    min-height: 44px;
    line-height: 1.5;
    vertical-align: middle;
}

.nfpa-standards-link:hover {
    color: #1d4ed8;
}

.nfpa-standards-link:focus-visible {
    color: #1d4ed8;
    outline: 3px solid #f97316;
    outline-offset: 2px;
}

/* Reference panel overlay */
.nfpa-reference-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.nfpa-reference-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* Reference panel (slide-up drawer on mobile, centered modal on desktop) */
.nfpa-reference-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 85vh;
    background: white;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.nfpa-reference-panel.visible {
    transform: translateY(0);
}

/* Panel header */
.nfpa-reference-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: #1e3a8a;
    color: white;
}

.nfpa-reference-header h3 {
    margin: 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Close button */
.nfpa-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: background 0.2s ease;
}

.nfpa-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Close button has dark background - enhanced focus visibility */
.nfpa-close-btn:focus-visible {
    background: rgba(255, 255, 255, 0.3);
    outline: 3px solid #f97316;
    outline-offset: 2px;
    box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.25);
}

/* Panel body */
.nfpa-reference-body {
    padding: 1.25rem;
    overflow-y: auto;
    max-height: calc(85vh - 60px);
    -webkit-overflow-scrolling: touch;
}

.nfpa-section-title {
    color: #1e40af;
    font-weight: 600;
    font-size: 1rem;
    margin: 0 0 1rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e2e8f0;
}

.nfpa-code-edition {
    background: #f0f9ff;
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.nfpa-requirement {
    background: #f8fafc;
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    line-height: 1.6;
    border-left: 3px solid #3b82f6;
}

.nfpa-references-list {
    font-size: 0.9rem;
}

.nfpa-references-list ul {
    margin: 0.5rem 0 0 0;
    padding-left: 1.25rem;
}

.nfpa-references-list li {
    margin-bottom: 0.5rem;
    color: #334155;
}

/* Desktop: centered modal instead of bottom drawer */
@media (min-width: 851px) {
    .nfpa-reference-panel {
        bottom: auto;
        top: 50%;
        left: 50%;
        right: auto;
        transform: translate(-50%, -50%) scale(0.95);
        opacity: 0;
        max-width: 600px;
        width: 90%;
        max-height: 80vh;
        border-radius: 16px;
        transition: transform 0.3s ease, opacity 0.3s ease;
    }

    .nfpa-reference-panel.visible {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }

    .nfpa-reference-body {
        max-height: calc(80vh - 70px);
    }
}

/* Tablet/mobile: taller bottom drawer */
@media (max-width: 850px) {
    .nfpa-reference-panel {
        max-height: 85vh;
    }

    .nfpa-reference-body {
        max-height: calc(85vh - 60px);
    }
}

/* ===== STATUS TOGGLE (Pass/Fail/N/A) ===== */
/* Story 3.3 - Form field interactions */

.status-toggle {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.status-btn {
    flex: 1;
    min-height: 44px;       /* Touch-friendly NFR9 */
    min-width: 44px;
    padding: 0.5rem 1rem;
    border: 2px solid #cbd5e1;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.status-btn:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}

.status-btn:focus {
    outline: 2px solid var(--secondary-blue);
    outline-offset: 2px;
}

.status-btn:active {
    transform: scale(0.98);
}

/* Pass button - active state */
.status-btn.status-pass.active {
    background: #22c55e;
    border-color: #22c55e;
    color: white;
}

.status-btn.status-pass:hover:not(.active) {
    border-color: #22c55e;
    background: #f0fdf4;
}

/* Fail button - active state */
.status-btn.status-fail.active {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
}

.status-btn.status-fail:hover:not(.active) {
    border-color: #ef4444;
    background: #fef2f2;
}

/* N/A button - active state */
.status-btn.status-na.active {
    background: #6b7280;
    border-color: #6b7280;
    color: white;
}

.status-btn.status-na:hover:not(.active) {
    border-color: #6b7280;
    background: #f9fafb;
}

/* ===== DEFICIENCY NOTES EXPANSION ===== */
/* Story 3.3 - Expandable notes on Fail */

.deficiency-notes-wrapper {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out, margin 0.3s ease-out;
    padding: 0;
    margin: 0;
}

.deficiency-notes-wrapper.visible {
    max-height: 200px;
    padding: 0.75rem 0 0 0;
    margin-top: 0.5rem;
}

.deficiency-notes-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #ef4444;
    margin-bottom: 0.35rem;
}

.deficiency-notes-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #fca5a5;
    border-radius: 8px;
    font-size: 16px; /* Prevent iOS zoom */
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
    background: #fef2f2;
    transition: border-color 0.2s ease, background 0.2s ease;
}

/* Deficiency textarea - show enhanced border on all focus */
.deficiency-notes-textarea:focus {
    border-color: #ef4444;
    background: white;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

/* Add outline only for keyboard focus */
.deficiency-notes-textarea:focus-visible {
    outline: 3px solid #f97316;
    outline-offset: 2px;
}

.deficiency-notes-textarea::placeholder {
    color: #f87171;
}

/* ===== SAVE INDICATOR ===== */
/* Story 3.3 - Visual feedback after save */
/* z-index hierarchy: save-indicator (9997) < status-bar (9998) < toast-container (9999) */

.save-indicator {
    position: fixed;
    bottom: 80px; /* Above status bar */
    right: 20px;
    background: #22c55e;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    z-index: 9997; /* Below status-bar (9998) and toast (9999) */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.save-indicator.visible {
    opacity: 1;
    transform: translateY(0);
}

.save-indicator i {
    font-size: 1rem;
}

/* Mobile adjustments for save indicator */
@media (max-width: 600px) {
    .save-indicator {
        right: 10px;
        left: 10px;
        justify-content: center;
    }
}

/* Tablet/mobile adjustments for status toggle */
@media (max-width: 850px) {
    .status-toggle {
        gap: 0.35rem;
    }

    .status-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
}

/* Small mobile - stack status buttons if needed */
@media (max-width: 380px) {
    .status-toggle {
        flex-wrap: wrap;
    }

    .status-btn {
        flex: 1 1 auto;
        min-width: calc(33% - 0.35rem);
    }
}

/* ===== PHOTO CAPTURE & GALLERY ===== */
/* Story 3.4 - Photo capture and attachment */

/* Add Photo button - prominent and touch-friendly */
.add-photo-btn {
    min-width: 160px;
    min-height: 48px;       /* Touch-friendly (NFR9 44px minimum) */
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.15s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.add-photo-btn:active {
    transform: scale(0.97);
}

.add-photo-btn i {
    font-size: 1.2rem;
}

/* Disabled state when max photos reached */
.add-photo-btn:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    opacity: 0.7;
}

.add-photo-btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Photo limit hint */
.photo-limit-hint {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #64748b;
}

/* Photo count badge */
.photo-count-badge {
    background: var(--secondary-blue);
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    margin-left: 0.5rem;
    vertical-align: middle;
}

/* Photo gallery grid (3 columns on tablet) */
.photo-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    padding: 0.75rem 0;
    margin-top: 0.5rem;
}

/* Photo thumbnail */
.photo-thumbnail {
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.photo-thumbnail:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.photo-thumbnail:active {
    transform: scale(0.98);
}

.photo-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Delete badge on thumbnail */
.photo-thumbnail .delete-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease;
    z-index: 1;
}

.photo-thumbnail .delete-badge:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* Photo preview modal (full-size view) */
.photo-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2001; /* Above modal (2000) */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: photoModalFadeIn 0.2s ease-out;
    padding: 1rem;
}

@keyframes photoModalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.photo-modal-content {
    position: relative;
    max-width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.photo-modal-content img {
    max-width: 100%;
    max-height: calc(80vh - 80px);
    object-fit: contain;
    border-radius: 8px;
}

.photo-modal-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: background 0.2s ease;
}

.photo-modal-close:hover,
.photo-modal-close:focus {
    background: rgba(255, 255, 255, 0.3);
}

.photo-modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.photo-modal-actions .btn {
    min-width: 120px;
    min-height: 48px;
}

/* Multi-photo capture sequence modal */
.photo-capture-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2002;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.photo-capture-preview {
    max-width: 100%;
    max-height: 50vh;
    border-radius: 8px;
    object-fit: contain;
}

.photo-capture-count {
    color: white;
    font-size: 1.1rem;
    margin: 1rem 0;
    font-weight: 600;
}

.photo-capture-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.photo-capture-actions .btn {
    min-width: 140px;
    min-height: 48px;
}

/* Delete confirmation modal */
.delete-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2003;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.delete-confirm-dialog {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 320px;
    text-align: center;
    animation: modalSlideIn 0.2s ease-out;
}

.delete-confirm-dialog h3 {
    margin: 0 0 0.5rem 0;
    color: #dc2626;
}

.delete-confirm-dialog p {
    margin: 0 0 1.5rem 0;
    color: #64748b;
}

.delete-confirm-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.delete-confirm-actions .btn {
    min-width: 100px;
    min-height: 44px;
}

/* Responsive adjustments for photo gallery */
@media (max-width: 600px) {
    .photo-gallery {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
}

@media (max-width: 400px) {
    .photo-gallery {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Loading indicator for photo compression */
.photo-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2004;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
}

.photo-loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

.photo-loading-text {
    margin-top: 1rem;
    font-size: 1rem;
}

/* ===== SIGNATURE MODAL (Story 3.5) ===== */

.signature-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: none;
    flex-direction: column;
}

.signature-modal.active {
    display: flex;
}

.signature-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    color: white;
    flex-shrink: 0;
}

.signature-modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.signature-modal-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.signature-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.signature-modal-close:active {
    transform: scale(0.95);
}

.signature-modal-canvas-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow: hidden;
}

.signature-modal-canvas {
    background: white;
    border-radius: 8px;
    width: 100%;
    max-width: 900px;
    height: auto;
    aspect-ratio: 3 / 1;
    max-height: 50vh;
    touch-action: none;
    cursor: crosshair;
}

.signature-modal-actions {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    justify-content: center;
    flex-shrink: 0;
}

.signature-modal-btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    min-width: 120px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: transform 0.1s, opacity 0.2s;
}

.signature-modal-btn:active {
    transform: scale(0.97);
}

.signature-modal-btn.btn-clear {
    background: #6b7280;
    color: white;
}

.signature-modal-btn.btn-clear:hover {
    background: #4b5563;
}

.signature-modal-btn.btn-accept {
    background: var(--success-green, #22c55e);
    color: white;
}

.signature-modal-btn.btn-accept:hover {
    background: #16a34a;
}

/* Signature capture area on form */
.signature-capture-area {
    min-height: 100px;
}

.signature-placeholder {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    background: #f9fafb;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: #6b7280;
    transition: border-color 0.2s, color 0.2s;
}

.signature-placeholder:hover {
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

.signature-placeholder:active {
    transform: scale(0.99);
}

.signature-placeholder i {
    font-size: 1.5rem;
}

.signature-thumbnail {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.signature-thumbnail img {
    max-width: 100%;
    max-height: 80px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: white;
}

.signature-thumbnail .btn-resign {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    min-height: 44px;
}

/* Modal open animation */
@keyframes signatureModalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.signature-modal.active {
    animation: signatureModalFadeIn 0.2s ease-out;
}

/* Prevent body scroll when modal is open */
body.signature-modal-open {
    overflow: hidden;
}

/* ===== REVIEW MODAL (Story 3.6) ===== */
/* Pre-submission review summary modal */

.review-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.review-modal.active {
    display: flex;
    animation: reviewModalFadeIn 0.2s ease-out;
}

@keyframes reviewModalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.review-modal-content {
    background: white;
    border-radius: 12px;
    max-width: 90%;
    width: 500px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.review-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: white;
    flex-shrink: 0;
}

.review-modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--primary-blue);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.review-modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: #64748b;
    cursor: pointer;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s;
}

.review-modal-close:hover {
    background: #f1f5f9;
    color: var(--primary-blue);
}

.review-modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

.review-section {
    margin-bottom: 1.25rem;
}

.review-section:last-child {
    margin-bottom: 0;
}

.review-section h4 {
    font-size: 0.9rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 0.5rem 0;
    font-weight: 600;
}

.review-section p {
    margin: 0.25rem 0;
    color: var(--text-dark);
}

.review-section p strong {
    color: var(--primary-blue);
}

/* Results badges in review modal */
.results-badges {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.results-badges .badge {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.results-badges .badge-success {
    background: #dcfce7;
    color: #166534;
}

.results-badges .badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.results-badges .badge-secondary {
    background: #f1f5f9;
    color: #475569;
}

/* Photo strip in review modal */
.review-photo-strip {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.5rem 0;
    -webkit-overflow-scrolling: touch;
}

.review-photo-strip img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid var(--border-color);
    flex-shrink: 0;
}

/* Signatures in review modal */
.review-signatures {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.signature-review {
    flex: 1;
    min-width: 120px;
    text-align: center;
}

.signature-review span {
    display: block;
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 0.35rem;
}

.signature-review img {
    max-width: 100%;
    max-height: 50px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: white;
}

.signature-review .sig-missing {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 50px;
    background: #fef2f2;
    border: 2px dashed #fca5a5;
    border-radius: 4px;
    color: #dc2626;
    font-size: 0.85rem;
}

.signature-review .sig-present {
    color: #16a34a;
}

/* Deficiencies section in review modal */
.review-deficiencies {
    background: #fef2f2;
    border-left: 3px solid #ef4444;
    padding: 0.75rem;
    border-radius: 0 6px 6px 0;
}

.review-deficiencies ul {
    margin: 0.5rem 0 0 0;
    padding-left: 1.25rem;
}

.review-deficiencies li {
    color: #991b1b;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

/* Warning list in review modal */
.review-warnings {
    background: #fef3c7;
    border-left: 3px solid #f59e0b;
    padding: 0.75rem;
    border-radius: 0 6px 6px 0;
}

.review-warnings h4 {
    color: #92400e;
    margin-bottom: 0.5rem;
}

.warning-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.warning-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    margin-bottom: 0.25rem;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    min-height: 44px;
}

.warning-list li:hover {
    background: #fff7ed;
}

.warning-list li i {
    color: #f59e0b;
}

.warning-list li span {
    flex: 1;
    color: #92400e;
    font-size: 0.9rem;
}

.warning-list li .nav-arrow {
    color: #f59e0b;
    font-size: 0.9rem;
}

/* Review modal footer */
.review-modal-footer {
    display: flex;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background: #f8fafc;
    flex-shrink: 0;
}

.review-modal-footer .btn {
    flex: 1;
    justify-content: center;
}

/* Disabled confirm button */
.review-modal-footer .btn:disabled {
    background-color: #9ca3af;
    color: #4b5563;
    cursor: not-allowed;
}

.review-modal-footer .btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Prevent body scroll when review modal is open */
body.review-modal-open {
    overflow: hidden;
}

/* Tablet/mobile adjustments for review modal */
@media (max-width: 600px) {
    .review-modal-content {
        max-width: 95%;
        width: 100%;
    }

    .review-modal-footer {
        flex-direction: column;
    }

    .results-badges {
        justify-content: center;
    }

    .review-signatures {
        flex-direction: column;
    }
}

/* Note: .save-indicator styles consolidated in Story 3.3 section above (lines ~1860) */

/* ===== MOBILE-RESPONSIVE TABLE/CARD LAYOUT ===== */
/* Show cards on mobile, table on desktop */

.mobile-cards {
    display: none;
}

.desktop-table {
    display: table;
    width: 100%;
}

/* Mobile card styles */
.mobile-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.2s;
}

.mobile-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.mobile-card:active {
    transform: scale(0.99);
}

.mobile-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.mobile-card-title {
    font-weight: 600;
    color: var(--primary-blue);
    font-size: 1rem;
    flex: 1;
}

.mobile-card-badge {
    background: #e0f2fe;
    color: #0369a1;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.mobile-card-body {
    color: var(--text-light);
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

.mobile-card-body div {
    margin-bottom: 0.25rem;
}

.mobile-card-body i {
    width: 16px;
    margin-right: 0.5rem;
    color: #94a3b8;
}

.mobile-card-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.mobile-card-actions .btn {
    flex: 1;
    min-width: 0;
    justify-content: center;
    font-size: 0.8rem;
    padding: 0.5rem;
}

/* Mobile breakpoint - show cards, hide table */
@media (max-width: 768px) {
    .mobile-cards {
        display: block;
    }

    .desktop-table {
        display: none;
    }

    /* Make header buttons stack on mobile */
    .card > div[style*="justify-content: space-between"] {
        flex-direction: column;
        align-items: stretch !important;
    }

    .card > div[style*="justify-content: space-between"] > div[style*="display: flex"][style*="gap"] {
        justify-content: stretch;
    }

    .card > div[style*="justify-content: space-between"] .btn {
        flex: 1;
        justify-content: center;
    }

    /* Page headers with buttons */
    .container > div[style*="justify-content: space-between"] {
        flex-direction: column;
        gap: 1rem;
    }

    .container > div[style*="justify-content: space-between"] > div[style*="display: flex"] {
        flex-wrap: wrap;
    }

    .container > div[style*="justify-content: space-between"] .btn {
        flex: 1;
        min-width: 120px;
        justify-content: center;
        text-align: center;
    }

    /* Make page title smaller on mobile */
    .page-title {
        font-size: 1.25rem;
    }

    .page-subtitle {
        font-size: 0.9rem;
    }

    /* Form groups full width on mobile */
    .form-group {
        max-width: 100% !important;
    }

    /* Search input full width */
    #searchInput,
    #completedSearch,
    #customerSearch {
        width: 100%;
    }
}
