/* ─── Variables ──────────────────────────────────────────────────────────── */
:root {
    --bg: #f5f5f5;
    --white: #ffffff;
    --text-main: #1a1a1a;
    --text-muted: #6b7280;
    --text-header: var(--text-main);
    --text-header-muted: var(--text-muted);
    --primary: #0056b3;
    --primary-hover: #004494;
    --header-bg: #ffffff;
    --border: #e5e7eb;
    --radius: 8px;
    --shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Montserrat', sans-serif;
    background-color: var(--bg);
    color: var(--text-main);
    line-height: 1.5;
}

.hidden { display: none !important; }
.site-header { display: none; }

/* ─── Test Phase Warning ─────────────────────────────────────────────────── */
.test-phase-warning {
    color: #1d4ed8;
    padding: 10px 20px;
    margin: 10px auto 0 auto;
    font-size: 0.95rem;
    font-weight: 700;
    text-align: center;
    line-height: 1.4;
    display: block;
    width: 100%;
}

/* ─── Wizard Container ───────────────────────────────────────────────────── */
.wizard-container {
    max-width: 500px;
    margin: 40px auto;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    min-height: 400px;
    overflow: hidden;
    position: relative;
}

/* ─── Header ─────────────────────────────────────────────────────────────── */
.wizard-header {
    padding: 24px 40px;
    background-color: var(--header-bg);
    color: var(--text-header);
    border-bottom: 1px solid var(--border);
    transition: padding 0.2s;
}
.wizard-header.header-compact { padding: 16px 40px; }

.logo-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 24px;
    transition: margin-bottom 0.2s;
}
.wizard-header.header-compact .logo-container { margin-bottom: 0; }

.brand-group { display: flex; align-items: center; gap: 12px; }
.header-logo { height: 32px; width: auto; }

.service-title { font-size: 24px; font-weight: 700; margin-bottom: 12px; }
.service-description { color: var(--text-header-muted); font-size: 14px; margin-bottom: 0; opacity: 0.9; }

/* ─── Wizard Content ─────────────────────────────────────────────────────── */
.wizard-content {
    flex: 1;
    padding: 16px 40px;
    display: flex;
    flex-direction: column;
}

.wizard-step {
    flex: 1;
    animation: fadeIn 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

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

.step-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 16px;
}

#step1b { padding-top: 0; }
#step1b .step-header-row { margin-bottom: 0; }
#step1b .step-title { margin: 0; }

.user-info-display { display: flex; flex-direction: column; }
.user-info-display .step-title { margin-bottom: 2px; font-size: 1.4rem; }

