/* ═══ Sidebar Pane ═══ */

.ia-sidebar-pane {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--bg);
    min-height: 0;
}
body.dark-mode .ia-sidebar-pane {
    background: #0A0A0A;
}

@media (min-width: 768px) {
    .ia-sidebar-pane {
        display: flex;
        padding: 14px;
    }
}

/* Sidebar Header: compact progress + actions */
.ia-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
body.dark-mode .ia-sidebar-header {
    border-color: #2C2C2E;
    background: #1C1C1E;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.ia-sidebar-progress {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ia-ring-sm {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.ia-sidebar-pct {
    font-size: 15px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
}

.ia-sidebar-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.ia-export-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1.5px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.ia-export-btn:hover {
    border-color: var(--apple-blue);
    color: var(--apple-blue);
}

.ia-populate-btn-sm {
    padding: 6px 12px;
    border-radius: 8px;
    border: none;
    background: var(--success, #34C759);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: filter 0.15s;
}
.ia-populate-btn-sm:hover { filter: brightness(1.1); }

/* Sidebar empty state */
.ia-sidebar-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px 24px;
    text-align: center;
    flex: 1;
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: 14px;
}
body.dark-mode .ia-sidebar-empty {
    background: #111111;
    border-color: #2C2C2E;
}
.ia-sidebar-empty-icon {
    font-size: 40px;
    opacity: 0.3;
    animation: iaEmptyPulse 3s ease-in-out infinite;
}
@keyframes iaEmptyPulse {
    0%, 100% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(1.05); opacity: 0.45; }
}
.ia-sidebar-empty-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: -0.01em;
}
.ia-sidebar-empty-text {
    font-size: 13px;
    color: var(--text-tertiary);
    font-weight: 500;
    line-height: 1.6;
    max-width: 200px;
}


/* ═══ Collapsible Data Sections ═══ */

.ia-sections-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0; /* Prevent collapse in sidebar flex column */
}

.ia-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    animation: iaSectionIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    flex-shrink: 0; /* Prevent collapse — overflow:hidden makes min-height:0 in flex */
}
body.dark-mode .ia-section {
    border-color: #2C2C2E;
    background: #1C1C1E;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

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

.ia-section-done {
    border-color: rgba(52, 199, 89, 0.3);
}
body.dark-mode .ia-section-done {
    border-color: rgba(50, 215, 75, 0.25);
    box-shadow: 0 0 0 1px rgba(50, 215, 75, 0.08), 0 1px 4px rgba(0, 0, 0, 0.2);
}

.ia-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 11px 14px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    text-align: left;
    transition: background 0.15s;
}
.ia-section-header:hover {
    background: rgba(0, 0, 0, 0.02);
}
body.dark-mode .ia-section-header:hover {
    background: rgba(255, 255, 255, 0.03);
}

.ia-section-icon { font-size: 15px; flex-shrink: 0; }

.ia-section-title { flex: 1; }

.ia-section-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 6px;
    background: var(--bg-input);
    color: var(--text-secondary);
}
.ia-section-done .ia-section-badge {
    background: rgba(52, 199, 89, 0.12);
    color: var(--success, #34C759);
}
.ia-section-partial .ia-section-badge {
    background: rgba(0, 122, 255, 0.08);
    color: var(--apple-blue);
}

.ia-section-chevron {
    flex-shrink: 0;
    transition: transform 0.2s ease;
    color: var(--text-secondary);
}

/* Collapsed state */
.ia-section.ia-collapsed .ia-section-body {
    display: none;
}
.ia-section.ia-collapsed .ia-section-chevron {
    transform: rotate(-90deg);
}

.ia-section-body {
    border-top: 1px solid var(--border);
    padding: 6px 0;
}

.ia-section-field {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 6px 14px;
    gap: 10px;
    transition: background 0.15s;
}
.ia-section-field:hover {
    background: rgba(0, 0, 0, 0.015);
}
body.dark-mode .ia-section-field:hover {
    background: rgba(255, 255, 255, 0.02);
}
.ia-section-field + .ia-section-field {
    border-top: 1px solid rgba(0,0,0,0.04);
}
body.dark-mode .ia-section-field + .ia-section-field {
    border-top-color: rgba(255,255,255,0.05);
}

.ia-section-field-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
    flex-shrink: 0;
}

.ia-section-field-value {
    font-size: 13px;
    color: var(--text);
    font-weight: 600;
    text-align: right;
    word-break: break-word;
    min-width: 0;
}


/* ═══ Sidebar Cards (Maps, Vehicles) ═══ */

.ia-sidebar-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    flex-shrink: 0; /* Prevent collapse — overflow:hidden makes min-height:0 in flex */
}
body.dark-mode .ia-sidebar-card {
    border-color: #2C2C2E;
    background: #1C1C1E;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.ia-sidebar-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 14px;
    background: transparent;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Map views */
.ia-map-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    background: var(--border);
}

.ia-map-frame {
    position: relative;
    background: var(--bg-input);
    min-height: 110px;
    overflow: hidden;
}

.ia-map-label {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.ia-map-img {
    display: none;
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
}

.ia-map-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100px;
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
}

.ia-map-address {
    padding: 8px 14px;
    font-size: 12px;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 4px;
}
.ia-map-address::before {
    content: '📍';
    font-size: 13px;
}

.ia-map-expand-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: color 0.15s;
}
.ia-map-expand-btn:hover {
    color: var(--apple-blue);
}

/* Vehicle panel */
.ia-vehicle-info {
    padding: 10px 14px;
}

.ia-vehicle-row {
    padding: 6px 0;
}
.ia-vehicle-row + .ia-vehicle-row {
    border-top: 1px solid var(--border);
}

.ia-vehicle-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2px;
}

.ia-vehicle-vin {
    font-size: 12px;
    color: var(--text-secondary);
}
.ia-vehicle-vin code {
    background: var(--bg-input);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 11px;
    letter-spacing: 0.5px;
}
