/* ================================================
   GR Flota Solutions - Gestor de Rutas
   Design matching GPS Server style
   ================================================ */

@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;600;700&display=swap');

/* Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: 'Open Sans', sans-serif;
    font-size: 12px;
    color: #444444;
    background: #f5f5f5;
}

a { text-decoration: none; color: #2b82d4; }
a:hover { color: #1a5fa8; }

/* ================================================
   LOGIN SCREEN - Matching GPS Server Style
   ================================================ */

.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    min-height: 100vh;
    background: url('../img/login-background.jpg') center center no-repeat;
    background-size: cover;
    position: relative;
}

.login-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.login-inner {
    position: relative;
    z-index: 1;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-box {
    width: 420px;
    max-width: 95%;
    margin: 0 auto;
    padding: 30px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.logo-block {
    text-align: center;
    margin-bottom: 25px;
}

.logo {
    max-width: 180px;
    height: auto;
    margin-bottom: 10px;
}

.logo-text {
    font-size: 20px;
    font-weight: 600;
    color: #2b82d4;
    margin: 10px 0 0 0;
}

.content-block {
    width: 100%;
}

.login-legend {
    text-align: center;
    font-size: 12px;
    color: #666666;
    margin-bottom: 20px;
    padding: 10px 15px;
    background: #f0f7ff;
    border-radius: 4px;
    border-left: 3px solid #2b82d4;
}

/* Form Rows */
.row3 {
    margin-bottom: 15px;
    position: relative;
}

/* Input Fields - GPS Server Style */
.login-box .inputbox {
    width: 100%;
    height: 48px;
    padding: 0 15px 0 50px;
    border: 1px solid #f5f5f5;
    background-color: #f5f5f5;
    font-size: 13px;
    font-family: 'Open Sans', sans-serif;
    color: #444444;
    border-radius: 0;
    transition: all 0.2s;
}

.login-box .inputbox:hover,
.login-box .inputbox:focus {
    background-color: #ffffff;
    border-color: #e0e0e0;
    outline: none;
}

.login-box .inputbox::placeholder {
    color: #999999;
}

/* Input Icons */
.login-box .inputbox.icon-user {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23888"><path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/></svg>');
    background-repeat: no-repeat;
    background-position: 15px center;
    background-size: 18px 18px;
}

.login-box .inputbox.icon-password {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23888"><path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"/></svg>');
    background-repeat: no-repeat;
    background-position: 15px center;
    background-size: 18px 18px;
}

/* Login Button */
.submit-btn {
    position: relative;
    margin-top: 20px;
}

.login-box .button-login {
    width: 100%;
    height: 50px;
    background: #2b82d4;
    color: #ffffff;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    font-family: 'Open Sans', sans-serif;
}

.login-box .button-login:hover {
    opacity: 0.9;
}

/* Remember Device */
.remember-row {
    margin-top: 15px;
    margin-bottom: 5px;
}

.remember-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
    color: #555;
    user-select: none;
}

.remember-label input[type="checkbox"] {
    display: none;
}

.remember-label .checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid #ccc;
    border-radius: 3px;
    background: #fff;
    position: relative;
    flex-shrink: 0;
}

.remember-label input[type="checkbox"]:checked + .checkmark {
    background: #2b82d4;
    border-color: #2b82d4;
}

.remember-label input[type="checkbox"]:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Error/Info Messages */
.error-message {
    margin-top: 15px;
    padding: 12px 15px;
    background: #ffebee;
    border-left: 3px solid #f44336;
    color: #c62828;
    font-size: 12px;
    display: none;
}

.error-message.show {
    display: block;
}

.info-message {
    margin-top: 15px;
    padding: 12px 15px;
    background: #e3f2fd;
    border-left: 3px solid #2196f3;
    color: #1565c0;
    font-size: 12px;
    display: none;
}

.info-message.show {
    display: block;
}

/* ================================================
   MAIN APP LAYOUT
   ================================================ */

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #f0f0f0;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 50px;
    padding: 0 15px;
    background: #2b82d4;
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    z-index: 100;
    flex-shrink: 0;
}

.header-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    font-size: 12px;
    opacity: 0.9;
}

.app-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ================================================
   BUTTONS
   ================================================ */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 32px;
    padding: 0 15px;
    border: 1px solid #e0e0e0;
    background: #ffffff;
    color: #444444;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    font-family: 'Open Sans', sans-serif;
}

