/* View Operator Page Styles - Extracted from inline */
/* External Link Tooltip - CSS only, no JavaScript needed */
.external-link-tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.external-link-tooltip-text {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #212529;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.813rem;
    font-weight: 400;
    white-space: nowrap;
    z-index: 99999;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

.external-link-tooltip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #212529;
}

.external-link-tooltip:hover .external-link-tooltip-text,
.external-link-tooltip:focus .external-link-tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Favourite Button Styling */
.favourite-toggle {
    transition: all 0.3s ease;
    font-weight: 500;
    border-width: 2px;
    background-color: #ffc107;
    border-color: #ffc107;
    color: #000;
}

.favourite-toggle:hover {
    background-color: #ffb300;
    border-color: #ffb300;
    color: #000;
    transform: scale(1.05);
}

.favourite-toggle.is-favourited {
    box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.3);
}

.favourite-toggle i {
    transition: transform 0.2s ease;
}

.favourite-toggle:hover i {
    transform: rotate(72deg);
}

/* Modal message styling */
#suggestEditModal .modal-body {
    max-height: 70vh;
    overflow-y: auto;
}

#suggestEditModal #suggestFormError,
#suggestEditModal #suggestFormSuccess {
    position: sticky;
    top: 0;
    z-index: 10;
    margin-bottom: 1rem !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Light theme colors */
#suggestEditModal #suggestFormError {
    background-color: #f8d7da;
    border-color: #f5c2c7;
    color: #842029;
}

#suggestEditModal #suggestFormSuccess {
    background-color: #d1e7dd;
    border-color: #badbcc;
    color: #0f5132;
}

/* Dark theme colors */
body.theme-dark #suggestEditModal #suggestFormError {
    background-color: rgba(220, 53, 69, 0.2);
    border-color: rgba(220, 53, 69, 0.35);
    color: #f5a3ab;
}

body.theme-dark #suggestEditModal #suggestFormSuccess {
    background-color: rgba(25, 135, 84, 0.2);
    border-color: rgba(25, 135, 84, 0.35);
    color: #75d9a3;
}

/* Dark theme dismiss button */
body.theme-dark #suggestEditModal .alert .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Readonly/disabled field styling */
#suggestEditModal .readonly-field {
    background-color: #e9ecef;
    cursor: not-allowed;
    color: #495057;
}

/* Dark theme readonly/disabled field styling */
body.theme-dark #suggestEditModal .readonly-field {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #e2e8f0;
    opacity: 0.9;
}

body.theme-dark #suggestEditModal .readonly-field:focus {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #e2e8f0;
    box-shadow: none;
}

/* ============================================================
   OPERATOR PAGE REDESIGN
   ============================================================ */

/* Dark Mode Support */
.theme-dark .stat-card,
.theme-dark .info-card,
.theme-dark .parent-company-row,
.theme-dark .routes-card,
.theme-dark .bus-preview-card,
.theme-dark .fleet-table-container .card,
.theme-dark #fleetTable {
    background: #2D3748;
    border-collapse: separate;
    border-spacing: 0 0.75rem;
}

.theme-dark #fleetTable thead th {
    background: #2D3748;
    padding-bottom: 0.75rem;
}

.theme-dark #fleetTable tbody tr {
    background: #2D3748;
    margin-bottom: 0.75rem;
}

.theme-dark #fleetTable tbody tr:hover {
    background: #3a4a5e;
}

.theme-dark #fleetTable tbody tr td {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.theme-dark .area-step-circle {
    background: #2D3748;
}

.theme-dark .parent-company-row .parent-logo {
    background: #2D3748;
}

.theme-dark .operator-logo-large {
    background: #2D3748;
    border-color: #4a5568;
}


.theme-dark .routes-card-header {
    background: #3a4a5e;
    color: #e2e8f0;
}

.theme-dark .bus-preview-image {
    background: #3a4a5e;
}

.theme-dark .bus-preview-image .no-image {
    color: #718096;
}

.theme-dark .info-card-title {
    border-bottom: 1px solid #4a5568 !important;
}

.theme-dark .areas-served-section {
    border-top: 1px solid #4a5568 !important;
}

.theme-dark .area-stepper::before {
    background: #4a5568 !important;
}

.theme-dark .route-item {
    border-bottom: 1px solid #4a5568 !important;
}

.theme-dark .route-item:last-child {
    border-bottom: none !important;
}

.theme-dark .stop-item {
    border-left: 2px solid #4a5568 !important;
}

/* Additional dark mode border fixes */
.theme-dark .operator-header {
    border-bottom: 1px solid #4a5568 !important;
}

