/* Import Modern Font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('activity-details.css');
@import url('activities-list-compact.css');

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-focus) 48%, var(--secondary) 100%);
    color: var(--base-content);
    line-height: 1.6;
    font-weight: 400;
}
:root[data-theme$='_dark'] body {
    background: linear-gradient(135deg, rgba(var(--primary-rgb,14,165,233),0.25) 0%, rgba(var(--primary-rgb,14,165,233),0.08) 40%, rgba(var(--secondary-rgb,252,111,96),0.07) 100%), var(--base-100);
    color: var(--base-content);
}

/* Login Page Styles */
.login-page {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 25px 50px rgba(30, 64, 175, 0.15);
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.login-card h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    color: var(--primary);
    font-weight: 700;
}

.subtitle { color: var(--gray-500); margin-bottom: 30px; font-size: 0.9em; font-weight: 500; }

/* Auth Tabs */
.auth-tabs {
    display: flex;
    margin-bottom: 30px;
    border-bottom: 2px solid #e2e8f0;
    border-radius: 8px 8px 0 0;
}

.tab-btn { flex:1; padding:15px; border:none; background:none; font-size:1em; cursor:pointer; color:var(--gray-500); transition:all .3s ease; border-bottom:2px solid transparent; font-weight:500; font-family:'Inter', sans-serif; }

.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, transparent); }

.tab-btn:hover { color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, transparent); }

/* Auth Forms */
.auth-form {
    display: none;
    text-align: left;
}

.auth-form.active {
    display: block;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label { display:block; margin-bottom:8px; font-weight:600; color: var(--base-content); font-size:.9em; }

.form-group input { width:100%; padding:14px 16px; border:2px solid var(--base-300); border-radius:12px; font-size:1em; transition:all .3s ease; font-family:'Inter', sans-serif; background: var(--base-200); color: var(--base-content); }

.form-group input:focus { outline:none; border-color: var(--primary); background: var(--base-100); box-shadow:0 0 0 3px rgba(var(--primary-rgb,14,165,233),0.25); }

.auth-form button { width:100%; padding:16px; border:none; border-radius:12px; background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%); color: var(--primary-content,#fff); font-size:1em; font-weight:600; cursor:pointer; transition:all .3s ease; font-family:'Inter', sans-serif; box-shadow:0 4px 15px rgba(var(--primary-rgb,14,165,233),0.30); }

.auth-form button:hover { transform:translateY(-2px); box-shadow:0 6px 20px rgba(var(--primary-rgb,14,165,233),0.40); filter: brightness(1.05); }

.error-message {
    color: #dc2626;
    text-align: center;
    margin-top: 15px;
    font-size: 0.9em;
    font-weight: 500;
}

/* Main App Styles */
.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: white;
}

/* Header */
.app-header {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 20px rgba(30, 64, 175, 0.2);
    backdrop-filter: blur(10px);
}

.header-left h1 {
    font-size: 1.8em;
    margin-bottom: 0;
    font-weight: 700;
}

.user-info {
    font-size: 0.9em;
    opacity: 0.9;
    font-weight: 500;
}

.header-right {
    display: flex;
    gap: 10px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    font-family: 'Inter', sans-serif;
}

.btn-primary {
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(100, 116, 139, 0.2);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(100, 116, 139, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.2);
}

.btn-warning:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.3);
}

/* Controls Panel */
.controls-panel {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    padding: 24px;
    border-bottom: 1px solid #cbd5e1;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    backdrop-filter: blur(10px);
}

.control-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.control-group label {
    font-weight: 600;
    color: #1f2937;
    white-space: nowrap;
    font-size: 0.9em;
}