.button:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.button.primary {
    background: #2b82d4;
    border-color: #2b82d4;
    color: #ffffff;
}

.button.primary:hover {
    background: #2474c0;
    border-color: #2474c0;
}

.button.width100 {
    width: 100%;
}

.button-small {
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid #e0e0e0;
    background: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.button-small:hover {
    background: #f5f5f5;
}

/* Back to AVL button */
#btn-back-avl {
    text-decoration: none;
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

#btn-back-avl:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

.btn-logo {
    height: 18px;
    width: auto;
}

/* ================================================
   SIDEBAR
   ================================================ */

.sidebar {
    width: 300px;
    background: #ffffff;
    border-right: 1px solid #e0e0e0;
    overflow-y: auto;
    flex-shrink: 0;
}

.panel {
    border-bottom: 1px solid #e8e8e8;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background: #fafafa;
    border-bottom: 1px solid #e8e8e8;
}

.panel-title {
    font-size: 11px;
    font-weight: 600;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.panel-content {
    padding: 15px;
}

/* Form Elements in Sidebar */
.sidebar .inputbox,
.sidebar .select {
    width: 100%;
    height: 32px;
    padding: 0 10px;
    border: 1px solid #e0e0e0;
    background: #f5f5f5;
    font-size: 11px;
    font-family: 'Open Sans', sans-serif;
    color: #444;
}

.sidebar .inputbox:focus,
.sidebar .select:focus {
    background: #fff;
    border-color: #2b82d4;
    outline: none;
}

.sidebar .inputbox-search {
    padding-left: 32px;
    background: #f5f5f5 url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23999"><path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/></svg>') 8px center no-repeat;
    background-size: 16px;
}

.sidebar .select {
    appearance: none;
    background: #f5f5f5 url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23666"><path d="M7 10l5 5 5-5z"/></svg>') right 8px center no-repeat;
    background-size: 16px;
    padding-right: 28px;
    cursor: pointer;
}

.sidebar .select[multiple] {
    height: auto;
    min-height: 80px;
    padding: 5px;
    background-image: none;
}

/* Waypoints */
.waypoints-container {
    max-height: 180px;
    overflow-y: auto;
    margin-bottom: 10px;
}

.waypoint-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #f8f9fa;
    border: 1px solid #e8e8e8;
    margin-bottom: 6px;
    cursor: grab;
    transition: background 0.15s;
}

.waypoint-item:hover {
    background: #f0f0f0;
}

.waypoint-number {
    width: 22px;
    height: 22px;
    background: #2b82d4;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    flex-shrink: 0;
}

.waypoint-text {
    flex: 1;
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.waypoint-remove {
    width: 18px;
    height: 18px;
    border: none;
    background: transparent;
    color: #999;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}

.waypoint-remove:hover {
    color: #e53935;
}

/* Suggestions Dropdown */
.suggestions-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.suggestions-list.show {
    display: block;
}

.suggestion-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
    font-size: 11px;
    line-height: 1.4;
}

.suggestion-item:hover {
    background: #f5f9ff;
}

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

/* Coords Row */
.coords-row {
    display: flex;
    gap: 8px;
}

.coords-row .inputbox {
    flex: 1;
}

/* ================================================
   MAP CONTAINER
   ================================================ */

.map-container {
    flex: 1;
    position: relative;
    min-width: 0;
}

#map {
    width: 100%;
    height: 100%;
}

/* Route Info Panel */
.route-info-panel {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 260px;
    background: #ffffff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
}

.route-info-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: #2b82d4;
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
}

.button-close {
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
}

.button-close:hover {
    opacity: 1;
}

.route-info-content {
    padding: 12px;
}

.route-stat {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 11px;
    border-bottom: 1px solid #f5f5f5;
}

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

.stat-label {
    color: #666;
}

.stat-value {
    font-weight: 600;
    color: #333;
}

.route-maneuvers {
    max-height: 180px;
    overflow-y: auto;
    padding: 0 12px 12px;
    border-top: 1px solid #e8e8e8;
}

.route-maneuvers h4 {
    font-size: 11px;
    margin: 10px 0 8px;
    color: #666;
}

.maneuver-item {
    padding: 6px 0;
    border-bottom: 1px solid #f5f5f5;
    font-size: 10px;
    color: #555;
}

/* ================================================
   LOADING OVERLAY
   ================================================ */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    z-index: 9999;
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e0e0e0;
    border-top-color: #2b82d4;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#loading-text {
    font-size: 13px;
    color: #666;
}