.theme-dark .info-card {
    border: 1px solid #4a5568 !important;
}

.theme-dark .stat-card {
    border: 1px solid #4a5568 !important;
}

.theme-dark .routes-card {
    border: 1px solid #4a5568 !important;
}

.theme-dark .bus-preview-card {
    border: 1px solid #4a5568 !important;
}

.theme-dark .route-details-panel {
    border: 1px solid #4a5568 !important;
}

.theme-dark .routes-card-header {
    border-bottom: 1px solid #4a5568 !important;
}

.theme-dark .route-details-header {
    border-bottom: 1px solid #4a5568 !important;
}

.theme-dark .btn-primary {
    color: #fff !important;
}

/* Stats Container */
/* Stats Row - aligned with table width */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    padding: 0;
}

.stats-row-secondary {
    margin-top: 1rem;
}

.stat-card {
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-value-text {
    font-size: 0.75rem;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.stat-icon {
    font-size: 1rem;
    margin-bottom: 0.25rem;
    opacity: 0.8;
}

.stat-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--heading-color);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.2rem;
}

.stat-card.highlight {
    background: linear-gradient(135deg, var(--bs-primary), #4a90d9);
    color: #fff;
    border: none;
}

.stat-card.highlight .stat-value,
.stat-card.highlight .stat-label,
.stat-card.highlight .stat-icon {
    color: #fff;
}

/* Operator Header */
.operator-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0;
    border: none;
}

/* Remove divider line on dark theme */
.theme-dark .operator-header-card {
    border: none !important;
    box-shadow: none !important;
}

.theme-dark .operator-header-card .card-body {
    border: none !important;
    border-bottom: none !important;
}

.theme-dark .operator-title {
    border-bottom: none !important;
}

.theme-dark .operator-title .service-area-badge {
    border-bottom: none !important;
}

.theme-dark .operator-header {
    border-bottom: none !important;
}

.operator-actions {
    margin-left: auto;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.operator-actions .btn {
    white-space: nowrap;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    min-width: auto;
}

.operator-logo-large {
    width: 100px;
    height: 100px;
    object-fit: contain;
    border-radius: 12px;
    background: var(--bg-card);
    padding: 8px;
    border: 1px solid var(--border-color);
}

.operator-title {
    flex: 1;
}

.operator-title h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 0.25rem 0;
    color: var(--heading-color);
}

.operator-title .service-area-badge {
    display: inline-block;
    background: rgba(13, 110, 253, 0.1);
    color: var(--primary-color, #0d6efd);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    border: 1px solid rgba(13, 110, 253, 0.2);
    font-weight: 500;
    margin-top: 0.5rem;
}

.theme-dark .operator-title .service-area-badge {
    background: rgba(96, 165, 250, 0.15);
    color: #60a5fa;
    border-color: rgba(96, 165, 250, 0.3);
}

/* Info Cards */
.info-card {
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    height: 100%;
}

.info-card-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.info-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.info-item:last-child {
    margin-bottom: 0;
}

.info-item i {
    width: 20px;
    color: var(--bs-primary);
    margin-top: 2px;
}

.info-item a {
    color: var(--bs-primary);
    text-decoration: none;
}

.info-item a:hover {
    text-decoration: underline;
}

/* Depot Map */
.depot-map-container {
    height: 200px;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 1rem;
    border: 1px solid var(--border-color);
}

.depot-map-container .map-placeholder {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bs-light);
    color: var(--text-muted);
}

/* Routes Section */
.routes-card {
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    height: 100%;
}

.routes-card-header {
    background: var(--bs-light);
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

.routes-list {
    max-height: 350px;
    overflow-y: auto;
}

.route-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 12px;
}

.route-item:last-child {
    border-bottom: none;
}

.route-item:hover {
    background-color: rgba(var(--bs-primary-rgb), 0.05);
}

.route-item.active {
    background-color: rgba(var(--bs-primary-rgb), 0.1);
}

.route-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    padding: 6px 12px;
    border-radius: 6px;
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.route-info {
    flex: 1;
    min-width: 0;
}

.route-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.route-stops-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.route-arrow {
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.2s;
}

.route-item:hover .route-arrow,
.route-item.active .route-arrow {
    opacity: 1;
}

/* Route Map */
.route-map-section {
    margin-top: 1rem;
}

.route-map {
    height: 300px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
}

.route-map .map-placeholder {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1rem;
}

.route-stops-list {
    max-height: 200px;
    overflow-y: auto;
    margin-top: 1rem;
}

.stop-item {
    display: flex;
    align-items: flex-start;
    padding: 8px 12px;
    border-left: 2px solid var(--border-color);
    margin-left: 10px;
    position: relative;
}

