/* ============================
   LockRoute Pro - Styles
   ============================ */

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #e0e7ff;
    --primary-glow: rgba(79, 70, 229, 0.15);
    --secondary: #0f172a;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg: #f1f5f9;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-glass: rgba(255, 255, 255, 0.6);
    --text: #1e293b;
    --text-light: #64748b;
    --text-muted: #94a3b8;
    --border: rgba(226, 232, 240, 0.8);
    --border-light: rgba(241, 245, 249, 0.8);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 12px 24px rgba(0,0,0,0.08), 0 4px 8px rgba(0,0,0,0.04);
    --radius: 14px;
    --radius-sm: 8px;
    --sidebar-width: 240px;
    --header-height: 56px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Job type colors */
    --job-car: #3b82f6;
    --job-house: #10b981;
    --job-commercial: #8b5cf6;
    --job-emergency: #ef4444;
    --job-other: #6b7280;

    /* Calendar */
    --cal-slot-height: 60px;
    --cal-start-hour: 6;
}

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

html {
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font);
    background: var(--bg);
    background-image: radial-gradient(at 20% 0%, rgba(79, 70, 229, 0.05) 0%, transparent 50%),
                      radial-gradient(at 80% 100%, rgba(16, 185, 129, 0.04) 0%, transparent 50%);
    background-attachment: fixed;
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ---- Animations ---- */
@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- Layout ---- */
#app {
    display: flex;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
#sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #0f172a 0%, #1e1b4b 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 24px;
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.nav-links {
    list-style: none;
    padding: 12px 0;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.25s ease;
    color: rgba(255,255,255,0.6);
    font-size: 14px;
    font-weight: 500;
    border-radius: 0 8px 8px 0;
    margin-right: 8px;
}

.nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.9);
}

.nav-item.active {
    background: rgba(79, 70, 229, 0.25);
    color: #fff;
    border-right: 3px solid var(--primary);
}

.nav-icon { font-size: 18px; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.quick-stats {
    display: flex;
    gap: 16px;
}

.quick-stats .stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.quick-stats .stat-number {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.quick-stats .stat-label {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ---- Mobile Header ---- */
#mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: linear-gradient(135deg, #0f172a, #1e1b4b);
    color: #fff;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 90;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.mobile-title {
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.3px;
}

.icon-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    padding: 10px;
    border-radius: var(--radius-sm);
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover { background: rgba(255,255,255,0.1); }

/* ---- Main Content ---- */
#main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 28px 32px;
    max-width: 1200px;
}

/* ---- Or Divider ---- */
.or-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 18px 0 14px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.or-divider::before,
.or-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ---- Views ---- */
.view { display: none; }
.view.active { display: block; animation: viewFadeIn 0.25s ease; }
@keyframes viewFadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.view-header h1 {
    font-size: 26px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.5px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.date-display {
    font-size: 14px;
    color: var(--text-light);
    font-weight: 500;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    font-family: var(--font);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    box-shadow: 0 2px 8px var(--primary-glow);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #3730a3 100%);
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.3);
    transform: translateY(-1px);
}
.btn-primary:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 1px 4px var(--primary-glow);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { background: var(--bg); border-color: var(--text-muted); }

.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #fef2f2; }

.btn-icon {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
}
.btn-icon:hover { background: var(--bg); }

.btn-lg { padding: 14px 28px; font-size: 15px; font-weight: 600; }

.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ---- Cards ---- */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: box-shadow 0.25s ease, transform 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
}

.card-header h2 {
    font-size: 16px;
    font-weight: 600;
}

/* ---- Badge ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    background: var(--primary-light);
    color: var(--primary);
}

/* ---- Dashboard ---- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.dashboard-grid > .card {
    animation: fadeSlideUp 0.4s ease both;
}

.dashboard-grid > .card:nth-child(2) { animation-delay: 0.05s; }
.dashboard-grid > .card:nth-child(3) { animation-delay: 0.10s; }
.dashboard-grid > .card:nth-child(4) { animation-delay: 0.15s; }

.today-schedule { grid-column: 1; grid-row: 1 / 3; }
.upcoming-jobs { grid-column: 2; grid-row: 1; }
.next-slot { grid-column: 2; grid-row: 2; }
.stats-card { grid-column: 1 / -1; }

/* Timeline */
.timeline {
    padding: 16px 20px;
    max-height: 500px;
    overflow-y: auto;
}