.user-checkboxes {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.user-checkbox {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.user-checkbox:hover {
    border-color: #667eea;
}

.user-checkbox input[type="checkbox"] {
    margin: 0;
}

.user-checkbox.checked {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.time-input {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.9em;
}

.time-input:focus {
    outline: none;
    border-color: #667eea;
}

/* Playback Controls */
.playback-controls {
    width: 100%;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.speed-control,
.progress-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.speed-control input[type="range"],
.progress-control input[type="range"] {
    width: 150px;
}

#progress-time {
    font-size: 0.9em;
    color: #666;
    min-width: 100px;
}

/* Map Container */
.map-container {
    position: relative;
    min-height: 500px; /* Ensuring a minimum height */
    flex: 1;
    width: 100%;
}

#map {
    height: 100%;
    width: 100%;
    min-height: 500px; /* Ensuring a minimum height */
}

/* Themed map border */
.themed-map {
    border: 2px solid var(--primary, #1e40af);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb,30,64,175),0.15), 0 0 0 1px rgba(var(--primary-rgb,30,64,175),0.25);
    background: var(--base-100, #fff);
}
:root[data-theme$='_dark'] .themed-map {
    border-color: var(--primary, #3b82f6);
    box-shadow: 0 4px 18px rgba(0,0,0,0.55), 0 0 0 1px rgba(var(--primary-rgb,59,130,246),0.35);
    background: var(--base-200, #0f172a);
}

/* Custom Leaflet Styles */
.rider-marker {
    background-color: #667eea;
    border: 1px solid white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Legacy speed-label (replaced by speed-flag) */
/*
.speed-label {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
    margin-left: 25px;
    margin-top: -10px;
}
*/

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
}

.close:hover {
    color: #333;
}

.modal h2 {
    margin-bottom: 20px;
    color: #333;
}

#upload-status {
    margin-top: 15px;
    padding: 10px;
    border-radius: 8px;
    display: none;
}

.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Speed Flag Styles */
.speed-flag {
    position: relative;
    font-size: 12px;
    font-weight: bold;
    pointer-events: none;
}

.flag-pole {
    position: absolute;
    left: 2px;
    top: 5px;
    width: 2px;
    height: 25px;
    background-color: #333;
    border-radius: 1px;
}

.flag-content {
    position: absolute;
    left: 6px;
    top: 2px;
    background: #ff4444; /* Default color, will be overridden by inline styles */
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    white-space: nowrap;
    font-size: 11px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    border: 1px solid #cc0000;
}

.flag-content::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 6px solid inherit;
}

/* Quiver Management Styles */
.quiver-panel {
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.quiver-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e2e8f0;
}

.quiver-header h2 {
    font-size: 2em;
    color: #1e40af;
    font-weight: 700;
    margin: 0;
}

/* Equipment Categories */
.equipment-categories {
    margin-bottom: 24px;
}

.category-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.category-tab {
    padding: 12px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: white;
    color: #64748b;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
}

.category-tab:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.05);
}

.category-tab.active {
    background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
    color: white;
    border-color: #1e40af;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

/* Equipment List */
.equipment-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.equipment-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
    position: relative;
}

.equipment-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.15);
    border-color: #3b82f6;
}

