/* FoodAudit - Custom Styles */
/* Mobile-First Responsive Design */

/* =============================================
   ROOT VARIABLES
============================================= */
:root {
    --primary-color: #0d6efd;
    --success-color: #198754;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --score-excellent: #198754;
    --score-good: #ffc107;
    --score-poor: #dc3545;

    /* Responsive spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;

    /* Navbar heights for sticky positioning */
    --navbar-height: 56px;
    --navbar-height-lg: 56px;

    /* Touch-friendly minimum sizes */
    --touch-target-min: 44px;

    /* Safe area insets for notched devices */
    --safe-area-inset-top: env(safe-area-inset-top, 0px);
    --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-inset-left: env(safe-area-inset-left, 0px);
    --safe-area-inset-right: env(safe-area-inset-right, 0px);
}

/* =============================================
   BASE STYLES (Mobile First)
============================================= */
* {
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    min-height: -webkit-fill-available;
    display: flex;
    flex-direction: column;
    background-color: #f8f9fa;
    padding-top: var(--safe-area-inset-top);
    padding-bottom: var(--safe-area-inset-bottom);
    -webkit-overflow-scrolling: touch;
}

main {
    flex: 1;
    padding-left: var(--safe-area-inset-left);
    padding-right: var(--safe-area-inset-right);
}

/* Improve touch scrolling on iOS */
.overflow-auto,
.table-responsive,
.modal-body {
    -webkit-overflow-scrolling: touch;
}

/* =============================================
   NAVBAR - Mobile First
============================================= */
.navbar-brand {
    font-weight: 600;
    font-size: 1rem;
}

/* Mobile navbar enhancements */
.navbar-toggler {
    border: none;
    padding: 0.5rem;
    min-width: var(--touch-target-min);
    min-height: var(--touch-target-min);
}

