/* Route Squiggler - Base Common Styles */
/* Styles that are identical across all themes */

/* === GLOBAL LINK STYLES === */
/* All links use btn-inactive light blue color for consistency */
a {
    color: rgb(100, 170, 235);
    text-decoration: none;
}

a:hover {
    color: rgb(80, 150, 215);
    text-decoration: underline;
}

a:visited {
    color: rgb(100, 170, 235);
}

/* Force white text for link-style buttons used on auth pages */
.auth-link,
.auth-link:link,
.auth-link:visited,
.auth-link:hover,
.auth-link:active {
    color: white;
}

/* === COMMON BUTTON STYLES === */
/* These button styles are the same in light and dark themes */

.btn-inactive,
.btn.btn-inactive,
.action-button.btn-inactive {
    background-color: rgb(100, 170, 235);
    color: white;
}

.btn-inactive:hover,
.btn.btn-inactive:hover,
.action-button.btn-inactive:hover {
    background-color: var(--button-primary);
    color: white;
    text-decoration: none;
}

.btn-unavailable,
.btn.btn-unavailable,
.action-button.btn-unavailable {
    background-color: rgb(100, 100, 100);
    color: white;
    cursor: not-allowed;
}

.btn-unavailable:hover,
.btn.btn-unavailable:hover,
.action-button.btn-unavailable:hover {
    background-color: rgb(100, 100, 100); /* No color change on hover */
}

/* Primary buttons use CSS variables (same in both themes) */
.btn-primary {
    background-color: var(--button-primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--button-primary-hover);
}

/* Secondary buttons have hardcoded colors (same in both themes) */
.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #545b62;
}

/* Danger buttons (light red) */
.btn-danger {
    background-color: #e77777;
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
    text-decoration: none;
}

/* Ensure anchor-based buttons keep correct text color across all link states */
.btn-primary:link,
.btn-primary:visited,
.btn-primary:hover,
.btn-primary:active {
    color: white;
}

.btn-secondary:link,
.btn-secondary:visited,
.btn-secondary:hover,
.btn-secondary:active {
    color: white;
}

.btn-danger:link,
.btn-danger:visited,
.btn-danger:hover,
.btn-danger:active {
    color: white;
    text-decoration: none;
}

/* Ensure lighter blue inactive buttons (used for secondary CTAs) keep white text */
.btn-inactive:link,
.btn-inactive:visited,
.btn-inactive:hover,
.btn-inactive:active {
    color: white;
}

/* === DROPDOWN/SELECT STYLES === */
/* Style dropdowns to match our button system */

select,
.map-style-select,
.route-person-select {
    background-color: var(--button-primary);
    color: white;
    border: 2px solid var(--button-primary);
    border-radius: 6px;
    padding: 8px 12px;
    font-family: Verdana, sans-serif;
    font-size: 14px;
    cursor: pointer;
    outline: none;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    appearance: none; /* Remove default styling */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='white' viewBox='0 0 16 16'%3e%3cpath d='m7.247 4.86-4.796 5.481c-.566.647-.106 1.659.753 1.659h9.592a1 1 0 0 0 .753-1.659l-4.796-5.48a1 1 0 0 0-1.506 0z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 12px;
    padding-right: 32px; /* Make room for arrow */
    
    /* Force option styling variables */
    --option-bg-default: rgb(100, 170, 235);
    --option-bg-hover: var(--button-primary);
    --option-color: white;
}

select:hover,
.map-style-select:hover,
.route-person-select:hover {
    background-color: var(--button-primary-hover);
    border-color: var(--button-primary-hover);
}

select:focus,
.map-style-select:focus,
.route-person-select:focus {
    border-color: var(--button-primary-hover);
    box-shadow: 0 0 0 2px rgba(66, 139, 202, 0.3);
}

/* Ultra-aggressive option styling to override browser defaults */
*[is="select"] option,
select > option,
.map-style-select > option,
.route-person-select > option,
select option,
.map-style-select option,
.route-person-select option {
    background-color: var(--option-bg-default, rgb(100, 170, 235));
    background: var(--option-bg-default, rgb(100, 170, 235));
    color: var(--option-color, white);
    padding: 8px 12px;
    border: none;
    outline: none;
    box-shadow: none;
}