.timeline-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background 0.15s;
    padding-left: 8px;
    padding-right: 8px;
    border-radius: var(--radius-sm);
}

.timeline-item:hover { background: var(--bg); }

.timeline-item:last-child { border-bottom: none; }

.timeline-time {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

.timeline-hour {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.timeline-period {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.timeline-content {
    flex: 1;
}

.timeline-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

.timeline-subtitle {
    font-size: 13px;
    color: var(--text-light);
}

.timeline-meta {
    display: flex;
    gap: 12px;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-muted);
}

.timeline-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
}

.timeline-lunch {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    margin: 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 13px;
    font-style: italic;
}

/* Job type colors */
.job-color-car { background: var(--job-car); }
.job-color-house { background: var(--job-house); }
.job-color-commercial { background: var(--job-commercial); }
.job-color-emergency { background: var(--job-emergency); }
.job-color-other { background: var(--job-other); }

/* Upcoming list */
#upcoming-list {
    padding: 12px 20px;
    max-height: 250px;
    overflow-y: auto;
}

.upcoming-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 8px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}

.upcoming-item:hover { background: var(--bg); }
.upcoming-item:last-child { border-bottom: none; }

.upcoming-date {
    text-align: center;
    min-width: 48px;
    padding: 4px 8px;
    background: var(--primary-light);
    border-radius: var(--radius-sm);
}

.upcoming-day {
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
}

.upcoming-date-num {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-dark);
    line-height: 1;
}

.upcoming-info {
    flex: 1;
}

.upcoming-title {
    font-size: 14px;
    font-weight: 500;
}

.upcoming-detail {
    font-size: 12px;
    color: var(--text-muted);
}

/* Next Slot */
.slot-display {
    padding: 20px;
    text-align: center;
}

.slot-time {
    display: block;
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 4px;
}

.slot-detail {
    font-size: 14px;
    color: var(--text-light);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    padding: 20px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-desc {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 40px;
    display: block;
    margin-bottom: 12px;
}

.empty-state p {
    margin-bottom: 16px;
}

/* ---- Calendar ---- */
.calendar-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cal-title {
    font-size: 16px;
    font-weight: 600;
    min-width: 180px;
    text-align: center;
}

.view-toggle {
    display: flex;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    overflow: hidden;
}

.toggle-btn {
    padding: 6px 16px;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-light);
    font-family: var(--font);
}

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

.calendar-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.cal-header-row {
    display: grid;
    grid-template-columns: 60px repeat(7, 1fr);
    border-bottom: 1px solid var(--border);
}

.cal-day-header {
    padding: 12px 8px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
}

.cal-day-header.today {
    color: var(--primary);
}

.cal-day-header .day-num {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin-top: 2px;
}

.cal-day-header.today .day-num {
    background: var(--primary);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cal-body {
    display: grid;
    grid-template-columns: 60px 1fr;
    max-height: 600px;
    overflow-y: auto;
    scroll-behavior: smooth;
}
.cal-body::-webkit-scrollbar { width: 4px; }
.cal-body::-webkit-scrollbar-track { background: transparent; }
.cal-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.cal-times {
    border-right: 1px solid var(--border);
}

.cal-time-slot {
    height: var(--cal-slot-height);
    padding: 0 8px;
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding-top: 0;
    transform: translateY(-7px);
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    position: relative;
}

.cal-day-column {
    border-right: 1px solid var(--border-light);
    position: relative;
}

.cal-day-column:last-child { border-right: none; }

.cal-hour-line {
    height: var(--cal-slot-height);
    border-bottom: 1px solid var(--border-light);
}

.cal-event {
    position: absolute;
    left: 2px;
    right: 2px;
    border-radius: 4px;
    padding: 4px 6px;
    font-size: 11px;
    font-weight: 500;
    color: #fff;
    cursor: pointer;
    overflow: hidden;
    z-index: 2;
    transition: transform 0.1s, box-shadow 0.1s;
    line-height: 1.3;
}

.cal-event:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-md);
    z-index: 3;
}

.cal-event-title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-event-time {
    font-size: 10px;
    opacity: 0.9;
}

.cal-event.lunch-break {
    background: repeating-linear-gradient(
        45deg,
        #e2e8f0,
        #e2e8f0 4px,
        #f1f5f9 4px,
        #f1f5f9 8px
    );
    color: var(--text-muted);
    font-style: italic;
    border: 1px dashed var(--border);
}

