/* ============================================================
   Palm Vehicle Violation – PWA Styles  (Dark / Saudi-Green theme)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800&display=swap');


/* ── CSS Variables ── */
:root {
    --vv-green:        #1a3c5e;
    --vv-green-dark:   #122b44;
    --vv-green-glow:   rgba(26, 60, 94, .12);
    --vv-navy:         #1a3c5e;
    --vv-bg:           #f5f7fa;
    --vv-card:         #ffffff;
    --vv-section:      #f4f6f9;
    --vv-input-bg:     #f8f9fb;
    --vv-border:       #dee2e6;
    --vv-input-border: #ced4da;
    --vv-text:         #222222;
    --vv-text-sub:     #666666;
    --vv-text-label:   #444444;
}

/* ---------- Reset / Base ---------- */
.vv-pwa-body {
    background: #f5f7fa;
    min-height: 100vh;
    font-family: 'Tajawal', 'Segoe UI', Arial, sans-serif;
    font-size: 15px;
    color: #222;
    overflow-x: hidden;
}

.vv-pwa-container {
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.vv-input,
.vv-btn-submit,
.vv-btn-toggle-group,
.vv-card,
.vv-card-body,
.vv-field-group {
    box-sizing: border-box;
}

/* ---------- Top Navigation ---------- */
.vv-pwa-nav {
    background: #1a3c5e;
    color: #fff;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0,0,0,.5);
}

.vv-pwa-nav-inner {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: .5px;
    font-family: 'Tajawal', sans-serif;
}

.vv-pwa-nav a {
    color: rgba(255,255,255,.85);
    text-decoration: none;
}

/* ---------- Content ---------- */
.vv-pwa-content {
    flex: 1;
    padding: 16px;
}

/* ---------- Cards ---------- */
.vv-card {
    background: var(--vv-card);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,.10);
    margin-bottom: 16px;
    overflow: hidden;
    border: 1px solid var(--vv-border);
}

.vv-card-header {
    background: #1a3c5e;
    color: #fff;
    padding: 12px 16px;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: .5px;
    font-family: 'Tajawal', sans-serif;
}

.vv-card-body {
    padding: 16px;
}

/* ---------- Form Inputs ---------- */
.vv-field-group {
    margin-bottom: 14px;
}

.vv-label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 5px;
    color: var(--vv-text-label);
}

.vv-input {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--vv-input-border);
    border-radius: 8px;
    font-size: 15px;
    background: var(--vv-input-bg);
    color: var(--vv-text);
    transition: border-color .2s;
    font-family: 'Tajawal', sans-serif;
}

.vv-input::placeholder {
    color: #adb5bd;
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: normal;
    text-transform: none;
}

.vv-input:focus {
    outline: none;
    border-color: #1a3c5e;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(26,60,94,.12);
}

.vv-input option {
    background: #fff;
    color: #222;
}

.vv-input-error {
    border-color: #c0392b !important;
    background: rgba(192,57,43,.1) !important;
}

.vv-textarea {
    resize: vertical;
    min-height: 80px;
}

.vv-hint {
    font-size: 12px;
    color: var(--vv-text-sub);
    margin-top: 4px;
}

.vv-hint-error {
    color: #e74c3c;
    font-weight: 600;
}

/* ---------- Plate Type Toggle ---------- */
.vv-btn-toggle {
    display: flex;
    border-radius: 8px;
    overflow: hidden;
    border: 1.5px solid var(--vv-green);
}

.vv-toggle-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: #f8f9fb;
    color: #1a3c5e;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background .2s, color .2s;
    font-family: 'Tajawal', sans-serif;
}

.vv-toggle-btn.active {
    background: var(--vv-green);
    color: #fff;
}

/* ---------- KSA Plate Preview ---------- */
.vv-plate-input {
    font-family: 'Courier New', monospace;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 2px;
}

.vv-ksa-plate-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.vv-plate-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--vv-input-bg);
    border: 3px solid var(--vv-green);
    border-radius: 8px;
    padding: 12px 20px;
    font-family: 'Courier New', monospace;
    font-size: 24px;
    font-weight: 900;
    letter-spacing: 5px;
    color: #1a3c5e;
    min-height: 56px;
    margin-bottom: 12px;
    text-align: center;
}

.vv-section-group {
    background: var(--vv-section);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 4px;
    border: 1px solid var(--vv-border);
}