.equipment-card .equipment-type {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 600;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.equipment-card .equipment-type.vela {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.equipment-card .equipment-type.prancha {
    background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
    color: white;
}

.equipment-card .equipment-type.fin {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.equipment-card .equipment-name {
    font-size: 1.2em;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 16px;
    line-height: 1.4;
}

.equipment-card .equipment-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

.equipment-card .btn-small {
    padding: 6px 12px;
    font-size: 0.8em;
    border-radius: 6px;
}

.equipment-card .equipment-date {
    font-size: 0.8em;
    color: #64748b;
    margin-top: 8px;
}

/* Equipment Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 32px;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

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

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #64748b;
    transition: color 0.3s ease;
}

.close:hover {
    color: #1e40af;
}

.modal h2 {
    margin-bottom: 24px;
    color: #1e40af;
    font-weight: 700;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

.modal select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1em;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
    background: #f8fafc;
}

.modal select:focus {
    outline: none;
    border-color: #3b82f6;
    background: white;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.modal #modal-status {
    margin-top: 16px;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
}

.modal #modal-status.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.modal #modal-status.error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 40px;
    color: #64748b;
    font-size: 1.1em;
    font-weight: 500;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
}

.empty-state h3 {
    font-size: 1.4em;
    margin-bottom: 12px;
    color: #1f2937;
}

.empty-state p {
    margin-bottom: 24px;
}

/* Table Styles */
.table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    margin-top: 20px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table thead {
    background: linear-gradient(135deg, #1e40af, #1e3a8a);
    color: white;
}

.data-table th {
    padding: 16px 20px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 16px 20px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: #f9fafb;
    transition: background-color 0.2s ease;
}

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

/* Equipment Type Badges */
.equipment-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-transform: capitalize;
}

.equipment-type-vela {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.equipment-type-prancha {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
    border: 1px solid #fbbf24;
}

.equipment-type-fin {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #065f46;
    border: 1px solid #34d399;
}

/* Actions Cell */
.actions-cell {
    text-align: center;
    white-space: nowrap;
}

.actions-cell .btn-icon {
    margin: 0 4px;
}

/* Responsive Table */
@media (max-width: 768px) {
    .table-container {
        overflow-x: auto;
    }
    
    .data-table {
        min-width: 600px;
    }
    
    .data-table th,
    .data-table td {
        padding: 12px 16px;
    }
}

/* Form Select Styling */
select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    cursor: pointer;
}

select:focus {
    outline: none;
    border-color: #1e40af;
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

select option {
    padding: 12px;
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Top Speed Flag Styles */
.top-speed-flag {
    position: relative;
    font-size: 12px;
    font-weight: bold;
    pointer-events: auto;
    z-index: 1000;
}

.top-speed-pole {
    position: absolute;
    left: 2px;
    top: 5px;
    width: 1px;
    height: 30px;
    background-color: #000000;
    border-radius: 1px;
}

.top-speed-content {
    position: absolute;
    top: -15px;
    bottom: 20px;
    left: 12px;
    padding: 5px 10px;
    border-radius: 4px;
    background: var(--ts-bg, #4784b0);
    opacity: 0.85;
    border: 1px solid var(--ts-border, rgba(0,0,0,0.25));
    white-space: nowrap;
    font-weight: bold;
    color: #ffffff;
    box-shadow: 2px 2px 6px rgba(0,0,0,0.25);
}

.top-speed-content::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-right: 8px solid var(--ts-bg, #4784b0);
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Map toggle (max speed flags) */
.map-toggle {
    --toggle-bg: var(--base-200, rgba(255,255,255,0.35));
    --toggle-border: var(--base-300, rgba(0,0,0,0.15));
    --toggle-thumb: var(--primary, #1e40af);
    --toggle-thumb-glow: rgba(var(--primary-rgb,30,64,175),0.55);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    background: var(--toggle-bg);
    color: var(--base-content,#222);
    padding: 6px 10px 6px 8px;
    border-radius: 999px;
    border: 1px solid var(--toggle-border);
    cursor: pointer;
    user-select: none;
    line-height: 1;
    position: relative;
    transition: background .25s ease, border-color .25s ease;
}
.map-toggle input {
    position: absolute;
    opacity: 0;
    inset: 0;
    margin: 0;
    cursor: pointer;
}
.map-toggle .toggle-indicator {
    --w: 30px;
    --h: 20px;
    position: relative;
    width: var(--w);
    height: var(--h);
    background: linear-gradient(135deg,var(--base-300,#d1d5db),var(--base-200,#e5e7eb));
    border-radius: 999px;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.25);
    transition: background .3s ease;
}
.map-toggle .toggle-indicator::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: calc(var(--h) - 4px);
    height: calc(var(--h) - 4px);
    background: radial-gradient(circle at 30% 30%, #fff, var(--toggle-thumb));
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.6);
    transition: transform .3s cubic-bezier(.55,.2,.35,1), background .3s ease, box-shadow .3s ease;
}
.map-toggle input:checked + .toggle-indicator {
    background: linear-gradient(135deg,var(--toggle-thumb) 0%, color-mix(in srgb,var(--toggle-thumb) 80%, #ffffff) 100%);
}
.map-toggle input:checked + .toggle-indicator::after {
    transform: translateX(14px);
    background: radial-gradient(circle at 30% 30%, #fff, var(--toggle-thumb));
    box-shadow: 0 0 0 3px var(--toggle-thumb-glow), 0 2px 4px rgba(0,0,0,0.4);
}
.map-toggle:hover .toggle-indicator::after { box-shadow: 0 0 0 4px rgba(var(--primary-rgb,30,64,175),0.25), 0 2px 4px rgba(0,0,0,0.4); }
.map-toggle:active .toggle-indicator::after { transform: translateX(2px) scale(.9); }
.map-toggle input:checked:active + .toggle-indicator::after { transform: translateX(14px) scale(.9); }
.map-toggle .toggle-label { font-weight: 600; letter-spacing: .5px; }
:root[data-theme$='_dark'] .map-toggle { --toggle-bg: rgba(255,255,255,0.08); --toggle-border: rgba(255,255,255,0.18); color: #f1f5f9; }
:root[data-theme$='_dark'] .map-toggle .toggle-indicator { background: linear-gradient(135deg,#334155,#475569); }
:root[data-theme$='_dark'] .map-toggle input:checked + .toggle-indicator { background: linear-gradient(135deg,var(--toggle-thumb) 0%, color-mix(in srgb,var(--toggle-thumb) 70%, #ffffff) 100%); }

/* Painel fixo de velocidades dos riders */
.rider-speed-panel {
    position: absolute;
    top: 100px;
    left: 10px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: calc(100% - 20px);
    overflow-y: auto;
    padding-right: 4px;
}

.rider-speed-item {
    display: flex;
    align-items: center;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(4px);
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    min-width: 140px;
    gap: 8px;
    border: 1px solid rgba(255,255,255,0.15);
}

.rider-speed-color {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #fff;
    flex-shrink: 0;
}

.rider-speed-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rider-speed-value {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: .5px;
}

@media (max-width: 768px) {
   /* .rider-speed-panel { top: auto; bottom: 10px; left: 10px; right: 10px; flex-direction: row; flex-wrap: wrap; }*/
    .rider-speed-item { min-width: calc(50% - 8px); }
}

/* Map Maximized State */
.card.maximized {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 1050;
    margin: 0;
    border-radius: 0;
    background-color: #fff;
    display: flex;
    flex-direction: column;
}
.card.maximized .card-body { flex:1 1 auto; display:flex; flex-direction:column; min-height:0; }
.card.maximized .card-body > #map-container { flex:1 1 auto; height:auto !important; min-height:0 !important; display:flex; flex-direction:column; }
.card.maximized .card-body > #map-container > #map { flex:1 1 auto; height:100% !important; min-height:0 !important; }

.card.maximized #map-container {
    flex: 1 1 auto;
    height: auto !important;
    min-height: 0 !important;
    display: flex;
    flex-direction: column;
}

.card.maximized #map {
    flex: 1 1 auto;
    height: 100% !important;
    min-height: 0 !important;
}

.card.maximized .card-header {
    border-radius: 0;
    padding: 15px 20px;
}

#maximize-map-btn {
    transition: all 0.3s ease;
}

.card.maximized #maximize-map-btn .expand-icon {
    transform: rotate(180deg);
    display: inline-block;
}

.card.maximized #maximize-map-btn .button-text::after {
    content: "";
}

.card:not(.maximized) #maximize-map-btn .button-text::after {
    content: "";
}

#maximize-map-btn .button-text {
    font-size: 0;
}

#maximize-map-btn .button-text::after {
    font-size: 14px;
}

/* Mobile adjustments for dynamic viewport (address bar hiding) */
@media (max-width: 768px) {
    .card.maximized { height: 100dvh; }
    .card.maximized #map { height: 100% !important; }
 
}

/* Fallback for browsers without 100dvh support: set --vh via JS (optional) */
html[data-use-vh] .card.maximized { height: calc(var(--vh, 1vh) * 100); }
html[data-use-vh] .card.maximized #map { height: 100% !important; }

/*. MAP index.html*/
@media (max-width: 576px) {
  
   .card {
      background-color: var(--base-300) !important;
   }
}
