/* Reset & base */
* {
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 12px 16px;
    background-color: #f4f4f4;
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Container for page content */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding-bottom: 40px;
}

/* Tabs container */
.tabs {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    border-bottom: 2px solid #ddd;
}

/* Individual tab button */
.tab-btn {
    flex: 1;
    text-align: center;
    padding: 10px 0;
    cursor: pointer;
    font-weight: 600;
    color: #555;
    border: none;
    background: none;
    transition: color 0.3s, border-bottom 0.3s;
    border-bottom: 3px solid transparent;
}

    .tab-btn.active {
        color: #0078D4;
        border-bottom-color: #0078D4;
    }

/* Tab content containers */
.tab-content {
    display: none;
}

    .tab-content.active {
        display: block;
    }

/* Route button styles */
.route-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.route-btn {
    width: 100%;
    min-width: 120px;
    padding: 12px 24px;
    background-color: #0078D4;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    user-select: none;
}

    .route-btn:hover,
    .route-btn:focus {
        background-color: #005a9e;
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(0, 120, 212, 0.3);
        outline: none;
    }

    .route-btn:active {
        transform: translateY(0);
    }

/* Service times card */
.service-times-card {
    background: white;
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.1);
    overflow-x: auto;
}

/* Grid for service times */
.grid-container {
    display: grid;
    grid-template-columns: auto auto 20px 1fr auto;
    gap: 4px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: #fff;
    overflow-x: auto;
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
}

    .grid-container > .cell.to-column {
        max-height: 42px; /* or as needed */
        overflow: hidden;
        text-overflow: clip;
        white-space: normal;
        display: flex;
        align-items: center; /* Center vertically by default */
        justify-content: center;
        font-size: 0.9rem;
        padding: 4px 6px;
    }

        .grid-container > .cell.to-column.overflowing {
            align-items: flex-start; /* Top align */
            padding: 2px;
        }

.header-row, .header-column {
    background-color: #0078D4;
    color: white;
    font-weight: bold;
    padding: 6px 8px;
    text-align: center;
    user-select: none;
}

.header-row {
    border-bottom: 1px solid #005a9e;
}

.header-column {
    border-right: 1px solid #005a9e;
}

.cell {
    padding: 4px 6px;
    border: 1px solid #ddd;
    text-align: center;
    vertical-align: middle;
    font-size: 0.9rem;
    user-select: none;
}

    .cell:hover {
        background-color: #f0f0f0;
    }

/* Loading spinner */
.loading-spinner {
    display: none;
    margin: 12px auto 16px;
    width: 40px;
    height: 40px;
    position: relative;
}

.preloader-wrapper {
    position: relative;
    width: 40px;
    height: 40px;
}

.spinner-layer {
    border-color: #0078D4;
}

/* Route selector styles */
.route-selector-container {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 500px;
    margin: 0 auto 24px auto;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    visibility: visible !important;
    opacity: 1 !important;
}

.route-label {
    font-weight: 600;
    margin-bottom: 12px;
    display: block !important;
    visibility: visible !important;
    color: #333;
    font-size: 1.1rem;
}

.route-dropdown {
    width: 100% !important;
    max-width: 280px;
    margin-bottom: 20px;
    appearance: menulist !important;
    -webkit-appearance: menulist !important;
    -moz-appearance: menulist !important;
    background: white !important;
    color: #333 !important;
    border: 2px solid #ddd !important;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 1rem;
    z-index: 1000 !important;
    position: relative !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    min-height: 44px;
    transition: border-color 0.3s;
}

    .route-dropdown:focus {
        outline: none;
        border-color: #0078D4 !important;
        box-shadow: 0 0 0 3px rgba(0, 120, 212, 0.1);
    }

.route-buttons-container {
    display: flex;
    gap: 16px;
    width: 100%;
    max-width: 300px;
    justify-content: center;
}

.button-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
}

/* Header banner styles */
.rtc-banner {
    width: 100%;
    background: linear-gradient(90deg, #0078D4 0%, #005a9e 100%);
    color: #fff;
    padding: 24px 0 16px 0;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 0;
    border-bottom-left-radius: 18px;
    border-bottom-right-radius: 18px;
}

.rtc-title {
    font-size: 2.1rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.08);
    font-family: 'Segoe UI', 'Arial', sans-serif;
}

/* Loading overlay styles */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: visibility 0.2s, opacity 0.2s;
    opacity: 0;
    pointer-events: none;
}

    .loading-overlay.active {
        visibility: visible;
        opacity: 1;
        pointer-events: all;
    }

/* Enhanced Config Editor Styles */
.config-editor-container {
    background: #f8f8f8;
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
    position: relative;
}

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

.editor-header h6 {
    margin: 0;
    color: #333;
}

.format-btn {
    padding: 6px 12px;
    background: #0078D4;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background-color 0.3s;
}

.format-btn:hover {
    background: #005a9e;
}

.editor-wrapper {
    position: relative;
    border: 1px solid #ccc;
    border-radius: 6px;
    overflow: hidden;
}

.line-numbers {
    position: absolute;
    left: 0;
    top: 0;
    width: 40px;
    background: #f0f0f0;
    border-right: 1px solid #ddd;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    line-height: 1.4;
    color: #666;
    padding: 8px 4px;
    user-select: none;
    z-index: 1;
    overflow: hidden;
}

.config-textarea {
    width: 100%;
    min-height: 200px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    line-height: 1.4;
    border: none;
    padding: 8px 8px 8px 48px;
    resize: vertical;
    background: transparent;
    color: #333;
    box-sizing: border-box;
}

.config-textarea:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.2);
}

.editor-controls {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.validate-btn {
    padding: 8px 16px;
    background: #0078D4;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s;
}

.validate-btn:hover {
    background: #005a9e;
}

.status-message {
    font-weight: 500;
    padding: 4px 0;
}

.status-success { color: #388e3c; }
.status-error { color: #d32f2f; }

.error-details {
    background: #ffebee;
    border: 1px solid #ffcdd2;
    border-radius: 4px;
    padding: 8px;
    margin-top: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    color: #c62828;
}

/* Responsive tweaks */
@media (max-width: 480px) {
    .route-buttons {
        flex-direction: column;
    }

    .route-btn {
        max-width: 100%;
        margin-bottom: 10px;
    }

    .tabs {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: stretch;
    }

    .tab-btn {
        border-bottom: 3px solid transparent;
        border-left: none;
        padding-left: 0;
        text-align: center;
        font-size: 1.1rem;
        width: 50%;
        min-width: 120px;
    }

        .tab-btn.active {
            border-bottom-color: #0078D4;
            border-left: none;
            color: #0078D4;
        }

    /* Responsive adjustments for config editor */
    .editor-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .format-btn {
        align-self: flex-end;
    }
    
    .line-numbers {
        width: 35px;
    }
    
    .config-textarea {
        padding-left: 43px;
    }
}

.footer {
    margin-top: auto;
    padding: 10px;
    text-align: center;
    color: #999;
}