:root {
    --primary: #0e7490;
    --secondary: #155e75;
    --accent: #f59e0b;
    --soft: #f0f9ff;
    --text-dark: #0f172a;
}

body {
    font-family: 'Sarabun', sans-serif;
    color: var(--text-dark);
    background: radial-gradient(circle at 10% 10%, #e0f2fe, #f8fafc 45%, #ecfeff);
    min-height: 100vh;
}

.app-nav {
    background: linear-gradient(120deg, var(--secondary), var(--primary));
}

.brand-main {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
}

.brand-sub {
    font-size: 0.7rem;
    opacity: 0.8;
}

.navbar-brand-logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
    border-radius: 8px;
    background: #fff;
    padding: 4px;
}

.notification-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.55rem 0.8rem;
    border: 1px solid rgba(255,255,255,0.28);
    border-radius: 999px;
    color: #fff;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.2s ease;
}

.notification-link:hover {
    background: rgba(255,255,255,0.12);
    transform: translateY(-1px);
}

.notification-icon {
    font-size: 1rem;
}

.notification-badge {
    min-width: 1.85rem;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 0.25rem 0.45rem;
    border-radius: 999px;
    background: #dc2626;
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 600;
}

.nav-tabs-wrapper {
    flex-wrap: wrap;
}

.nav-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1rem;
    color: rgba(255,255,255,0.9);
    background: rgba(255,255,255,0.08);
    border-radius: 999px;
    text-decoration: none;
    border: 1px solid transparent;
    transition: all 0.25s ease;
    font-weight: 600;
}

.nav-tab:hover {
    color: #0f172a;
    background: #ffffff;
    border-color: rgba(255,255,255,0.4);
    transform: none;
}

.nav-tab i {
    margin-right: 0.5rem;
    font-size: 1rem;
}

.btn .bi {
    margin-right: 0.35rem;
    font-size: 0.95rem;
}

.nav-tab.active {
    color: #0f172a;
    background: #ffffff;
    border-color: rgba(255,255,255,0.4);
}

.app-card {
    border: 0;
    border-radius: 1rem;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.manual-pdf-frame {
    width: 100%;
    height: calc(100vh - 260px);
    min-height: 500px;
}

.manual-pdf-frame iframe {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 0.5rem;
}

.manual-pdf-frame:fullscreen,
.manual-pdf-frame:-webkit-full-screen {
    height: 100vh;
    min-height: 0;
    background: #202124;
}

.manual-pdf-frame:fullscreen iframe,
.manual-pdf-frame:-webkit-full-screen iframe {
    border-radius: 0;
}

.form-section-card {
    position: relative;
    border-radius: 1rem;
    border: 1px solid transparent;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
    overflow: hidden;
}

.form-section-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 5px;
}

.form-section-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
}

.form-section-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.7rem;
    font-size: 1.05rem;
    flex-shrink: 0;
}