.stop-item:last-child {
    border-left-color: transparent;
}

.stop-number-badge {
    position: absolute;
    left: -11px;
    width: 20px;
    height: 20px;
    background: var(--bs-primary);
    color: #fff;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stop-details {
    margin-left: 15px;
}

.stop-name {
    font-weight: 500;
    font-size: 0.9rem;
}

.stop-code {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: monospace;
    margin-left: 0.5rem;
}

.stop-road {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Fleet Preview */
.fleet-preview {
    margin-top: 1.5rem;
}

.fleet-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.fleet-preview-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.fleet-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.bus-preview-card {
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
    display: block;
}

.bus-preview-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    color: inherit;
    text-decoration: none;
}

.bus-preview-image {
    height: 120px;
    background: var(--bs-light);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.bus-preview-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bus-preview-image .no-image {
    color: var(--text-muted);
    font-size: 2rem;
}

.bus-preview-info {
    padding: 0.75rem;
}

.bus-preview-reg {
    font-weight: 700;
    font-size: 1rem;
    color: var(--heading-color);
}

.bus-preview-model {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bus-preview-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.bus-preview-status.active {
    background: #d4edda;
    color: #155724;
}

.bus-preview-status.withdrawn {
    background: #f8d7da;
    color: #721c24;
}

/* Fleet Table Container */
.fleet-table-container {
    margin-top: 1rem;
}

.fleet-table-container .card {
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.fleet-table-container .card-body {
    padding: 1.5rem;
}

#fleetTable {
    background: var(--card-bg, #fff);
    border-collapse: separate;
    border-spacing: 0 0.75rem;
}

#fleetTable thead th {
    background: var(--card-bg, #fff);
    border-bottom-color: var(--border-color);
    padding-bottom: 0.75rem;
}

#fleetTable tbody tr {
    background: var(--card-bg, #fff);
    margin-bottom: 0.75rem;
}

#fleetTable tbody tr:hover {
    background: var(--bs-light, #f8f9fa);
}

#fleetTable td, #fleetTable th {
    border-color: var(--border-color);
}

#fleetTable tbody tr td {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

#fleetTable img {
    width: 60px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}

/* No Routes Message */
.no-routes-message {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

/* Areas Served */
.areas-served-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.areas-served-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--heading-color);
    margin-bottom: 1rem;
}

.area-stepper {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    position: relative;
}

.area-stepper::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 30px;
    right: 30px;
    height: 2px;
    background: var(--border-color);
    z-index: 0;
}

.area-stepper.single::before {
    display: none;
}

.area-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
    flex: 1;
}

.area-step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--card-bg, #fff);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: all 0.3s ease;
    margin-bottom: 0.5rem;
}

.area-step.completed .area-step-circle {
    background: var(--bs-success, #198754);
    border-color: var(--bs-success, #198754);
    color: #fff;
}

.area-step.current .area-step-circle {
    background: var(--bs-primary, #0d6efd);
    border-color: var(--bs-primary, #0d6efd);
    color: #fff;
    transform: scale(1.1);
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.2);
}

.area-step-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-align: center;
    max-width: 100px;
    line-height: 1.3;
}

.area-step.completed .area-step-label,
.area-step.current .area-step-label {
    color: var(--heading-color);
    font-weight: 600;
}

/* Parent Company Row */
.parent-company-row {
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.parent-company-row .parent-logo {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 8px;
    background: var(--bs-light, #f8f9fa);
    padding: 4px;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.parent-company-row .parent-info {
    flex: 1;
}

.parent-company-row .parent-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.parent-company-row .parent-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--heading-color);
}

.parent-company-row .parent-note {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.parent-company-row .parent-website {
    flex-shrink: 0;
}

/* Responsive */
@media (max-width: 1199px) {
    .stats-row {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 991px) {
    .operator-header {
        flex-direction: column;
        text-align: center;
    }
    
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 575px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .stat-card {
        padding: 0.75rem 0.5rem;
    }
    
    .stat-icon {
        font-size: 1.2rem;
        margin-bottom: 0.25rem;
    }
    
    .stat-value {
        font-size: 1.2rem;
    }
    
    .stat-value-text {
        font-size: 0.85rem;
    }
    
    .stat-label {
        font-size: 0.65rem;
    }
    
    .fleet-preview-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .area-stepper {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .area-stepper::before {
        display: none;
    }
    
    .area-step {
        flex-direction: row;
        margin-bottom: 1rem;
    }
    
    .area-step-circle {
        margin-bottom: 0;
        margin-right: 0.75rem;
    }
}
