/* === SHARED STYLES (from schedule.php) === */
:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #38bdf8;
    --border-color: rgba(255, 255, 255, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.03);
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    /* Changed from 20px for full-width layout */
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* === SPLIT LAYOUT === */
.main-wrapper {
    display: flex;
    flex: 1;
    height: 100%;
    overflow: hidden;
}

.left-panel {
    width: 67%;
    /* Slightly larger for schedule */
    padding: 20px;
    overflow-y: auto;
    border-right: 1px solid var(--border-color);
    box-sizing: border-box;
}

.right-panel {
    width: 33%;
    display: flex;
    flex-direction: column;
    background: #000;
    /* Darker bg for map context */
}

/* === UI ELEMENTS (Headers, Filters) === */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    background: var(--glass-bg);
    padding: 15px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
}

h1 {
    margin: 0;
    font-weight: 600;
    font-size: 1.2rem;
    background: linear-gradient(90deg, #38bdf8, #818cf8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

.nav-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.nav-btn:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.current-range {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.filter-bar {
    background: var(--card-bg);
    padding: 10px;
    margin-bottom: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.filter-label {
    font-weight: 600;
    color: var(--accent-color);
    font-size: 0.9rem;
    margin-right: 5px;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 8px;
    border-radius: 4px;
}

.filter-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* === CALENDAR GRID === */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    /* Base: 5 weekdays + unscheduled. JS adjusts when optional columns are toggled on */
    gap: 10px;
}

.column-header {
    text-align: center;
    padding: 8px;
    background: var(--glass-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 10px;
}

.day-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--accent-color);
    display: block;
}

.day-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.items-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.schedule-item {
    background: var(--card-bg);
    border-left: 4px solid var(--item-color);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: transform 0.2s;
    cursor: pointer;
}

.schedule-item:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.05);
}

.item-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 2px;
    display: block;
}

.item-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.item-assigned {
    font-size: 0.75rem;
    color: #fbbf24;
    margin-top: 5px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 3px;
}

.item-address {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 4px;
    font-style: italic;
    opacity: 0.9;
}

/* === COMPLETION CHECKBOX === */
.item-top-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 2px;
}

.item-top-row .item-title {
    margin-bottom: 0;
    flex: 1 1 auto;
}

.cb-label {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.complete-cb {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #34d399;
    margin: 1px 0 0 0;
}

.complete-cb:disabled {
    opacity: 0.5;
    cursor: wait;
}

.item-time {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-bottom: 3px;
}

.schedule-item.completed {
    opacity: 0.55;
}

.schedule-item.completed .item-title {
    text-decoration: line-through;
}

.column.unscheduled .column-header {
    background: rgba(231, 76, 60, 0.1);
    border-color: rgba(231, 76, 60, 0.2);
}

.column.unscheduled .day-name {
    color: #e74c3c;
}

/* === MAP TOOLBAR === */
.map-controls {
    padding: 8px 10px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.toolbar-row {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.ac-suggestions {
    position: relative;
    flex: 1;
}

.map-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    color: white;
    padding: 8px 10px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.85rem;
    box-sizing: border-box;
}

.map-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.15);
}

.map-btn {
    background: var(--accent-color);
    border: none;
    color: black;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    white-space: nowrap;
    transition: background 0.15s;
}

.map-btn:hover {
    background: #0ea5e9;
}

/* Region dropdown */
.toolbar-select {
    padding: 7px 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 6px;
    font-size: 0.82rem;
    font-family: inherit;
    cursor: pointer;
}

.toolbar-select:focus {
    outline: none;
    border-color: var(--accent-color);
}

/* Pushes the gasket group to the right */
.toolbar-spacer {
    flex: 1;
}

/* Days + Gasket Violations grouped together */
.toolbar-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.toolbar-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    font-weight: 500;
}

.toolbar-num-input {
    width: 52px;
    padding: 6px 4px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 6px;
    text-align: center;
    font-size: 0.82rem;
    font-family: inherit;
}