.user-phone {
    font-size: 1.4rem;
    color: var(--primary);
    margin: 0;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
.user-phone:hover { text-decoration: underline; }
.user-phone i { font-size: 0.9rem; opacity: 0.7; }

.step-desc { color: var(--text-muted); margin-top: 0; margin-bottom: 24px; font-size: 14px; }

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.cta {
    background: var(--primary);
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 24px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.cta:hover { background: var(--primary-hover); }
.cta:disabled { background: #ccc; cursor: not-allowed; }

.cta-outline { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.cta-outline:hover { background: #f0f7ff; }

.cta-danger { background-color: #ef4444; }
.cta-danger:hover { background-color: #dc2626; }

.cta-secondary { background-color: #94a3b8; }
.cta-secondary:hover { background-color: #64748b; }

.back-link {
    background: none;
    border: none;
    color: var(--primary);
    font-weight: 600;
    padding: 8px 12px;
    margin-left: -12px;
    cursor: pointer;
    font-family: inherit;
    font-size: 15px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: var(--radius);
    transition: background-color 0.2s;
}
.back-link:hover { background-color: #f0f7ff; }
.back-link::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-left: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
}
.back-link:hover::before { transform: rotate(45deg) translate(2px, 2px); }

.step-nav { display: none; }

.logout-link, .return-link {
    background: none;
    border: 1px solid #e2e8f0;
    color: #64748b;
    font-weight: 500;
    padding: 6px 16px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    border-radius: 20px;
    transition: all 0.2s;
}
.logout-link:hover, .return-link:hover {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
    color: #1e293b;
}

/* ─── Spinner ────────────────────────────────────────────────────────────── */
.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(0, 86, 179, 0.1);
    border-radius: 50%;
    border-top: 3px solid var(--primary);
    animation: spin 1s linear infinite;
    vertical-align: middle;
}
.spinner-large { width: 48px; height: 48px; border-width: 4px; border-top-width: 4px; }
@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ─── Forms ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }

label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }

input[type="text"],
input[type="email"],
input[type="tel"] {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
}

.error-msg { color: #ef4444; font-size: 13px; margin-top: 8px; }
.help-text { font-size: 14px; color: var(--text-muted); text-align: center; margin: 20px 0; }

/* ─── Calendar (Step 3) ──────────────────────────────────────────────────── */
.selection-layout { display: flex; justify-content: center; width: 100%; }
.calendar-wrapper { width: 100%; max-width: 500px; display: flex; justify-content: center; }

/* ─── Timeslots (Step 4) ─────────────────────────────────────────────────── */
.slots-wrapper { width: 100%; }
.slots-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; }

.timeslot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.timeslot {
    border: 1px solid var(--primary);
    background: white;
    color: var(--primary);
    padding: 12px;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.timeslot:hover { background: #f0f7ff; }
.timeslot[aria-pressed="true"] { background: var(--primary); color: white; }

/* ─── Footer ─────────────────────────────────────────────────────────────── */
.wizard-footer { margin-top: auto; padding-top: 40px; font-size: 12px; color: var(--text-muted); text-align: center; }
.wizard-footer a { color: inherit; }

/* ─── Dialogs ────────────────────────────────────────────────────────────── */
.dialog {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.dialog-content {
    background: white;
    padding: 30px;
    border-radius: var(--radius);
    text-align: center;
    max-width: 400px;
    min-width: 200px;
}
.dialog-content h3 { margin-top: 0; margin-bottom: 20px; color: var(--primary); font-size: 24px; }
.dialog-icon { margin-bottom: 20px; display: flex; justify-content: center; }
.dialog-content p { margin-bottom: 15px; font-size: 16px; color: var(--text-main); }
.dialog-actions { display: flex; gap: 12px; justify-content: center; margin-top: 24px; }
#dialogOkBtn { min-width: 120px; }

.vehicle-reg-display {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary);
    margin: 20px 0;
    padding: 10px;
    background: #f0f7ff;
    border-radius: 8px;
    letter-spacing: 1px;
}

.notice-box {
    background: #f0f7ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
    padding: 16px;
    font-size: 14px;
    color: var(--text-main);
    margin-bottom: 16px;
}

/* ─── Google Auth ────────────────────────────────────────────────────────── */
.google-auth-section { margin-top: 1.5rem; display: flex; flex-direction: column; align-items: center; gap: 1rem; }

.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: #374151;
    transition: all 0.2s;
    width: 100%;
}
.google-btn:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); border-color: #cbd5e1; background-color: #f8fafc; }

.google-btn-large { padding: 1rem 2rem; font-size: 1.1rem; border-radius: 12px; background-color: #ffffff; border: 2px solid #e2e8f0; }
.google-btn-large:hover { border-color: var(--primary); color: var(--primary); }

.google-user { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; font-size: 0.95rem; color: #374151; font-weight: 500; }

/* ─── Vehicle Type Selection ─────────────────────────────────────────────── */
.vehicle-type-selection { display: flex; gap: 1.5rem; justify-content: center; margin: 2.5rem 0; }

.vehicle-option {
    flex: 1;
    max-width: 160px;
    min-width: 0;
    padding: 1.5rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    background: var(--white);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}
.vehicle-option:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.vehicle-option.selected { border-color: var(--primary); background: #f0f7ff; box-shadow: 0 4px 12px rgba(0, 86, 179, 0.1); }

.vehicle-option .icon-container { width: 80px; height: 80px; display: flex; align-items: center; justify-content: center; }
.vehicle-option svg { width: 64px; height: 64px; fill: var(--text-muted); transition: fill 0.2s; }
.vehicle-option.selected svg { fill: var(--primary); }
.vehicle-option .label { font-weight: 600; color: var(--text-main); font-size: 1rem; }
#type_option_truck .label { font-size: 0.9rem; word-break: keep-all; white-space: normal; }

/* ─── Add Vehicle ────────────────────────────────────────────────────────── */
.add-vehicle-section { border-bottom: 1px solid var(--border); padding-bottom: 12px; }

.add-vehicle-form {
    background: #f8fafc;
    padding: 20px;
    border-radius: 8px;
    border: 1px dashed #cbd5e1;
    margin-top: 16px;
    transition: all 0.3s ease;
}
.hidden-form { display: none; }

.toggle-add-vehicle {
    background: none;
    border: none;
    color: var(--primary);
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color 0.2s;
}
.toggle-add-vehicle:hover { color: var(--primary-hover); }
.toggle-add-vehicle.active { color: var(--text-main); }
.toggle-icon { font-size: 20px; line-height: 1; }

/* ─── Status Legend ──────────────────────────────────────────────────────── */
.status-legend { display: flex; gap: 16px; margin-bottom: 20px; padding: 10px 16px; background: #f8fafc; border-radius: 8px; border: 1px solid #e2e8f0; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); }
.legend-dot { width: 12px; height: 12px; border-radius: 50%; border: 1px solid #e2e8f0; }
.legend-dot.status-yellow { background: #fef9c3; border-color: #facc15; }
.legend-dot.status-green  { background: #f0fdf4; border-color: #22c55e; }

/* ─── Vehicle List ───────────────────────────────────────────────────────── */
.vehicle-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 30px; }

.vehicle-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
    width: 100%;
}
.vehicle-item.clickable { cursor: pointer; }
.vehicle-item.has-slot  { cursor: default; }

.vehicle-item-content { display: flex; align-items: center; gap: 16px; }
.vehicle-type-icon { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.vehicle-type-icon svg { width: 28px; height: 28px; fill: var(--text-muted); }
.vehicle-item.clickable:hover .vehicle-type-icon svg { fill: var(--primary); }
.vehicle-info { display: flex; flex-direction: column; align-items: flex-start; }

.vehicle-item.clickable:hover {
    border-color: var(--primary);
    background: #f0f7ff;
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

.vehicle-item.status-yellow { background: #fef9c3; border-color: #facc15; }
.vehicle-item.clickable.status-yellow:hover { background: #fef08a; border-color: #eab308; }
.vehicle-item.status-green  { background: #f0fdf4; border-color: #22c55e; }
.vehicle-item.clickable.status-green:hover  { background: #dcfce7; border-color: #16a34a; }
.vehicle-item.status-green .vehicle-reg { color: #15803d; }

.vehicle-delete-btn {
    background: none;
    border: none;
    color: #ef4444;
    padding: 8px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.vehicle-delete-btn:hover { background-color: #fee2e2; color: #dc2626; }

.vehicle-reg { font-size: 20px; font-weight: 800; color: var(--primary); margin-bottom: 4px; letter-spacing: 0.5px; }
.vehicle-type { font-size: 14px; color: var(--text-muted); }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .wizard-container { margin: 0; border-radius: 0; box-shadow: none; width: 100%; max-width: 100%; }
    .wizard-header, .wizard-content { padding: 24px; }
    .form-grid { grid-template-columns: 1fr; }
}

/* ─── Flatpickr Overrides ────────────────────────────────────────────────── */
.flatpickr-calendar {
    width: 100% !important;
    max-width: 450px !important;
    font-family: inherit !important;
    padding: 16px !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow) !important;
}

/* Centered month header */
.flatpickr-months {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    height: 48px !important;
}
.flatpickr-months .flatpickr-month {
    flex: 1 !important;
    height: 48px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
.flatpickr-current-month {
    position: static !important;
    width: 100% !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    pointer-events: none !important;
}
/* Fix internal floats that break flex centering */
.flatpickr-current-month span.cur-month,
.flatpickr-current-month .numInputWrapper { float: none !important; display: inline-block !important; }
.flatpickr-current-month .numInputWrapper .arrowUp,
.flatpickr-current-month .numInputWrapper .arrowDown { display: none !important; }
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year {
    appearance: none !important;
    -webkit-appearance: none !important;
    border: none !important;
    background: transparent !important;
    font-family: inherit !important;
    font-size: inherit !important;
    font-weight: 700 !important;
    color: var(--text-main) !important;
    padding: 0 !important;
    margin: 0 !important;
    cursor: default !important;
}

/* Prev/Next arrows */
.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: var(--primary) !important;
    fill: var(--primary) !important;
}
.flatpickr-months .flatpickr-prev-month { left: 4px !important; }
.flatpickr-months .flatpickr-next-month { right: 4px !important; }
.flatpickr-months .flatpickr-prev-month:hover,
.flatpickr-months .flatpickr-next-month:hover { color: var(--primary-hover) !important; fill: var(--primary-hover) !important; }

/* Weekdays */
.flatpickr-weekday { font-size: 13px !important; font-weight: 600 !important; color: var(--text-muted) !important; text-transform: uppercase !important; }

/* Days */
.flatpickr-day {
    font-size: 20px !important;
    height: 44px !important;
    line-height: 44px !important;
    font-weight: 500 !important;
    border-radius: var(--radius) !important;
    color: var(--text-main) !important;
    width: 20% !important;
    max-width: 20% !important;
    flex-basis: 20% !important;
}
.flatpickr-day.nextMonthDay {
    visibility: hidden !important;
}
.flatpickr-day:hover                      { background: #f0f7ff !important; color: var(--primary) !important; border-color: transparent !important; }
.flatpickr-day.today                      { border-color: var(--primary) !important; color: var(--primary) !important; font-weight: 700 !important; }
.flatpickr-day.selected                   { background: var(--primary) !important; color: white !important; border-color: var(--primary) !important; }
.flatpickr-day.flatpickr-disabled,
.flatpickr-day.flatpickr-disabled:hover   { background: transparent !important; color: #d1d5db !important; cursor: not-allowed !important; border-color: transparent !important; opacity: 0.5 !important; }

/* Hide weekend column headers (hr locale: Mon first → Sat=6th, Sun=7th) */
.flatpickr-weekdaycontainer .flatpickr-weekday:nth-child(6),
.flatpickr-weekdaycontainer .flatpickr-weekday:nth-child(7) { display: none !important; }

/* 5-column day grid */
.dayContainer {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
}
.flatpickr-day.weekend-day {
    display: none !important;
}