/* Non-working day columns */
.cal-day-header.cal-non-working {
    color: var(--text-muted);
    opacity: 0.45;
}
.cal-day-header.cal-non-working .day-num {
    color: var(--text-muted);
    background: transparent;
}
.cal-day-column.cal-non-working {
    background: repeating-linear-gradient(
        -45deg,
        rgba(148, 163, 184, 0.06),
        rgba(148, 163, 184, 0.06) 8px,
        rgba(148, 163, 184, 0.15) 8px,
        rgba(148, 163, 184, 0.15) 16px
    ) !important;
    opacity: 0.5;
}
.cal-day-column.cal-non-working .cal-hour-line {
    border-bottom-color: rgba(226, 232, 240, 0.2);
}

/* Drag & Drop */
.cal-event.dragging {
    opacity: 0.3 !important;
    cursor: grabbing;
}
.drag-ghost {
    border-radius: var(--radius);
    transition: none;
    cursor: grabbing;
}
.cal-day-column.drag-over {
    background: rgba(59, 130, 246, 0.08) !important;
    opacity: 1 !important;
}
.cal-event[data-job-id] {
    touch-action: none;
    user-select: none;
}

.cal-event.time-block {
    border: 2px dashed rgba(255,255,255,0.4);
    cursor: pointer;
}
.cal-event.time-block:hover {
    opacity: 0.9 !important;
}

.cal-current-time {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--danger);
    z-index: 5;
}

.cal-current-time::before {
    content: '';
    position: absolute;
    left: -4px;
    top: -4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--danger);
}

/* Day View */
.day-view-header {
    text-align: center;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.day-schedule {
    padding: 16px;
    max-height: 600px;
    overflow-y: auto;
}

.day-slot {
    display: flex;
    align-items: stretch;
    min-height: 48px;
    border-bottom: 1px solid var(--border-light);
}

.day-slot-time {
    width: 80px;
    padding: 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    flex-shrink: 0;
}

.day-slot-content {
    flex: 1;
    padding: 8px;
}

.day-slot-job {
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    cursor: pointer;
    transition: transform 0.1s;
}

.day-slot-job:hover { transform: scale(1.01); }

.day-slot-job h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

.day-slot-job p {
    font-size: 12px;
    opacity: 0.9;
}

.day-slot-lunch {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-muted);
    font-style: italic;
    font-size: 13px;
}

/* ---- Form ---- */
.form-container {
    max-width: 700px;
}

.form-section {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    animation: fadeSlideUp 0.4s ease both;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.form-section:nth-child(2) { animation-delay: 0.05s; }
.form-section:nth-child(3) { animation-delay: 0.10s; }
.form-section:nth-child(4) { animation-delay: 0.15s; }
.form-section:nth-child(5) { animation-delay: 0.20s; }

.form-section:hover {
    box-shadow: var(--shadow-md);
    border-color: rgba(79, 70, 229, 0.2);
}
.form-section:focus-within {
    border-color: rgba(79, 70, 229, 0.3);
    box-shadow: var(--shadow-md), 0 0 0 3px rgba(79, 70, 229, 0.06);
}

.form-section h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 18px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 2px 6px var(--primary-glow);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: 6px;
}

.required { color: var(--danger); }

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: var(--font);
    color: var(--text);
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.9);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    transform: translateY(-1px);
    background: #fff;
}

.input-hint {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.postcode-input {
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 700;
    font-size: 20px !important;
    padding: 16px 18px !important;
    text-align: center;
    border-width: 2px !important;
}

.postcode-input:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 4px var(--primary-glow), 0 4px 12px rgba(79, 70, 229, 0.1) !important;
}

/* Suggestions */
.suggestions-box {
    background: linear-gradient(135deg, rgba(224, 231, 255, 0.5) 0%, rgba(238, 242, 255, 0.5) 100%);
    border: 1px solid rgba(165, 180, 252, 0.4);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin: 16px 0;
    backdrop-filter: blur(8px);
}

.suggestions-box h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 10px;
}

.suggestions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.suggestion-chip {
    padding: 7px 16px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(165, 180, 252, 0.4);
    border-radius: 100px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--primary-dark);
}

.suggestion-chip:hover,
.suggestion-chip:active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px var(--primary-glow);
}

.suggestion-chip:active {
    transform: scale(0.97);
}

.suggestion-chip {
    position: relative;
}

.suggestion-chip[title]:not([title=""]):hover::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--secondary);
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 10;
    pointer-events: none;
}