.toolbar-num-input:focus {
    outline: none;
    border-color: #f59e0b;
}

/* Gasket Violations button — amber/red accent */
.map-btn-gasket {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid #f59e0b;
    color: #f59e0b;
    font-weight: 600;
    padding: 7px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.82rem;
    white-space: nowrap;
    transition: all 0.15s;
}

.map-btn-gasket:hover {
    background: rgba(245, 158, 11, 0.25);
    color: #fbbf24;
    border-color: #fbbf24;
}

.ac-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1e293b;
    border: 1px solid var(--border-color);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    border-radius: 0 0 8px 8px;
}

.ac-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
}

.ac-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

#map {
    flex: 1;
    width: 100%;
    height: 100%;
    background: #0f172a;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* === ZOOM MAP MODE === */
body.map-zoomed .left-panel {
    display: none !important;
}

body.map-zoomed .right-panel {
    width: 100% !important;
    display: grid;
    grid-template-columns: 66% 34%;
    grid-template-rows: auto 1fr;
    height: 100vh;
}

body.map-zoomed .map-controls {
    grid-column: 1 / -1;
    grid-row: 1 / 2;
}

body.map-zoomed #map {
    grid-column: 1 / 2;
    grid-row: 2 / 3;
    height: 100% !important;
}

body.map-zoomed #zipResultsContainer {
    grid-column: 2 / 3;
    grid-row: 2 / 3;
    height: 100% !important;
    display: block !important;
    border-left: 1px solid var(--border-color);
    background: #0f172a;
}

/* ══════════════════════════════════════════════════════
   COMPACT MODE — toggled by body.compact-mode
   Layout: [badge] [initials] [title … wraps] [✓]
   Badge and initials sit inline inside item-top-row,
   left of the title. Checkbox stays top-right as always.
══════════════════════════════════════════════════════ */

/* Hidden in verbose mode (outside body.compact-mode) */
.item-compact-badge,
.item-compact-initials {
    display: none;
}

/* ── Compact card: tighter padding, keep block layout ───── */
body.compact-mode .schedule-item {
    padding: 5px 8px 4px;
    border-radius: 5px;
    border-left-width: 3px;
}

/* item-top-row: add a small gap so badge / initials / title space out */
body.compact-mode .item-top-row {
    gap: 4px;
    align-items: flex-start;
    /* checkbox naturally floats to top-right */
}

/* item-title: slightly smaller, wraps naturally */
body.compact-mode .item-title {
    font-size: 0.78rem;
    margin-bottom: 0;
}

/* Hide verbose-only rows */
body.compact-mode .item-time,
body.compact-mode .item-meta,
body.compact-mode .item-assigned,
body.compact-mode .item-address {
    display: none;
}

/* Show badge inline left of title — flush to top like the checkbox */
body.compact-mode .item-compact-badge {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    font-size: 0.58rem;
    font-weight: 800;
    padding: 1px 4px;
    border-radius: 3px;
    letter-spacing: 0.04em;
    opacity: 0.9;
    margin-top: 2px;
}

/* Show initials inline, right of badge, left of title — flush to top */
body.compact-mode .item-compact-initials {
    display: inline-flex;
    flex-shrink: 0;
    align-self: flex-start;
    font-size: 0.64rem;
    font-weight: 700;
    color: #fbbf24;
    margin-top: 2px;
}

/* Badge colour variants */
body.compact-mode .badge-visit {
    background: rgba(52, 152, 219, .25);
    color: #60b9f7;
}

body.compact-mode .badge-task {
    background: rgba(230, 126, 34, .25);
    color: #f4a259;
}

body.compact-mode .badge-assessment {
    background: rgba(155, 89, 182, .25);
    color: #c57ef7;
}

body.compact-mode .badge-event {
    background: rgba(46, 204, 113, .25);
    color: #2ecc71;
}

/* items-container gap tightens in compact mode */
body.compact-mode .items-container {
    gap: 3px;
}

/* Compact toggle checkbox — accent colour so it stands out */
#compactToggle {
    accent-color: var(--accent-color);
}