.form-section-people {
    background: linear-gradient(165deg, #fff7ed 0%, #ffffff 55%);
    border-color: #fed7aa;
}

.form-section-people::before {
    background: linear-gradient(90deg, #f59e0b, #fb923c);
}

.form-section-people .form-section-title {
    color: #9a3412;
}

.form-section-people .form-section-icon {
    background: linear-gradient(135deg, #f59e0b, #fb923c);
    color: #fff;
}

.form-section-location {
    background: linear-gradient(165deg, #faf5ff 0%, #ffffff 55%);
    border-color: #e9d5ff;
}

.form-section-location::before {
    background: linear-gradient(90deg, #7c3aed, #c084fc);
}

.form-section-location .form-section-title {
    color: #6b21a8;
}

.form-section-location .form-section-icon {
    background: linear-gradient(135deg, #7c3aed, #c084fc);
    color: #fff;
}

.form-section-images {
    background: linear-gradient(165deg, #eff6ff 0%, #ffffff 55%);
    border-color: #bfdbfe;
}

.form-section-images::before {
    background: linear-gradient(90deg, #2563eb, #38bdf8);
}

.form-section-images .form-section-title {
    color: #1e40af;
}

.form-section-images .form-section-icon {
    background: linear-gradient(135deg, #2563eb, #38bdf8);
    color: #fff;
}

.form-section-reporter {
    background: linear-gradient(165deg, #f0fdfa 0%, #ffffff 55%);
    border-color: #99f6e4;
}

.form-section-reporter::before {
    background: linear-gradient(90deg, #0e7490, #14b8a6);
}

.form-section-reporter .form-section-title {
    color: #115e59;
}

.form-section-reporter .form-section-icon {
    background: linear-gradient(135deg, #0e7490, #14b8a6);
    color: #fff;
}

.signature-pad-shell {
    background: #ffffff;
}

.signature-pad {
    width: 100%;
    max-width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 0.75rem;
    background: #ffffff;
    touch-action: none;
}

.signature-preview-image {
    max-height: 220px;
    object-fit: contain;
    background: #f8fafc;
}

.stats-card {
    background: #ffffff;
    border-radius: 1rem;
    border-left: 6px solid var(--primary);
}

.summary-card {
    background: #ffffff;
    border-radius: 1.25rem;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    min-height: 170px;
}

.summary-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 24px 55px rgba(15, 23, 42, 0.12);
}

.summary-card-title {
    font-size: 0.82rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #64748b;
}

.summary-card-count {
    font-size: 2rem;
    font-weight: 700;
    color: #0f172a;
}

.summary-progress {
    height: 0.5rem;
    border-radius: 0.75rem;
    background: #e2e8f0;
}

.summary-progress .progress-bar {
    border-radius: 0.75rem;
}

.summary-vertical-progress {
    width: 18px;
    height: 110px;
    background: #e2e8f0;
    border-radius: 1rem;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
    box-shadow: inset 0 2px 6px rgba(15, 23, 42, 0.08);
}

.summary-vertical-bar {
    width: 100%;
    background: linear-gradient(180deg, #0d6efd 0%, #3b82f6 100%);
    transition: height 0.3s ease;
}

.hero {
    background: linear-gradient(120deg, rgba(14, 116, 144, 0.95), rgba(8, 145, 178, 0.88));
    color: #fff;
    border-radius: 1rem;
    padding: 1.2rem;
}

.login-hero-logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 16px;
    background: #ffffff;
    padding: 8px;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

@media (max-width: 576px) {
    .hero.d-flex {
        flex-direction: column;
        align-items: flex-start;
    }

    .login-hero-logo {
        width: 56px;
        height: 56px;
    }
}

.dashboard-hero {
    background: linear-gradient(135deg, #0f172a, #0f172a 35%, #0f4d95 100%);
    color: #ffffff;
    border-radius: 1.5rem;
    position: relative;
    overflow: hidden;
}

.dashboard-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top left, rgba(255,255,255,0.18), transparent 28%),
                radial-gradient(circle at bottom right, rgba(59,130,246,0.2), transparent 22%);
    pointer-events: none;
}

.dashboard-hero > .d-flex {
    position: relative;
    z-index: 1;
}

.dashboard-logo-wrap {
    width: 120px;
    height: 120px;
    min-width: 120px;
    border-radius: 1.5rem;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.22);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dashboard-logo {
    max-width: 80px;
    max-height: 80px;
}

.dashboard-hero-label {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.8rem;
    opacity: 0.8;
    margin-bottom: 0.75rem;
}

.dashboard-hero-title {
    font-size: clamp(1.8rem, 2.5vw, 2.8rem);
    line-height: 1.1;
    margin-bottom: 0.75rem;
}

.dashboard-hero-subtitle {
    color: rgba(255,255,255,0.8);
}

.dashboard-hero-stats {
    position: relative;
    z-index: 1;
}

.dashboard-stat-card {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 1rem;
    min-height: 110px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.5rem;
}

.dashboard-stat-value {
    font-size: 2.25rem;
    font-weight: 700;
}

.dashboard-stat-label {
    color: rgba(255,255,255,0.82);
}

.timeline {
    border-left: 3px solid #bae6fd;
    margin-left: 12px;
    padding-left: 20px;
}

.timeline-item {
    position: relative;
    margin-bottom: 16px;
}

.timeline-item::before {
    content: '';
    width: 12px;
    height: 12px;
    background: var(--primary);
    border-radius: 50%;
    position: absolute;
    left: -28px;
    top: 6px;
}

.login-wrap {
    min-height: calc(100vh - 56px);
    display: flex;
    align-items: center;
}

.badge-soft {
    background: #cffafe;
    color: #164e63;
}

.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 12px;
}

.image-preview-card {
    border: 1px solid #dbeafe;
    border-radius: 12px;
    padding: 8px;
    background: #fff;
}

.image-preview-link {
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.image-preview-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
}

.image-preview-card img {
    width: 100%;
    height: 130px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

.image-preview-meta {
    font-size: 0.75rem;
    margin-top: 6px;
    color: #334155;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#dashboard-map,
#map-picker {
    width: 100%;
    height: 420px;
    min-height: 420px;
}

#dashboard-map {
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.05);
}

#dashboard-map .leaflet-container {
    width: 100%;
    height: 100%;
}

.leaflet-control-layers {
    font-size: 0.88rem;
}

#map-picker-selected {
    min-height: 1.4rem;
}

.incident-print-sheet {
    background: #fff;
    border: 1px solid #dbe4ef;
    border-radius: 12px;
    padding: 20px;
}

.print-header {
    border-bottom: 2px solid #0e7490;
    padding-bottom: 10px;
}

.print-title {
    font-size: 1.3rem;
    font-weight: 700;
}

.print-subtitle {
    color: #334155;
    font-size: 0.95rem;
}

.print-meta {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 0.9rem;
}

.print-signature {
    display: grid;
    grid-template-columns: repeat(2, minmax(240px, 1fr));
    gap: 24px;
}

@media (max-width: 576px) {
    .print-signature {
        grid-template-columns: 1fr;
    }
}

.signature-box {
    border-top: 1px dashed #64748b;
    padding-top: 12px;
    font-size: 0.92rem;
    min-height: 210px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
}

.signature-heading {
    font-weight: 600;
    margin-bottom: 8px;
}

.signature-image-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: -6px;
}

.signature-view-image {
    max-width: 240px;
    max-height: 100px;
    display: block;
    margin: 0 auto;
    object-fit: contain;
}

.signature-name,
.signature-subtext,
.signature-date {
    margin-top: 10px;
}

@media print {
    @page {
        size: A4 portrait;
        margin: 12mm;
    }

    body {
        background: #fff !important;
        color: #000;
        min-height: auto;
    }

    .app-nav,
    .no-print {
        display: none !important;
    }

    main.container-fluid {
        padding: 0 !important;
    }

    .incident-print-sheet {
        border: 0;
        border-radius: 0;
        box-shadow: none;
        padding: 0;
    }

    .app-card,
    .print-section {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .timeline {
        border-left: 2px solid #bbb;
    }

    .timeline-item {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .timeline-item::before {
        background: #555;
    }

    .incident-image-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .incident-image-grid > .incident-image-item {
        width: 100% !important;
        max-width: 100% !important;
        flex: none !important;
    }

    .incident-image-grid img {
        width: 100% !important;
        max-height: 95mm;
        object-fit: contain;
        background: #fff;
    }

    .print-signature {
        margin-top: 20px !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }
}
