:root {
    --primary-color: #F26522; /* Official Reference Orange */
    --accent-color: #005EBB;
    --action-blue: #007bff;
    --bg-color: #f4f7f6;
    --text-dark: #2d3436;
    --text-muted: #636e72;
    --border-radius: 12px;
}

body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    overflow-x: hidden;
}

/* Reference Layout: Map is Primary */
#app-wrapper {
    height: 100vh;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.main-app-header {
    background-color: var(--primary-color);
    padding: 10px 0;
    z-index: 1100;
}

/* Container for Map and Sidebar */
.app-viewport {
    flex-grow: 1;
    display: flex;
    overflow: hidden;
    position: relative;
    width: 100%;
}

#map {
    display: none;
    flex-grow: 1;
    height: 100%;
    z-index: 1;
}

.map-active #map {
    display: block;
}

/* Sidebar for Results and Details */
#main-content-area {
    flex-grow: 1;
    width: 100%;
    background: white;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    z-index: 1000;
    overflow: hidden; /* Changed from overflow-y: auto to let inner content handle it */
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.map-active #main-content-area {
    width: 400px;
    flex-grow: 0;
}

/* Detail State in Sidebar */
#detail-state {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.detail-header {
    background: #ffffff;
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
}

#detail-linea-id {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    color: white;
    font-weight: bold;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 1.3rem;
    margin-bottom: 10px;
}

/* Day Tabs in Sidebar */
#day-tabs-container .btn {
    font-size: 0.85rem;
    padding: 8px 16px;
    border: 1px solid #dee2e6;
    background: #f8f9fa;
    color: #495057;
    font-weight: 600;
}

#day-tabs-container .btn.active {
    background-color: var(--action-blue) !important;
    color: white !important;
    border-color: var(--action-blue) !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Table in Sidebar - Compact & Scrollable */
.table-responsive-sidebar {
    flex-grow: 1;
    overflow: auto;
    border-top: 1px solid #eee;
}

#schedule-table-content table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.82rem;
}

#schedule-table-content thead th {
    background-color: var(--primary-color) !important;
    color: white !important;
    padding: 12px 10px;
    text-align: left;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 20; /* Increased z-index */
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#schedule-table-content tbody td {
    padding: 12px 10px;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
}

#schedule-table-content tbody tr:hover td {
    background-color: #fff8f5;
}

.frec-col {
    background-color: #f8f9fa;
    font-weight: bold;
    text-align: center;
    color: var(--primary-color);
    border-right: 1px solid #eee;
}

/* Responsive */
@media (max-width: 768px) {
    .map-active #main-content-area {
        width: 100%;
        position: absolute;
        bottom: 0;
        left: 0;
        height: 50%;
        z-index: 1050;
    }
}

.x-small { font-size: 0.75rem; }
.letter-spacing-1 { letter-spacing: 1px; }
.transition-all { transition: all 0.2s ease; }

/* Modern Feature Cards */
.welcome-icon-glow {
    width: 64px;
    height: 64px;
    background: rgba(242, 101, 34, 0.1);
    color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin: 0 auto;
    box-shadow: 0 0 20px rgba(242, 101, 34, 0.15);
}

.feature-card {
    background: #ffffff;
    border: 1px solid #edf2f7;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.feature-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.feature-icon {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.feature-content {
    flex-grow: 1;
}

.feature-title {
    display: block;
    font-weight: 700;
    font-size: 0.9rem;
    color: #1a202c;
    margin-bottom: 2px;
}

.feature-text {
    margin: 0;
    font-size: 0.8rem;
    color: #718096;
    line-height: 1.4;
}

/* Color Variances for cards */
.bg-primary-subtle { background-color: #fff1eb; }
.bg-success-subtle { background-color: #f0fdf4; }
.bg-purple-subtle  { background-color: #f5f3ff; }
.bg-orange-subtle  { background-color: #fff7ed; }
.bg-info-subtle    { background-color: #f0f9ff; }

.text-purple { color: #7c3aed; }
.text-orange { color: #f97316; }

.cursor-pointer { cursor: pointer; }

/* Remove blue focus border from filters */
.form-select:focus, 
.form-control:focus,
#line-selector:focus,
#day-filter:focus,
#time-filter:focus {
    border-color: transparent !important;
    box-shadow: none !important;
    outline: none !important;
}

/* Ensure table-responsive-sidebar fills space and scrolls correctly */
.table-responsive-sidebar {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: auto;
}