.navbar-toggler:focus {
    box-shadow: none;
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* Mobile nav items - larger touch targets */
.navbar-nav .nav-link {
    padding: 0.875rem 1rem;
    min-height: var(--touch-target-min);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-nav .nav-link i {
    font-size: 1.1rem;
}

/* Dropdown items touch friendly */
.dropdown-item {
    padding: 0.75rem 1rem;
    min-height: var(--touch-target-min);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Desktop navbar adjustments */
@media (min-width: 992px) {
    .navbar-brand {
        font-size: 1.1rem;
    }

    .navbar-nav .nav-link {
        padding: 0.5rem 1rem;
    }
}

/* =============================================
   CARDS - Responsive
============================================= */
.card {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border: none;
    margin-bottom: var(--spacing-md);
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    font-weight: 600;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
}

.card-body {
    padding: var(--spacing-md);
}

@media (min-width: 768px) {
    .card-header {
        padding: 1rem 1.25rem;
        font-size: 1rem;
    }

    .card-body {
        padding: var(--spacing-lg);
    }
}

/* =============================================
   STAT CARDS - Responsive
============================================= */
.stat-card {
    text-align: center;
    padding: 0.75rem;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-card .stat-label {
    color: #6c757d;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* Tablet and up */
@media (min-width: 576px) {
    .stat-card {
        padding: 1rem;
    }

    .stat-card .stat-value {
        font-size: 1.75rem;
    }

    .stat-card .stat-label {
        font-size: 0.8rem;
    }
}

/* Desktop */
@media (min-width: 992px) {
    .stat-card .stat-value {
        font-size: 2rem;
    }

    .stat-card .stat-label {
        font-size: 0.875rem;
    }
}

/* =============================================
   SCORE DISPLAY - Responsive
============================================= */
.score-display {
    font-size: 1.75rem;
    font-weight: 700;
}

.score-excellent { color: var(--score-excellent); }
.score-good { color: var(--score-good); }
.score-poor { color: var(--score-poor); }

.score-badge {
    font-size: 1rem;
    padding: 0.375rem 0.75rem;
}

@media (min-width: 576px) {
    .score-display {
        font-size: 2rem;
    }

    .score-badge {
        font-size: 1.125rem;
        padding: 0.5rem 1rem;
    }
}

@media (min-width: 992px) {
    .score-display {
        font-size: 2.5rem;
    }

    .score-badge {
        font-size: 1.25rem;
    }
}

/* =============================================
   VISIT STATUS BADGES
============================================= */
.badge-draft { background-color: #6c757d; }
.badge-in-progress { background-color: #ffc107; color: #000; }
.badge-submitted { background-color: #198754; }

/* =============================================
   AUDIT CHECKLIST - Mobile Optimized
============================================= */
.audit-category {
    margin-bottom: var(--spacing-md);
}

.audit-category-header {
    background-color: #e9ecef;
    padding: 0.75rem;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 0.375rem 0.375rem 0 0;
    position: sticky;
    top: calc(var(--navbar-height) + 60px);
    z-index: 50;
}

.audit-category-header small {
    font-weight: 400;
}

.audit-question {
    padding: 0.875rem;
    border: 1px solid #dee2e6;
    border-top: none;
    background-color: #fff;
}

.audit-question:last-child {
    border-radius: 0 0 0.375rem 0.375rem;
}

.audit-question.critical {
    border-left: 4px solid var(--danger-color);
}

.audit-question.answered-pass {
    background-color: rgba(25, 135, 84, 0.05);
}

.audit-question.answered-fail {
    background-color: rgba(220, 53, 69, 0.05);
}

.audit-question.answered-na {
    background-color: rgba(108, 117, 125, 0.05);
}

.question-text {
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    line-height: 1.4;
}

.question-text .badge {
    font-size: 0.7rem;
    vertical-align: middle;
    margin-left: 0.25rem;
}

.question-description {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

/* Tablet and up */
@media (min-width: 768px) {
    .audit-category-header {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }

    .audit-question {
        padding: 1rem;
    }

    .question-text {
        font-size: 1rem;
    }

    .question-text .badge {
        font-size: 0.75rem;
    }

    .question-description {
        font-size: 0.875rem;
    }
}

/* =============================================
   RESPONSE BUTTONS - Touch Optimized
============================================= */
.response-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.response-buttons .btn,
.response-btn {
    min-width: 100%;
    min-height: var(--touch-target-min);
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.response-buttons .btn.active {
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
}

/* Small tablets - horizontal layout */
@media (min-width: 480px) {
    .response-buttons {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .response-buttons .btn,
    .response-btn {
        min-width: auto;
        flex: 1 1 auto;
        max-width: 150px;
    }
}

/* Tablet and up - refined sizing */
@media (min-width: 768px) {
    .response-buttons .btn,
    .response-btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.95rem;
        min-height: 40px;
    }
}

/* Desktop - original sizing */
@media (min-width: 992px) {
    .response-buttons .btn,
    .response-btn {
        min-width: 80px;
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
}

/* =============================================
   AUDIT PROGRESS BAR - Responsive
============================================= */
.audit-progress {
    position: sticky;
    top: var(--navbar-height);
    background: #fff;
    z-index: 100;
    padding: 0.5rem 0;
    border-bottom: 1px solid #dee2e6;
    margin-left: calc(-1 * var(--bs-gutter-x, 0.75rem));
    margin-right: calc(-1 * var(--bs-gutter-x, 0.75rem));
    padding-left: var(--bs-gutter-x, 0.75rem);
    padding-right: var(--bs-gutter-x, 0.75rem);
}

.audit-progress h5 {
    font-size: 0.95rem;
    margin-bottom: 0.125rem;
}

.audit-progress small {
    font-size: 0.75rem;
}

@media (min-width: 768px) {
    .audit-progress {
        padding: 0.75rem 0;
        margin-left: 0;
        margin-right: 0;
        padding-left: 0;
        padding-right: 0;
    }

    .audit-progress h5 {
        font-size: 1.1rem;
    }

    .audit-progress small {
        font-size: 0.875rem;
    }
}

/* =============================================
   PHOTO GALLERY - Responsive Grid
============================================= */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.5rem;
}

.photo-thumb {
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: transform 0.2s;
    width: 100%;
}

/* Disable hover transform on touch devices */
@media (hover: hover) {
    .photo-thumb:hover {
        transform: scale(1.05);
    }
}

/* Tablet */
@media (min-width: 576px) {
    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.75rem;
    }
}

/* Desktop */
@media (min-width: 992px) {
    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }
}

/* =============================================
   PHOTO UPLOAD AREA - Touch Friendly
============================================= */
.photo-upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 0.375rem;
    padding: 1.25rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.photo-upload-area:hover,
.photo-upload-area.dragover {
    border-color: var(--primary-color);
    background-color: rgba(13, 110, 253, 0.05);
}

.photo-upload-area i {
    font-size: 2rem;
}

.photo-upload-area p {
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

@media (min-width: 768px) {
    .photo-upload-area {
        padding: 2rem;
        min-height: 120px;
    }

    .photo-upload-area i {
        font-size: 2.5rem;
    }

    .photo-upload-area p {
        font-size: 0.875rem;
    }
}

.photo-item {
    position: relative;
    display: inline-block;
}

.photo-item .photo-thumb {
    width: 100%;
}

.photo-delete-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
    opacity: 1;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 0.25rem;
}

/* Show delete button always on touch, hide on hover for desktop */
@media (hover: hover) {
    .photo-delete-btn {
        opacity: 0;
        transition: opacity 0.2s;
    }

    .photo-item:hover .photo-delete-btn {
        opacity: 1;
    }
}

/* =============================================
   TABLES - Responsive
============================================= */
.table-responsive {
    border-radius: 0.375rem;
    margin: 0 -0.75rem;
    padding: 0 0.75rem;
}

.table {
    font-size: 0.8rem;
}

.table th {
    background-color: #f8f9fa;
    font-weight: 600;
    white-space: nowrap;
    font-size: 0.75rem;
    padding: 0.5rem;
}

.table td {
    padding: 0.625rem 0.5rem;
    vertical-align: middle;
}

/* Mobile table card view helper */
.table-mobile-card {
    display: none;
}

@media (max-width: 575.98px) {
    .table-responsive {
        margin: 0;
        padding: 0;
    }

    /* Hide table on very small screens, show card view */
    .table-mobile-stack thead {
        display: none;
    }

    .table-mobile-stack tbody tr {
        display: block;
        margin-bottom: 0.75rem;
        border: 1px solid #dee2e6;
        border-radius: 0.375rem;
        padding: 0.75rem;
    }

    .table-mobile-stack tbody td {
        display: flex;
        justify-content: space-between;
        padding: 0.375rem 0;
        border: none;
    }

    .table-mobile-stack tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        margin-right: 1rem;
        color: #6c757d;
    }
}

/* Tablet */
@media (min-width: 576px) {
    .table-responsive {
        margin: 0;
        padding: 0;
    }

    .table {
        font-size: 0.85rem;
    }

    .table th {
        font-size: 0.8rem;
        padding: 0.625rem;
    }

    .table td {
        padding: 0.75rem 0.625rem;
    }
}

/* Desktop */
@media (min-width: 992px) {
    .table {
        font-size: 0.875rem;
    }

    .table th {
        font-size: 0.875rem;
        padding: 0.75rem;
    }

    .table td {
        padding: 0.875rem 0.75rem;
    }
}

/* =============================================
   FORMS - Touch Optimized
============================================= */
.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.375rem;
}

.required::after {
    content: "*";
    color: var(--danger-color);
    margin-left: 0.25rem;
}

/* Larger touch targets for form controls */
.form-control,
.form-select {
    min-height: var(--touch-target-min);
    padding: 0.625rem 0.875rem;
    font-size: 1rem;
}

.form-control:focus,
.form-select:focus {
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

/* Checkbox and radio - larger on mobile */
.form-check {
    padding-left: 1.75rem;
    min-height: var(--touch-target-min);
    display: flex;
    align-items: center;
}

.form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    margin-left: -1.75rem;
    cursor: pointer;
}

.form-check-label {
    cursor: pointer;
    padding-left: 0.25rem;
}

/* Textarea */
textarea.form-control {
    min-height: 80px;
}

@media (min-width: 768px) {
    .form-control,
    .form-select {
        min-height: 38px;
        padding: 0.375rem 0.75rem;
        font-size: 0.875rem;
    }

    .form-check-input {
        width: 1rem;
        height: 1rem;
    }
}

/* =============================================
   BUTTONS - Touch Friendly
============================================= */
.btn {
    min-height: var(--touch-target-min);
    padding: 0.625rem 1rem;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
}

.btn-sm {
    min-height: 36px;
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

.btn-lg {
    min-height: 52px;
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
}

/* Button groups on mobile */
.btn-group-mobile {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.btn-group-mobile .btn {
    width: 100%;
}

@media (min-width: 576px) {
    .btn-group-mobile {
        flex-direction: row;
        width: auto;
    }

    .btn-group-mobile .btn {
        width: auto;
    }
}

@media (min-width: 768px) {
    .btn {
        min-height: 38px;
        padding: 0.375rem 0.75rem;
        font-size: 0.875rem;
    }

    .btn-sm {
        min-height: 32px;
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }
}

/* =============================================
   LOGIN PAGE - Responsive
============================================= */
.login-container {
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for modern browsers */
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
    padding: var(--spacing-md);
    /* Fix for body background showing through */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: auto;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 1.5rem;
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.login-logo {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
}

@media (min-width: 576px) {
    .login-card {
        padding: 2rem;
    }

    .login-logo {
        font-size: 3rem;
        margin-bottom: 1rem;
    }
}

/* =============================================
   DASHBOARD - Responsive
============================================= */
.dashboard-card {
    height: 100%;
}

.quick-action-btn {
    padding: 1rem;
    text-align: center;
    transition: all 0.2s;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.quick-action-btn i {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 0.375rem;
}

.quick-action-btn span {
    font-size: 0.875rem;
    font-weight: 500;
}

/* Disable hover effects on touch devices */
@media (hover: hover) {
    .quick-action-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
    }
}

@media (min-width: 768px) {
    .quick-action-btn {
        padding: 1.5rem;
        min-height: 120px;
    }

    .quick-action-btn i {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }

    .quick-action-btn span {
        font-size: 1rem;
    }
}

/* =============================================
   STORE LIST - Responsive
============================================= */
.store-card {
    transition: all 0.2s;
}

@media (hover: hover) {
    .store-card:hover {
        box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
    }
}

.store-score {
    font-size: 1.25rem;
    font-weight: 700;
}

@media (min-width: 768px) {
    .store-score {
        font-size: 1.5rem;
    }
}

/* =============================================
   VISIT TIMELINE - Responsive
============================================= */
.visit-timeline {
    position: relative;
    padding-left: 1.5rem;
}

.visit-timeline::before {
    content: '';
    position: absolute;
    left: 0.375rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #dee2e6;
}

.visit-timeline-item {
    position: relative;
    padding-bottom: 1rem;
}

.visit-timeline-item::before {
    content: '';
    position: absolute;
    left: -1.125rem;
    top: 0.25rem;
    width: 10px;
    height: 10px;
    background: var(--primary-color);
    border-radius: 50%;
}

@media (min-width: 768px) {
    .visit-timeline {
        padding-left: 2rem;
    }

    .visit-timeline::before {
        left: 0.5rem;
    }

    .visit-timeline-item {
        padding-bottom: 1.5rem;
    }

    .visit-timeline-item::before {
        left: -1.5rem;
        width: 12px;
        height: 12px;
    }
}

/* =============================================
   REPORTS - Responsive
============================================= */
.trend-chart {
    height: 200px;
    width: 100%;
}

@media (min-width: 576px) {
    .trend-chart {
        height: 250px;
    }
}

@media (min-width: 992px) {
    .trend-chart {
        height: 300px;
    }
}

/* Failure list */
.failure-item {
    padding: 0.625rem;
    border-left: 3px solid var(--danger-color);
    background-color: #fff;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.failure-item.critical {
    border-left-width: 5px;
    background-color: rgba(220, 53, 69, 0.05);
}

@media (min-width: 768px) {
    .failure-item {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
}

/* =============================================
   TEMPLATE EDITOR - Responsive
============================================= */
.template-category {
    margin-bottom: 1rem;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
}

.template-category-header {
    background-color: #f8f9fa;
    padding: 0.625rem 0.75rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    cursor: move;
}

.template-question {
    padding: 0.625rem 0.75rem;
    border-top: 1px solid #dee2e6;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.template-question .badge {
    margin-left: 0.25rem;
}

@media (min-width: 768px) {
    .template-category-header {
        padding: 0.75rem 1rem;
    }

    .template-question {
        padding: 0.75rem 1rem;
        flex-wrap: nowrap;
    }

    .template-question .badge {
        margin-left: 0.5rem;
    }
}

/* =============================================
   FIXED BOTTOM ACTION BAR - Mobile Safe
============================================= */
.position-fixed.bottom-0 {
    padding-bottom: calc(var(--spacing-md) + var(--safe-area-inset-bottom)) !important;
}

/* Audit action bar specific */
.audit-action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #dee2e6;
    padding: 0.75rem;
    padding-bottom: calc(0.75rem + var(--safe-area-inset-bottom));
    z-index: 1000;
}

.audit-action-bar .container-fluid {
    padding-left: var(--spacing-md);
    padding-right: var(--spacing-md);
}

/* Mobile: stack buttons */
@media (max-width: 575.98px) {
    .audit-action-bar .d-flex {
        flex-direction: column;
        gap: 0.5rem;
    }

    .audit-action-bar .btn {
        width: 100%;
    }

    .audit-action-bar .text-muted {
        text-align: center;
        order: -1;
        margin-bottom: 0.25rem !important;
    }
}

@media (min-width: 576px) {
    .audit-action-bar {
        padding: 1rem;
        padding-bottom: calc(1rem + var(--safe-area-inset-bottom));
    }
}

/* Spacer for fixed bottom bar */
.bottom-spacer {
    height: 80px;
}

@media (min-width: 576px) {
    .bottom-spacer {
        height: 70px;
    }
}

/* =============================================
   PRINT STYLES
============================================= */
@media print {
    .navbar, .footer, .btn, .no-print,
    .audit-action-bar, .position-fixed {
        display: none !important;
    }

    body {
        background: #fff;
        padding: 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }

    .audit-question {
        page-break-inside: avoid;
    }

    .audit-progress {
        position: static;
    }
}

/* =============================================
   LOADING SPINNER
============================================= */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* =============================================
   TOOLTIPS
============================================= */
[data-tooltip] {
    position: relative;
    cursor: help;
}

/* Hide custom tooltips on touch devices - use native */
@media (hover: hover) {
    [data-tooltip]::after {
        content: attr(data-tooltip);
        position: absolute;
        bottom: 100%;
        left: 50%;
        transform: translateX(-50%);
        padding: 0.25rem 0.5rem;
        background: #333;
        color: #fff;
        font-size: 0.75rem;
        border-radius: 0.25rem;
        white-space: nowrap;
        opacity: 0;
        visibility: hidden;
        transition: all 0.2s;
        z-index: 1000;
    }

    [data-tooltip]:hover::after {
        opacity: 1;
        visibility: visible;
    }
}

/* =============================================
   ANIMATIONS
============================================= */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* =============================================
   OFFLINE INDICATOR
============================================= */
.offline-indicator {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    right: 0;
    background: linear-gradient(90deg, #dc3545, #c82333);
    color: white;
    padding: 0.5rem 1rem;
    text-align: center;
    z-index: 1050;
    font-weight: 500;
    font-size: 0.85rem;
    animation: slideDown 0.3s ease;
}

.offline-indicator i {
    margin-right: 0.5rem;
}

@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

body.is-offline main {
    padding-top: 40px;
}

/* =============================================
   SESSION WARNING MODAL
============================================= */
#session-warning-modal .modal-header {
    border-bottom: none;
}

#session-warning-modal .modal-body {
    padding: 1.5rem;
}

@media (min-width: 576px) {
    #session-warning-modal .modal-body {
        padding: 2rem;
    }
}

/* =============================================
   AUTO-SCROLL HIGHLIGHT
============================================= */
.audit-question.highlight-next {
    animation: highlightPulse 1s ease;
}

@keyframes highlightPulse {
    0%, 100% { background-color: inherit; }
    50% { background-color: rgba(13, 110, 253, 0.1); }
}

/* =============================================
   FOLLOW-UP FLAG BUTTON
============================================= */
.flag-followup-btn {
    padding: 0.375rem 0.625rem;
    background: none;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.flag-followup-btn:hover {
    background-color: #fff3cd;
    border-color: #ffc107;
}

.flag-followup-btn.flagged {
    background-color: #fff3cd;
    border-color: #ffc107;
}

/* Flagged questions */
.audit-question.flagged-for-followup {
    border-right: 4px solid #ffc107;
}

@media (min-width: 768px) {
    .flag-followup-btn {
        padding: 0.25rem 0.5rem;
        min-height: 32px;
    }
}

/* =============================================
   AUTO-SCROLL TOGGLE
============================================= */
.auto-scroll-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #6c757d;
}

@media (min-width: 768px) {
    .auto-scroll-toggle {
        font-size: 0.875rem;
    }
}

/* =============================================
   PREVIEW MODAL
============================================= */
#audit-preview-modal .h2 {
    margin-bottom: 0;
}

/* =============================================
   STATUS DOT INDICATORS
============================================= */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 0.375rem;
}

.status-dot.draft { background-color: #6c757d; }
.status-dot.in-progress { background-color: #ffc107; }
.status-dot.submitted { background-color: #198754; }

@media (min-width: 768px) {
    .status-dot {
        width: 10px;
        height: 10px;
        margin-right: 0.5rem;
    }
}

/* =============================================
   AUDITOR PERFORMANCE CARD
============================================= */
.performance-card {
    border-left: 4px solid var(--primary-color);
}

.performance-metric {
    text-align: center;
    padding: 0.5rem;
}

.performance-metric .value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.performance-metric .label {
    font-size: 0.65rem;
    color: #6c757d;
    text-transform: uppercase;
}

@media (min-width: 576px) {
    .performance-metric {
        padding: 0.75rem;
    }

    .performance-metric .value {
        font-size: 1.5rem;
    }

    .performance-metric .label {
        font-size: 0.75rem;
    }
}

/* =============================================
   NOTES SECTION
============================================= */
.notes-history {
    max-height: 150px;
    overflow-y: auto;
    background-color: #f8f9fa;
    border-radius: 0.375rem;
    padding: 0.5rem;
    -webkit-overflow-scrolling: touch;
}

.note-entry {
    padding: 0.375rem;
    border-bottom: 1px solid #dee2e6;
    font-size: 0.8rem;
}

.note-entry:last-child {
    border-bottom: none;
}

.note-entry .note-meta {
    font-size: 0.7rem;
    color: #6c757d;
}

@media (min-width: 768px) {
    .notes-history {
        max-height: 200px;
        padding: 0.75rem;
    }

    .note-entry {
        padding: 0.5rem;
        font-size: 0.875rem;
    }

    .note-entry .note-meta {
        font-size: 0.75rem;
    }
}

/* =============================================
   CRITICAL VIOLATION HIGHLIGHT
============================================= */
.critical-violation {
    position: relative;
}

.critical-violation::before {
    content: "CRITICAL";
    position: absolute;
    top: -8px;
    right: 10px;
    background-color: #dc3545;
    color: white;
    font-size: 0.5rem;
    font-weight: 700;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
}

@media (min-width: 576px) {
    .critical-violation::before {
        font-size: 0.625rem;
        padding: 0.125rem 0.375rem;
    }
}

/* =============================================
   STICKY CATEGORY NAVIGATION
============================================= */
.category-nav {
    position: sticky;
    top: calc(var(--navbar-height) + 44px);
    background: white;
    z-index: 90;
    padding: 0.375rem 0;
    border-bottom: 1px solid #dee2e6;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.category-nav::-webkit-scrollbar {
    display: none;
}

.category-nav .nav-link {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border-radius: 2rem;
    margin-right: 0.375rem;
    background: #f8f9fa;
    color: #333;
    font-size: 0.8rem;
    min-height: 36px;
}

.category-nav .nav-link.active {
    background: var(--primary-color);
    color: white;
}

@media (min-width: 768px) {
    .category-nav {
        top: calc(var(--navbar-height) + 52px);
        padding: 0.5rem 0;
    }

    .category-nav .nav-link {
        padding: 0.5rem 1rem;
        margin-right: 0.5rem;
        font-size: 0.875rem;
    }
}

/* =============================================
   RESPONSIVE UTILITY CLASSES
============================================= */
/* Hide on mobile */
.hide-mobile {
    display: none !important;
}

@media (min-width: 576px) {
    .hide-mobile {
        display: initial !important;
    }
}

/* Hide on desktop */
.hide-desktop {
    display: initial !important;
}

@media (min-width: 768px) {
    .hide-desktop {
        display: none !important;
    }
}

/* Full width on mobile */
.w-mobile-100 {
    width: 100% !important;
}

@media (min-width: 576px) {
    .w-mobile-100 {
        width: auto !important;
    }
}

/* Stack on mobile */
.stack-mobile {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

@media (min-width: 576px) {
    .stack-mobile {
        flex-direction: row;
    }
}

/* Text sizes */
.text-responsive-sm {
    font-size: 0.8rem;
}

@media (min-width: 768px) {
    .text-responsive-sm {
        font-size: 0.875rem;
    }
}

/* Padding adjustments */
.p-responsive {
    padding: var(--spacing-sm);
}

@media (min-width: 576px) {
    .p-responsive {
        padding: var(--spacing-md);
    }
}

@media (min-width: 992px) {
    .p-responsive {
        padding: var(--spacing-lg);
    }
}

/* Gap utilities */
.gap-responsive {
    gap: var(--spacing-sm);
}

@media (min-width: 576px) {
    .gap-responsive {
        gap: var(--spacing-md);
    }
}

/* =============================================
   MODAL RESPONSIVE
============================================= */
.modal-dialog {
    margin: 0.5rem;
}

.modal-content {
    border-radius: 0.5rem;
}

.modal-header {
    padding: 0.75rem 1rem;
}

.modal-body {
    padding: 1rem;
}

.modal-footer {
    padding: 0.75rem 1rem;
    gap: 0.5rem;
}

.modal-footer .btn {
    flex: 1;
}

@media (min-width: 576px) {
    .modal-dialog {
        margin: 1.75rem auto;
    }

    .modal-header {
        padding: 1rem 1.25rem;
    }

    .modal-body {
        padding: 1.25rem;
    }

    .modal-footer {
        padding: 1rem 1.25rem;
    }

    .modal-footer .btn {
        flex: 0 0 auto;
    }
}

/* Full screen modal on mobile */
.modal-fullscreen-sm-down {
    margin: 0;
    max-width: 100%;
    height: 100%;
}

.modal-fullscreen-sm-down .modal-content {
    height: 100%;
    border: 0;
    border-radius: 0;
}

@media (min-width: 576px) {
    .modal-fullscreen-sm-down {
        margin: 1.75rem auto;
        max-width: 500px;
        height: auto;
    }

    .modal-fullscreen-sm-down .modal-content {
        height: auto;
        border: 1px solid rgba(0, 0, 0, 0.175);
        border-radius: 0.5rem;
    }
}

/* =============================================
   LIST GROUP RESPONSIVE
============================================= */
.list-group-item {
    padding: 0.625rem 0.875rem;
}

.list-group-item.d-flex {
    flex-wrap: wrap;
    gap: 0.5rem;
}

@media (min-width: 576px) {
    .list-group-item {
        padding: 0.75rem 1rem;
    }

    .list-group-item.d-flex {
        flex-wrap: nowrap;
    }
}

/* =============================================
   ALERT RESPONSIVE
============================================= */
.alert {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
}

@media (min-width: 576px) {
    .alert {
        padding: 1rem 1.25rem;
        font-size: 0.9rem;
    }
}

/* =============================================
   CONTAINER FLUID PADDING FIX
============================================= */
.container-fluid {
    padding-left: var(--spacing-md);
    padding-right: var(--spacing-md);
}

@media (min-width: 576px) {
    .container-fluid {
        padding-left: var(--spacing-lg);
        padding-right: var(--spacing-lg);
    }
}

@media (min-width: 992px) {
    .container-fluid {
        padding-left: var(--spacing-xl);
        padding-right: var(--spacing-xl);
    }
}

/* =============================================
   DARK MODE SUPPORT (Optional)
============================================= */
@media (prefers-color-scheme: dark) {
    /* Dark mode styles can be added here */
}