/* ================================================
   ICONS
   ================================================ */

.icon {
    width: 14px;
    height: 14px;
    display: inline-block;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.icon-plus { background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23666"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>'); }
.icon-marker { background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7z"/></svg>'); }
.icon-route { background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23fff"><path d="M21 3L3 10.53v.98l6.84 2.65L12.48 21h.98L21 3z"/></svg>'); }
.icon-compare { background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23fff"><path d="M10 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h5v2h2V1h-2v2zm0 15H5l5-6v6zm9-15h-5v2h5v13l-5-6v9h5c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"/></svg>'); }
.icon-clear { background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23666"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>'); }
.icon-logout { background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23fff"><path d="M17 7l-1.41 1.41L18.17 11H8v2h10.17l-2.58 2.58L17 17l5-5zM4 5h8V3H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h8v-2H4V5z"/></svg>'); }

/* ================================================
   RESPONSIVE
   ================================================ */

@media (max-width: 900px) {
    .app-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        max-height: 45vh;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        order: 2;
    }

    .map-container {
        order: 1;
        min-height: 55vh;
    }

    .route-info-panel {
        width: calc(100% - 20px);
        left: 10px;
        right: 10px;
    }
}

@media (max-width: 500px) {
    .login-box {
        padding: 20px;
        margin: 10px;
    }

    .logo {
        max-width: 140px;
    }

    .logo-text {
        font-size: 18px;
    }

    .login-box .inputbox {
        height: 44px;
        font-size: 14px;
    }

    .login-box .button-login {
        height: 46px;
    }

    .header-title {
        font-size: 14px;
    }

    .panel-content {
        padding: 12px;
    }
}

/* ================================================
   LEAFLET CUSTOMIZATION
   ================================================ */

.leaflet-container {
    font-family: 'Open Sans', sans-serif;
    font-size: 11px;
}

.leaflet-popup-content {
    margin: 10px 12px;
    font-size: 11px;
}

.leaflet-popup-content b {
    font-weight: 600;
}

/* ================================================
   TOAST NOTIFICATIONS
   ================================================ */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 450px;
    padding: 14px 18px;
    background: #ffffff;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    pointer-events: auto;
    animation: toastSlideIn 0.3s ease;
    border-left: 4px solid #2b82d4;
}

.toast.toast-error {
    border-left-color: #dc3545;
}

.toast.toast-success {
    border-left-color: #28a745;
}

.toast.toast-warning {
    border-left-color: #ffc107;
}

.toast-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 12px;
    color: #666;
}

.toast-close {
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    color: #999;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.toast-close:hover {
    color: #333;
}

.toast.hiding {
    animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ================================================
   CUSTOM MAP MARKERS
   ================================================ */

.custom-marker {
    display: flex;
    align-items: center;
    justify-content: center;
}

.marker-origin {
    width: 32px;
    height: 32px;
    background: #28a745;
    border: 3px solid #ffffff;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.marker-origin::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    background: #fff;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.marker-waypoint {
    width: 28px;
    height: 28px;
    background: #2b82d4;
    border: 3px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #ffffff;
}

.marker-waypoint.final {
    background: #dc3545;
}

.marker-pin {
    width: 30px;
    height: 40px;
    position: relative;
}

.marker-pin-head {
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, #2b82d4 0%, #1a5fa8 100%);
    border: 3px solid #ffffff;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.marker-pin-head.origin {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
}

.marker-pin-head.destination {
    background: linear-gradient(135deg, #dc3545 0%, #bd2130 100%);
}

.marker-pin-number {
    transform: rotate(45deg);
    font-size: 11px;
    font-weight: 700;
    color: #ffffff;
}

/* ================================================
   CUSTOM MODAL DIALOG
   ================================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    animation: modalFadeIn 0.2s ease;
}

.modal-dialog {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    width: 400px;
    max-width: 90%;
    animation: modalSlideIn 0.2s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-bottom: 1px solid #e8e8e8;
}

#modal-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.modal-close {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: #999;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    border-radius: 4px;
}

.modal-close:hover {
    background: #f5f5f5;
    color: #333;
}

.modal-body {
    padding: 20px;
}

#modal-message {
    font-size: 13px;
    color: #555;
    line-height: 1.5;
    margin: 0;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid #e8e8e8;
    background: #fafafa;
    border-radius: 0 0 8px 8px;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ================================================
   COLLAPSIBLE PANELS
   ================================================ */

.panel.collapsible .panel-header {
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.panel.collapsible .panel-header:hover {
    background: #f0f0f0;
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.collapse-icon {
    font-size: 10px;
    transition: transform 0.3s ease;
    color: #666;
}

.panel.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.panel.collapsed .panel-content {
    display: none;
}

.panel-summary {
    font-size: 11px;
    color: #666;
    margin-left: auto;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.panel-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: #2b82d4;
    color: #fff;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
}

.panel-badge:empty,
.panel-badge[data-count="0"] {
    background: #ccc;
}

.btn-save-default {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: #999;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
}

.btn-save-default:hover {
    background: #e8e8e8;
    color: #2b82d4;
}

.btn-save-default.saved {
    color: #28a745;
}

/* ================================================
   VEHICLE CHECKBOX LIST
   ================================================ */

.vehicle-search-box {
    margin-bottom: 10px;
}

.vehicle-actions {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
}

.btn-link {
    background: none;
    border: none;
    color: #2b82d4;
    font-size: 11px;
    cursor: pointer;
    padding: 0;
}

.btn-link:hover {
    text-decoration: underline;
}

.vehicle-checkbox-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e8e8e8;
    border-radius: 4px;
}

.vehicle-checkbox-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    transition: background 0.15s;
}

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

.vehicle-checkbox-item:hover {
    background: #f8f9fa;
}

.vehicle-checkbox-item.selected {
    background: #e3f2fd;
}

.vehicle-checkbox-item input[type="checkbox"] {
    display: none;
}

.vehicle-checkbox-item .checkmark {
    width: 16px;
    height: 16px;
    border: 2px solid #ccc;
    border-radius: 3px;
    margin-right: 10px;
    flex-shrink: 0;
    position: relative;
    transition: all 0.15s;
}

.vehicle-checkbox-item.selected .checkmark {
    background: #2b82d4;
    border-color: #2b82d4;
}

.vehicle-checkbox-item.selected .checkmark::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.vehicle-name {
    flex: 1;
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vehicle-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 8px;
}

.vehicle-status.online {
    background: #28a745;
}

.vehicle-status.offline {
    background: #dc3545;
}

/* ================================================
   MAP LEGEND
   ================================================ */

.map-legend {
    position: absolute;
    bottom: 25px;
    right: 10px;
    background: #ffffff;
    border-radius: 6px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    z-index: 400;
    min-width: 160px;
    font-size: 11px;
    opacity: 0.95;
}

.legend-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    cursor: pointer;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #e8e8e8;
}

.legend-toggle {
    font-size: 10px;
    color: #666;
    transition: transform 0.3s ease;
}

.map-legend.collapsed .legend-toggle {
    transform: rotate(-90deg);
}

.map-legend.collapsed .legend-content {
    display: none;
}

.legend-content {
    padding: 10px 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 0;
}

.legend-marker {
    width: 16px;
    height: 16px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.legend-marker.origin {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
}

.legend-marker.waypoint {
    background: linear-gradient(135deg, #2b82d4 0%, #1a5fa8 100%);
    border-radius: 50%;
    transform: none;
}

.legend-marker.destination {
    background: linear-gradient(135deg, #dc3545 0%, #bd2130 100%);
}

.legend-line {
    width: 30px;
    height: 4px;
    border-radius: 2px;
}

.legend-line.recommended {
    background: #2b82d4;
}

.legend-line.historical {
    background: #dc3545;
    background: repeating-linear-gradient(
        90deg,
        #dc3545,
        #dc3545 6px,
        transparent 6px,
        transparent 10px
    );
}

/* Dynamic vehicle legend items */
.legend-vehicles {
    border-top: 1px solid #e8e8e8;
    margin-top: 8px;
    padding-top: 8px;
}

.legend-vehicles-title {
    font-size: 10px;
    color: #666;
    margin-bottom: 6px;
    font-weight: 600;
}

.legend-vehicle-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

.legend-vehicle-color {
    width: 24px;
    height: 4px;
    border-radius: 2px;
    flex-shrink: 0;
}

.legend-vehicle-name {
    font-size: 10px;
    color: #444;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 110px;
}

/* ================================================
   INPUT LABEL
   ================================================ */

.input-label {
    display: block;
    font-size: 11px;
    color: #666;
    margin-bottom: 5px;
}