/* Ultra-aggressive hover state with maximum specificity */
*[is="select"] option:hover,
*[is="select"] option:focus,
*[is="select"] option:active,
select > option:hover,
select > option:focus,
select > option:active,
.map-style-select > option:hover,
.map-style-select > option:focus,
.map-style-select > option:active,
.route-person-select > option:hover,
.route-person-select > option:focus,
.route-person-select > option:active,
select option:hover,
select option:focus,
select option:active,
.map-style-select option:hover,
.map-style-select option:focus,
.map-style-select option:active,
.route-person-select option:hover,
.route-person-select option:focus,
.route-person-select option:active {
    background-color: var(--option-bg-hover, var(--button-primary));
    background: var(--option-bg-hover, var(--button-primary));
    color: var(--option-color, white);
    border: none;
    outline: none;
    box-shadow: none;
}

/* Browser-specific and high-specificity selectors */
select option[selected]:hover,
select option[selected]:focus,
.map-style-select option[selected]:hover,
.map-style-select option[selected]:focus,
.route-person-select option[selected]:hover,
.route-person-select option[selected]:focus {
    background-color: var(--button-primary);
    background: var(--button-primary);
}

/* Force hover state when select is focused */
select:focus option:hover,
select:focus option:focus,
.map-style-select:focus option:hover,
.map-style-select:focus option:focus,
.route-person-select:focus option:hover,
.route-person-select:focus option:focus {
    background-color: var(--button-primary);
    background: var(--button-primary);
    color: white;
}

/* Selected options also use active/primary color */
select option:checked,
.map-style-select option:checked,
.route-person-select option:checked {
    background-color: var(--button-primary);
}

/* Style optgroups */
select optgroup,
.map-style-select optgroup {
    background-color: rgb(80, 150, 215);
    color: white;
    font-weight: bold;
    font-style: normal;
}

/* === UTILITY CLASSES === */
/* Text alignment utilities */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

/* Margin utilities */
.mb-10 {
    margin-bottom: 10px;
}

.mb-20 {
    margin-bottom: 20px;
}

.mt-10 {
    margin-top: 10px;
}

.mt-20 {
    margin-top: 20px;
}

/* === LOADING STATES === */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    border: 2px solid var(--bg-alt);
    border-top: 2px solid var(--button-primary);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* === SLIDER BASE STRUCTURE === */
.slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background-color: var(--bg-alt);
    outline: none;
    border: 1px solid var(--border-color);
}

/* === NAVIGATION STRUCTURE === */
.nav-menu {
    list-style: none;
    padding: 0;
}

.nav-menu li {
    margin-bottom: 10px;
}

.nav-menu a {
    color: var(--text-primary);
    text-decoration: none;
    padding: 8px 12px;
    display: block;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.nav-menu a.active {
    background-color: var(--button-primary);
    color: white;
}

/* === TOP NAVIGATION BAR === */
.top-nav {
    background-color: var(--bg-primary);
    border-bottom: 2px solid var(--border-color);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.top-nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.top-nav-left {
    display: flex;
    align-items: center;
    gap: 0;
}

.nav-link {
    color: var(--text-primary);
    text-decoration: none;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    font-family: Verdana, sans-serif;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.3s ease, color 0.3s ease;
    border-bottom: 3px solid transparent;
    cursor: pointer;
}

.nav-link:hover {
    background-color: var(--button-primary);
    color: white;
    text-decoration: none;
}

.nav-link.active {
    color: var(--button-primary);
    border-bottom-color: var(--button-primary);
    background-color: var(--bg-alt);
}

.nav-username {
    font-weight: 600;
    color: var(--button-primary);
}

.nav-username:hover {
    background-color: var(--button-primary);
    color: white;
    text-decoration: none;
}

/* === DIALOG STRUCTURE === */
.dialog {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: Verdana, sans-serif;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.dialog-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.dialog-content {
    padding: 20px;
}

.dialog-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    text-align: right;
}

/* === RESPONSIVE DESIGN === */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .left-panel {
        width: 100%;
        height: 50vh;
    }
    
    .right-panel {
        height: 50vh;
    }
    
    /* Top Navigation responsive styles */
    .top-nav-container {
        padding: 0 10px;
    }
    
    .top-nav-left {
        flex-wrap: wrap;
        gap: 0;
    }
    
    .nav-link {
        padding: 12px 16px;
        font-size: 13px;
    }
    
    /* Stack navigation items on very small screens */
    @media (max-width: 480px) {
        .top-nav-left {
            flex-direction: column;
            align-items: stretch;
        }
        
        .nav-link {
            padding: 12px 20px;
            border-bottom: 1px solid var(--border-color);
            border-radius: 0;
        }
        
        .nav-link:last-child {
            border-bottom: none;
        }
    }
}