/* ==========================================================================
   Ferry Schedule Styles - Unified & Optimized
   ========================================================================== */

/* --- 1. Filter Bar & Controls --- */
.filter-bar {
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    background-color: #f8f9fa;
}

/* Date Picker Positioning Fix */
.date-display-wrapper {
    position: relative; /* Essential for positioning the hidden input */
    min-width: 160px;
}

/* The visible button for the date */
.date-display-btn {
    white-space: nowrap;
    width: 100%;
    border: 1px solid #dee2e6;
    background: white;
    transition: all 0.2s ease;
    height: 38px; /* Fixed height for alignment */
    display: flex;
    align-items: center;
    justify-content: center;
}

.date-display-btn:hover {
    background: #f1f3f5;
    border-color: var(--bs-primary);
}

.date-display-btn i {
    color: var(--bs-primary);
}

/* Direction Pills (Radio Buttons) */
.direction-pills {
    display: inline-flex;
    white-space: nowrap;
}

.direction-pills .btn {
    min-width: 85px;
}

/* --- 2. Schedule Card & Layout --- */
.schedule-card {
    border: 1px solid #e9ecef;
    border-radius: 0.75rem;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    background: white;
    margin-bottom: 1.5rem;
}

.schedule-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08) !important;
}

/* Card Header */
.schedule-card .card-header {
    background: linear-gradient(to right, #f8f9fa 0%, white 100%);
    border-bottom: 2px solid var(--bs-primary);
    padding: 1rem 1.25rem;
}

.route-title {
    font-size: 1.125rem;
    color: var(--bs-primary);
    font-weight: 600;
}

/* --- 3. Table Styles --- */
.table-schedule {
    margin-bottom: 0;
    width: 100%;
}

.table-schedule thead th {
    background: #f8f9fa;
    color: #495057;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #dee2e6;
    padding: 1rem;
}

.table-schedule tbody td {
    padding: 1rem;
    vertical-align: middle; /* Aligns buttons/text vertically */
    border-bottom: 1px solid #f1f3f5;
    font-size: 0.95rem;
}

.table-schedule tbody tr:last-child td {
    border-bottom: none;
}

.table-schedule tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.03);
}

/* Data Columns */
.time-display {
    font-weight: 700;
    color: #212529;
    font-size: 1.1rem;
}

.ship-badge {
    background-color: #e9ecef;
    color: #495057;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* --- 4. Action Buttons --- */
/* Green 'Book' Button */
.btn-book {
    background-color: #198754; /* Success Green */
    color: white !important;
    border: none;
    font-weight: 600;
    padding: 0.4rem 1.2rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.btn-book:hover {
    background-color: #157347;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(25, 135, 84, 0.25);
    color: white;
}

/* --- 5. States (Loading, Empty, etc.) --- */
.schedule-container {
    position: relative;
    min-height: 200px;
}

/* Helper to prevent layout jumps */
.min-vh-25 {
    min-height: 25vh;
}

.schedule-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    width: 100%;
    color: var(--bs-primary);
}

.schedule-empty {
    padding: 4rem 1rem;
    text-align: center;
    color: #6c757d;
}

.schedule-empty i {
    font-size: 3rem;
    opacity: 0.5;
    margin-bottom: 1rem;
    display: block;
}

/* --- 6. Responsive Design --- */
@media (max-width: 767.98px) {
    /* Mobile Filter Bar */
    .filter-bar {
        padding: 1rem !important;
    }
    
    .date-display-wrapper, 
    .date-display-btn {
        width: 100%;
        min-width: unset;
    }

    /* Compact Table */
    .table-schedule thead th,
    .table-schedule tbody td {
        padding: 0.75rem 0.5rem;
        font-size: 0.875rem;
    }
    
    /* Hide optional columns */
    .ship-badge {
        display: none;
    }
    
    /* Full width buttons */
    .btn-book {
        width: 100%;
        justify-content: center;
        margin-top: 0.25rem;
    }
    
    .time-display {
        font-size: 1rem;
    }
}

/* --- 7. Print Styles --- */
@media print {
    .filter-bar,
    .nav-tabs,
    .btn-book {
        display: none !important;
    }
    
    .schedule-card {
        box-shadow: none !important;
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }
}

/* --- 8. Scrollbars --- */
.table-responsive::-webkit-scrollbar {
    height: 8px;
}
.table-responsive::-webkit-scrollbar-track {
    background: #f1f3f5;
}
.table-responsive::-webkit-scrollbar-thumb {
    background-color: #ced4da;
    border-radius: 4px;
}
.table-responsive::-webkit-scrollbar-thumb:hover {
    background-color: #adb5bd;
}