/* ---------- Plate Color ---------- */
.vv-plate-color-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 6px;
}
.vv-plate-color-swatch {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    border: 2px solid transparent;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .15s, transform .1s;
}
.vv-plate-color-swatch input { display: none; }
.vv-plate-color-swatch.selected,
.vv-plate-color-swatch:has(input:checked) { border-color: #00cc66; transform: scale(1.04); }
.vv-swatch-white  { background: #f5f5f5; color: #333; }
.vv-swatch-blue   { background: #1565C0; color: #fff; }
.vv-swatch-yellow { background: #F9A825; color: #333; }
.vv-swatch-green  { background: #2E7D32; color: #fff; }
.vv-swatch-red    { background: #c62828; color: #fff; }

/* ---------- Plate Badges ---------- */
.vv-plate-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    border: 2px solid transparent;
    letter-spacing: .5px;
}
.vv-plate-white  { background: #f5f5f5; color: #333; border-color: #ccc; }
.vv-plate-blue   { background: #1565C0; color: #fff; border-color: #0d47a1; }
.vv-plate-yellow { background: #F9A825; color: #333; border-color: #e65100; }
.vv-plate-green  { background: #2E7D32; color: #fff; border-color: #1b5e20; }
.vv-plate-red    { background: #c62828; color: #fff; border-color: #b71c1c; }

.vv-color-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    margin-top: 4px;
    border: 2px solid transparent;
}
.vv-color-indicator.color-white  { background: #f5f5f5; color: #333; border-color: #ccc; }
.vv-color-indicator.color-blue   { background: #1565C0; color: #fff; border-color: #0d47a1; }
.vv-color-indicator.color-yellow { background: #F9A825; color: #333; border-color: #e65100; }
.vv-color-indicator.color-green  { background: #2E7D32; color: #fff; border-color: #1b5e20; }
.vv-color-indicator.color-red    { background: #c62828; color: #fff; border-color: #b71c1c; }

/* ---------- Violation Chips ---------- */
.vv-violations-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
}

.vv-violation-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1.5px solid var(--vv-border);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    user-select: none;
    background: var(--vv-input-bg);
    color: var(--vv-text);
}

.vv-violation-chip:hover {
    border-color: var(--vv-green);
    background: var(--vv-section);
}

.vv-violation-check {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #1a3c5e;
    flex-shrink: 0;
}

.vv-violation-chip:has(.vv-violation-check:checked) {
    border-color: var(--vv-green);
    background: var(--vv-green-glow);
}

.vv-chip-code {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    font-weight: 700;
    background: #1a3c5e;
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    min-width: 32px;
    text-align: center;
    flex-shrink: 0;
}

.vv-chip-name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: var(--vv-text);
}

.vv-chip-fine {
    font-size: 13px;
    font-weight: 700;
    color: #c62828;
    flex-shrink: 0;
}

/* ---------- Fine Total Bar ---------- */
.vv-fine-total-bar {
    background: rgba(26,60,94,.07);
    border: 1.5px solid #1a3c5e;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 15px;
    margin-bottom: 8px;
    text-align: center;
    color: #1a3c5e;
    font-weight: 700;
}

/* ---------- Section Titles ---------- */
.vv-section-title {
    font-size: 11px;
    font-weight: 800;
    color: #1a3c5e;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin: 20px 0 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid #1a3c5e;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Tajawal', sans-serif;
}

/* ---------- Photo Grid ---------- */
.vv-photo-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 8px;
}

.vv-photo-slot {
    position: relative;
    border: 2px dashed #adb5bd;
    border-radius: 10px;
    overflow: hidden;
    background: var(--vv-section);
    cursor: pointer;
    transition: border-color .2s;
    min-height: 120px;
    display: flex;
    flex-direction: column;
}

.vv-photo-slot.has-photo {
    border-color: var(--vv-green);
    border-style: solid;
}

.vv-photo-slot.missing {
    border-color: #e74c3c;
}

.vv-photo-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 2;
}

.vv-photo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    color: #555;
    padding: 16px 8px;
    text-align: center;
    pointer-events: none;
}

.vv-photo-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    inset: 0;
    border-radius: 8px;
}

.vv-photo-label {
    background: rgba(26,60,94,.85);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    padding: 4px;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 3;
    pointer-events: none;
}

/* ---------- Submit Button ---------- */
.vv-btn-submit {
    display: block;
    width: 100%;
    padding: 14px;
    background: var(--vv-navy);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    margin-top: 12px;
    transition: background .2s, transform .1s;
    letter-spacing: .5px;
    font-family: 'Tajawal', sans-serif;
}

.vv-btn-submit:hover {
    background: #122b44;
    color: #fff;
    transform: translateY(-1px);
}

.vv-btn-submit:active {
    transform: translateY(0);
}

/* ---------- Alerts ---------- */
.vv-alert {
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 14px;
    background: #fff3f3;
    border: 1px solid #e57373;
    color: #c62828;
    padding: 10px 14px;
}

/* ---------- Success Page ---------- */
.vv-success-icon {
    margin-top: 16px;
}

.vv-summary-box {
    background: var(--vv-section);
    border-radius: 8px;
    padding: 12px 16px;
    margin: 16px 0;
    text-align: left;
    border: 1px solid var(--vv-border);
}

/* ---------- Nav Actions ---------- */
.vv-nav-actions {
    display: flex;
    gap: 4px;
}

.vv-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    color: rgba(255,255,255,.85);
    text-decoration: none;
    font-size: 16px;
    transition: background .15s;
}

.vv-nav-btn:hover {
    background: rgba(255,255,255,.15);
    color: #fff;
}

.vv-nav-back {
    display: flex;
    align-items: center;
    color: rgba(255,255,255,.85);
    text-decoration: none;
    padding-right: 10px;
    font-size: 16px;
}

/* ---------- GPS Button ---------- */
.vv-gps-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin-top: 8px;
    padding: 12px 16px;
    background: var(--vv-green-glow);
    border: 1.5px dashed var(--vv-green);
    border-radius: 8px;
    color: #1a3c5e;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
    font-family: 'Tajawal', sans-serif;
}
.vv-gps-icon-btn i { font-size: 22px; }
.vv-gps-icon-btn:active,
.vv-gps-icon-btn:hover { background: rgba(26,60,94,.18); }

/* ---------- Two-column layout ---------- */
.vv-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* ---------- History Items ---------- */
.vv-history-item {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid var(--vv-border);
    padding: 14px 16px;
    gap: 12px;
}

.vv-history-item:last-child { border-bottom: none; }
.vv-history-main { flex: 1; min-width: 0; }

.vv-history-ref {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.vv-history-ref-num {
    font-weight: 700;
    font-size: 14px;
    color: #1a3c5e;
    font-family: 'Courier New', monospace;
}

.vv-history-state {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.vv-state-draft     { background: #e3f2fd; color: #1565c0; border:1px solid #90caf9; }
.vv-state-confirmed { background: #e8f5e9; color: #2e7d32; border:1px solid #a5d6a7; }
.vv-state-appealed  { background: #fff3e0; color: #e65100; border:1px solid #ffcc80; }
.vv-state-closed    { background: #f5f5f5; color: #616161; border:1px solid #bdbdbd; }

.vv-history-plate {
    font-size: 15px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--vv-text);
}

.vv-history-meta {
    font-size: 12px;
    color: var(--vv-text-sub);
    margin-bottom: 4px;
}

.vv-history-fine {
    font-size: 13px;
    color: var(--vv-text);
}

.vv-history-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: center;
}

.vv-hist-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    font-size: 15px;
    text-decoration: none;
    transition: opacity .15s;
}

.vv-hist-btn:hover { opacity: .8; }
.vv-hist-btn-print   { background: #e3f0fb; color: #1a3c5e; border:1px solid #b0c9e8; }
.vv-hist-btn-sticker { background: #e8eaf6; color: #1565c0; border:1px solid #9fa8da; }
.vv-hist-btn-appeal  { background: #fff3e0; color: #e65100; border:1px solid #ffcc80; }

.vv-history-count {
    font-size: 12px;
    font-weight: 400;
    opacity: .8;
}

/* ---------- History search / filter – collapsible panel ---------- */
.vv-hist-panel {
    margin-bottom: 12px;
    border-radius: 10px;
    overflow: hidden;
    border: 1.5px solid #dde3ec;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.vv-hist-panel-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 16px;
    background: #1a3c5e;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: .85rem;
    font-weight: 700;
    letter-spacing: .3px;
    text-align: left;
}
.vv-hist-panel-toggle:hover { background: #15324f; }
.vv-hist-chevron {
    font-size: .8rem;
    transition: transform .2s;
}
.vv-hist-active-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 10px;
    background: #f9a825;
    color: #1a3c5e;
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .3px;
    text-transform: uppercase;
    vertical-align: middle;
}
.vv-hist-search-form {
    padding: 14px 14px 4px;
}
.vv-hist-date-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin: 10px 0 12px;
}
.vv-hist-date-group { flex: 1; }
.vv-hist-date-label {
    display: block;
    font-size: .7rem;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    letter-spacing: .4px;
    margin-bottom: 3px;
}
.vv-hist-date-input {
    margin-bottom: 0 !important;
    font-size: .82rem !important;
    padding: 7px 10px !important;
}
.vv-hist-btn-row {
    display: flex;
    gap: 8px;
    padding-bottom: 14px;
    flex-wrap: wrap;
}
.vv-hist-action-btn {
    flex: 1;
    min-width: 90px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: .84rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    text-align: center;
    text-decoration: none !important;
    transition: background .18s, box-shadow .18s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.vv-hist-btn-search {
    background: #1a3c5e;
    color: #fff !important;
    box-shadow: 0 2px 6px rgba(26,60,94,.25);
}
.vv-hist-btn-search:hover { background: #0d2642; }
.vv-hist-btn-filter {
    background: #e8f0f8;
    color: #1a3c5e !important;
    border: 1.5px solid #b8cfe8;
}
.vv-hist-btn-filter:hover { background: #d0e4f5; }
.vv-hist-btn-clear {
    background: #fff5f5;
    color: #c62828 !important;
    border: 1.5px solid #f5c2c2;
    flex: 0 0 auto;
    min-width: unset;
    padding: 10px 16px;
}
.vv-hist-btn-clear:hover { background: #fde8e8; }

/* ---------- Footer ---------- */
.vv-pwa-footer {
    text-align: center;
    color: var(--vv-text-sub);
    font-size: 12px;
    padding: 12px;
    border-top: 1px solid var(--vv-border);
    background: var(--vv-card);
}

/* ---------- Backend – Photo Widget ---------- */
.vv-photo-widget {
    border: 2px dashed #444;
    border-radius: 8px;
    display: inline-block;
}

/* ---------- Responsive ---------- */
@media (max-width: 360px) {
    .vv-photo-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .vv-photo-slot { min-height: 100px; }
}

@media (min-width: 600px) {
    .vv-pwa-content { padding: 24px; }
    .vv-photo-grid { grid-template-columns: 1fr 1fr 1fr 1fr; }
}

@media (max-width: 480px) {
    .vv-dash-grid {
        grid-template-columns: 1fr !important;
        gap: 10px;
        padding: 10px;
    }
    .vv-tile {
        padding: 18px 14px;
        flex-direction: row;
        justify-content: flex-start;
        gap: 14px;
        text-align: left;
    }
    .vv-tile-icon { width: 44px; height: 44px; font-size: 1.2rem; flex-shrink: 0; }
    .vv-stats-row { grid-template-columns: 1fr 1fr !important; gap: 6px; padding: 10px; }
    .vv-dash-hero { padding: 20px 14px 16px !important; }
    .vv-dash-hero h1 { font-size: 1rem !important; }
    .vv-card { border-radius: 8px; margin-bottom: 10px; }
    .vv-card-body { padding: 14px; }
    .vv-card-header { padding: 12px 14px; font-size: 0.9rem; }
    .vv-input { padding: 10px 12px; font-size: 15px; }
    .vv-btn-submit { padding: 13px; font-size: 0.95rem; }
    .vv-two-col { grid-template-columns: 1fr !important; }
    .vv-pwa-nav-inner { padding: 0 12px; }
    .vv-history-item { flex-wrap: wrap; }
    .vv-history-meta { flex-wrap: wrap; gap: 4px; }
    .vv-btn-toggle { flex: 1; padding: 10px 8px; font-size: 0.8rem; }
}

@media (max-width: 360px) {
    .vv-dash-grid { padding: 8px; gap: 8px; }
    .vv-tile-label { font-size: 0.82rem; }
    .vv-tile-desc  { font-size: 0.7rem; }
}