/* Priority */
.priority-selector {
    display: flex;
    gap: 10px;
}

.priority-option {
    cursor: pointer;
}

.priority-option input { display: none; }

.priority-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 600;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.priority-normal { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.priority-urgent { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.priority-emergency { background: #fef2f2; color: #991b1b; border-color: #fecaca; }

.priority-option input:checked + .priority-normal {
    background: var(--success); color: #fff; border-color: var(--success);
}
.priority-option input:checked + .priority-urgent {
    background: var(--warning); color: #fff; border-color: var(--warning);
}
.priority-option input:checked + .priority-emergency {
    background: var(--danger); color: #fff; border-color: var(--danger);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 8px;
}

/* ---- Route Planner ---- */
/* Route Map */
.route-map-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    height: 350px;
    margin-bottom: 20px;
    animation: fadeSlideUp 0.3s ease both;
}
.route-map {
    width: 100%;
    height: 100%;
}
.route-marker {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: #fff;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: transform 0.15s ease;
}
.route-marker:hover { transform: scale(1.15); }
.route-marker.home-marker {
    background: var(--success);
    font-size: 15px;
}

.route-day-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}
.btn-route-nav {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 600;
    color: var(--primary);
    background: white;
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.btn-route-nav:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(67, 56, 202, 0.25);
}
.btn-route-nav:active {
    transform: translateY(0);
}
.route-day-nav .date-input {
    font-weight: 600;
    text-align: center;
}

.route-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
}

.route-list {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.route-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
    position: relative;
    animation: fadeSlideUp 0.3s ease both;
}
.route-item:nth-child(2) { animation-delay: 0.04s; }
.route-item:nth-child(3) { animation-delay: 0.08s; }
.route-item:nth-child(4) { animation-delay: 0.12s; }
.route-item:nth-child(5) { animation-delay: 0.16s; }
.route-item:nth-child(6) { animation-delay: 0.20s; }

.route-item:hover { background: var(--bg); }

.route-number {
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.route-number.home {
    background: var(--success);
}

.route-info {
    flex: 1;
}

.route-info h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

.route-info p {
    font-size: 12px;
    color: var(--text-muted);
}

.route-travel {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    margin: 4px 0 4px 46px;
    font-size: 12px;
    color: var(--text-muted);
}

.route-travel::before {
    content: '';
    width: 2px;
    height: 24px;
    background: var(--border);
    position: absolute;
    left: 29px;
}

.route-connector {
    display: flex;
    align-items: center;
    padding: 2px 0 2px 46px;
    position: relative;
}

.route-connector::before {
    content: '';
    position: absolute;
    left: 29px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.route-connector-text {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.route-lunch {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin: 4px 0 4px 14px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
}

/* Route Summary */
.route-summary .summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    position: sticky;
    top: 24px;
}

.route-summary h3 {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 16px;
    font-weight: 600;
}

.summary-stats {
    padding: 16px 20px;
}

.summary-stat {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
}

.summary-stat:last-child { border-bottom: none; }

.summary-label {
    font-size: 13px;
    color: var(--text-light);
}

.summary-value {
    font-size: 14px;
    font-weight: 600;
}

/* ---- Settings ---- */
.settings-container {
    max-width: 700px;
}

.settings-card {
    margin-bottom: 20px;
}

.settings-body {
    padding: 20px;
}

/* Day Toggles */
.day-toggles {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.day-toggle {
    cursor: pointer;
}

.day-toggle input { display: none; }

.day-toggle span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
    border: 2px solid var(--border);
    color: var(--text-muted);
    transition: all 0.2s;
}

.day-toggle input:checked + span {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input { display: none; }

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 24px;
    cursor: pointer;
    transition: 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* Duration Settings */
.duration-settings {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.duration-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg);
    border-radius: var(--radius-sm);
}
.duration-icon {
    font-size: 16px;
    flex-shrink: 0;
}
.job-label-input {
    flex: 1;
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: var(--font);
    min-width: 0;
}
.job-label-input:focus {
    border-color: var(--primary);
    outline: none;
}

.duration-item select {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: var(--font);
    flex-shrink: 0;
}

.reg-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.reg-input {
    flex: 1;
    padding: 10px 14px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 1px;
    border: 2px solid #fbbf24;
    border-radius: var(--radius-sm);
    background: #fefce8;
    font-family: var(--font);
    text-transform: uppercase;
}
.reg-input:focus {
    outline: none;
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}
.btn-sm {
    padding: 8px 14px;
    font-size: 13px;
}
.vehicle-info {
    margin-top: 8px;
    padding: 10px 12px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: #166534;
    line-height: 1.5;
}

/* ---- Price Input ---- */
.price-input-row {
    display: flex;
    align-items: center;
}
.price-prefix {
    background: var(--bg);
    border: 1px solid var(--border);
    border-right: none;
    padding: 10px 14px;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    font-weight: 600;
    font-size: 16px;
    color: var(--text-light);
}
.price-input {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0 !important;
    flex: 1;
    font-size: 16px;
    font-weight: 600;
}

/* ---- VAT Breakdown ---- */
.vat-breakdown {
    margin-top: 6px;
    padding: 6px 10px;
    background: rgba(99, 102, 241, 0.08);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 500;
}
.vat-earnings-breakdown {
    padding: 8px 16px;
    border-top: 1px solid var(--border);
    margin-top: 8px;
}
.vat-earnings-row {
    display: flex;
    justify-content: space-around;
    font-size: 0.85rem;
    color: var(--text-light);
}

/* ---- Earnings Card ---- */
.earnings-card {
    grid-column: 1 / -1;
}
.stats-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}
.stat-value-earnings {
    color: #059669;
    font-weight: 800;
}

/* ---- Jotter ---- */
.jotter-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 0 20px;
}
.jotter-add-card {
    padding: 20px;
    margin-bottom: 20px;
}
.jotter-add-card textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-family: var(--font);
    font-size: 14px;
    resize: vertical;
    margin-bottom: 12px;
    background: var(--bg-card);
    box-sizing: border-box;
}
.jotter-add-card textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}
.jotter-note {
    padding: 16px 20px;
    margin-bottom: 12px;
}
.jotter-note-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.jotter-note-time {
    font-size: 12px;
    color: var(--text-muted, #9ca3af);
}
.jotter-delete {
    font-size: 22px;
    color: var(--text-muted, #9ca3af);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 6px;
    line-height: 1;
}
.jotter-delete:hover {
    color: #ef4444;
}
.jotter-note-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
}

.date-input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 14px;
}

/* ---- Modal ---- */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
}

.modal-content {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 { font-size: 18px; }

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}

.modal-close:hover { background: var(--bg); color: var(--text); }

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.modal-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
}

.modal-detail-row:last-child { border-bottom: none; }

.modal-detail-label {
    font-size: 13px;
    color: var(--text-muted);
}

.modal-detail-value {
    font-size: 14px;
    font-weight: 500;
}

.modal-notes {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-light);
}

/* ---- Toast ---- */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease;
    min-width: 250px;
}

.toast-success { background: var(--success); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }
.toast-info { background: var(--primary); color: #fff; }

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

/* ---- Job status badges ---- */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
}

.status-scheduled { background: var(--primary-light); color: var(--primary); }
.status-completed { background: #d1fae5; color: #065f46; }
.status-cancelled { background: #fee2e2; color: #991b1b; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    :root {
        --radius: 12px;
        --radius-sm: 8px;
    }

    #sidebar {
        transform: translateX(-100%);
    }

    #sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,0.3);
    }

    #mobile-header {
        display: flex;
    }

    #main-content {
        margin-left: 0;
        padding: 14px;
        padding-top: calc(var(--header-height) + 14px);
    }

    .view-header {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 16px;
        gap: 10px;
    }

    .view-header h1 {
        font-size: 22px;
    }

    .header-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    /* Dashboard */
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .today-schedule { grid-column: 1; grid-row: auto; }
    .upcoming-jobs { grid-column: 1; grid-row: auto; }
    .next-slot { grid-column: 1; grid-row: auto; }
    .stats-card { grid-column: 1; }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 16px;
    }

    /* Form */
    .form-container {
        max-width: 100%;
    }

    .form-section {
        padding: 18px 16px;
        margin-bottom: 14px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .postcode-input {
        font-size: 18px !important;
        padding: 14px 16px !important;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 12px 14px;
        font-size: 16px;  /* prevents iOS zoom on focus */
    }

    .suggestions-box {
        padding: 14px;
        margin: 12px 0;
    }

    .suggestion-chip {
        padding: 10px 18px;
        font-size: 14px;
    }

    .priority-selector {
        flex-wrap: wrap;
        gap: 8px;
    }

    .priority-badge {
        padding: 8px 18px;
    }

    .form-actions {
        flex-direction: column;
        gap: 10px;
    }

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

    .form-actions .btn-lg {
        padding: 16px;
        font-size: 16px;
    }

    /* Route */
    .route-container {
        grid-template-columns: 1fr;
    }

    .route-map-container {
        height: 250px;
        margin-bottom: 14px;
    }

    .route-day-nav {
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
    }

    .btn-route-nav {
        padding: 8px 14px;
        font-size: 13px;
        flex: 1;
        justify-content: center;
        min-width: 0;
    }

    .route-day-nav .date-input {
        order: -1;
        width: 100%;
        text-align: center;
    }

    .route-item {
        padding: 10px;
        gap: 10px;
    }

    .route-number {
        width: 28px;
        height: 28px;
        font-size: 12px;
        flex-shrink: 0;
    }

    /* Calendar */
    .calendar-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .cal-header-row {
        grid-template-columns: 40px repeat(7, minmax(60px, 1fr));
        min-width: 460px;
    }

    .cal-body {
        grid-template-columns: 40px 1fr;
        min-width: 460px;
    }

    .cal-grid {
        grid-template-columns: repeat(7, minmax(60px, 1fr));
    }

    .cal-day-header {
        padding: 8px 4px;
        font-size: 10px;
    }

    .cal-day-header .day-num { font-size: 16px; }

    .cal-event {
        font-size: 10px;
        padding: 2px 4px;
        line-height: 1.2;
    }

    .cal-time-slot {
        font-size: 10px;
        padding: 0 4px;
    }

    /* Reg input */
    .reg-input-row {
        flex-wrap: wrap;
    }

    .reg-input {
        font-size: 16px;
        padding: 10px 12px;
        min-width: 0;
    }

    /* Vehicle info */
    .vehicle-info {
        font-size: 12px;
    }

    /* Settings */
    .duration-settings {
        grid-template-columns: 1fr;
    }

    .duration-item {
        flex-wrap: wrap;
    }

    .job-label-input {
        width: 100%;
    }

    .day-toggles {
        flex-wrap: wrap;
    }

    /* Modal */
    .modal-content {
        width: 95%;
        max-height: 90vh;
        overflow-y: auto;
    }

    /* Toast */
    #toast-container {
        left: 14px;
        right: 14px;
        top: calc(var(--header-height) + 8px);
    }

    .toast {
        min-width: auto;
    }
}

/* Extra small screens */
@media (max-width: 380px) {
    #main-content {
        padding: 10px;
        padding-top: calc(var(--header-height) + 10px);
    }

    .form-section {
        padding: 14px 12px;
    }

    .step-num {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }

    .route-map-container {
        height: 200px;
    }

    .btn-route-nav {
        padding: 6px 10px;
        font-size: 12px;
    }

    .cal-header-row {
        grid-template-columns: 32px repeat(7, 1fr);
    }

    .cal-body {
        grid-template-columns: 32px 1fr;
    }

    .cal-day-header {
        padding: 6px 2px;
        font-size: 9px;
    }

    .cal-day-header .day-num { font-size: 14px; }

    .reg-input {
        font-size: 14px;
        padding: 8px 10px;
    }

    .suggestion-chip {
        padding: 8px 12px;
        font-size: 12px;
    }
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================
   Auth Screen
   ============================ */
#auth-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--secondary) 0%, #1e3a5f 50%, var(--primary-dark) 100%);
    font-family: var(--font);
}

.auth-container {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 400px;
    margin: 1rem;
    box-shadow: var(--shadow-lg);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin-top: 0.5rem;
}

.auth-subtitle {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

#auth-screen .form-group {
    margin-bottom: 1rem;
}

#auth-screen label {
    display: block;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text);
    margin-bottom: 0.35rem;
}

#auth-screen input {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: var(--font);
    transition: border-color 0.2s;
}

#auth-screen input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.btn-block {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.75rem;
    font-size: 1rem;
}

.auth-error {
    color: var(--danger);
    font-size: 0.85rem;
    text-align: center;
    margin-top: 1rem;
    min-height: 1.2em;
}

.auth-toggle {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 1rem;
}

.auth-toggle a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-toggle a:hover {
    text-decoration: underline;
}

/* User info in sidebar */
.user-info {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.user-email {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.6);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-info .btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.7);
    border-color: rgba(255,255,255,0.2);
}

.user-info .btn-sm:hover {
    color: white;
    border-color: rgba(255,255,255,0.4);
}
