* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#map {
    width: 100%;
    height: 100vh;
    z-index: 1;
}

/* UI Panel with Glassmorphism */
#ui-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.6);
    z-index: 1000;
    width: 340px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    color: #2c3e50;
}

.panel-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.panel-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    padding-bottom: 12px;
}

/* Mode Switcher */
.mode-switcher {
    display: flex;
    background: rgba(241, 245, 249, 0.8);
    border-radius: 8px;
    padding: 4px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.mode-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0;
}

.mode-btn.active {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.mode-btn:hover:not(.active) {
    color: #334155;
    background: rgba(255, 255, 255, 0.4);
}

/* Mode Content */
.mode-content {
    display: none;
    flex-direction: column;
    gap: 12px;
}

.mode-content.active {
    display: flex;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.instruction {
    font-size: 0.85rem;
    color: #64748b;
    margin: 0;
    line-height: 1.5;
}

.point-info {
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.6);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    word-break: break-all;
    display: flex;
    align-items: center;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
}

.start-dot { background-color: #10b981; }
.end-dot { background-color: #ef4444; }

.options-group {
    background: rgba(255, 255, 255, 0.6);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.custom-checkbox {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    color: #334155;
    cursor: pointer;
    user-select: none;
}

.custom-checkbox input {
    margin-right: 8px;
    cursor: pointer;
    accent-color: #0ea5e9;
}

/* Buttons */
.action-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: #0ea5e9;
    color: white;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.25);
    margin-top: 4px;
}

.action-btn:hover:not(:disabled) { 
    background: #0284c7; 
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(14, 165, 233, 0.35);
}

.action-btn:disabled,
#calc-poly-btn:disabled { 
    background: #e2e8f0; 
    color: #94a3b8;
    cursor: not-allowed; 
    box-shadow: none;
    transform: none;
}

#calc-poly-btn {
    background: #f97316;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.25);
}

#calc-poly-btn:hover:not(:disabled) { 
    background: #ea580c;
    box-shadow: 0 6px 16px rgba(249, 115, 22, 0.35);
}

.panel-footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.secondary-btn {
    width: 100%;
    padding: 10px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.5);
    color: #475569;
}

.secondary-btn:hover { 
    background: #f1f5f9; 
    color: #0f172a;
    border-color: rgba(148, 163, 184, 0.5);
}

#status-msg {
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
    min-height: 20px;
}

/* Legend */
#route-legend {
    padding-top: 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

#route-legend h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 12px;
}

.legend-item {
    font-size: 0.85rem;
    color: #475569;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
}

.line {
    display: inline-block;
    width: 24px;
    height: 4px;
    margin-right: 12px;
    border-radius: 2px;
}

.line-blue {
    background-color: #0ea5e9;
}

.line-red-dashed {
    background-color: transparent;
    border-bottom: 3px dashed #ef4444;
}

/* Timeline Player */
.route-path-animated {
    transition: stroke-opacity 0.2s ease-out;
}

#timeline-container {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 10px 20px;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 15px;
    width: 80%;
    max-width: 600px;
}

#play-pause-btn {
    background: #0ea5e9;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.25);
    padding-left: 3px; /* Optically center the play icon */
}

#play-pause-btn:hover {
    background: #0284c7;
    transform: scale(1.05);
}

#play-pause-btn.playing {
    padding-left: 0; /* Pause icon is naturally centered */
    background: #ef4444;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

#play-pause-btn.playing:hover {
    background: #dc2626;
}

#timeline-slider {
    flex-grow: 1;
    cursor: pointer;
}

#timeline-step-label {
    font-size: 14px;
    font-weight: bold;
    color: #333;
    min-width: 60px;
    text-align: right;
}

.timeline-control-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.timeline-control-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.timeline-control-group select,
.timeline-control-group input[type="number"] {
    padding: 6px 10px;
    border: 1px solid rgba(0,0,0,0.15);
    border-radius: 6px;
    font-size: 0.85rem;
    color: #334155;
    background: #f8fafc;
    transition: border-color 0.2s;
    outline: none;
}

.timeline-control-group select:focus,
.timeline-control-group input[type="number"]:focus {
    border-color: #0ea5e9;
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.2);
}

.timeline-control-group input[type="number"] {
    width: 65px;
}

/* Modal and Info Button */
.info-btn {
    background: #0ea5e9;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.info-btn:hover {
    background: #0284c7;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    position: relative;
    color: #334155;
}

.modal-content h3 {
    margin-bottom: 15px;
    color: #0f172a;
}

.modal-content p {
    margin-bottom: 10px;
    line-height: 1.5;
    font-size: 0.95rem;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.2s;
    z-index: 10;
}

.close-btn:hover {
    color: #ef4444;
}

/* Elegant Modal Enhancements */
.elegant-modal {
    padding: 0;
    overflow: hidden;
}

.elegant-modal .modal-header {
    background: #f8fafc;
    padding: 25px 30px;
    border-bottom: 1px solid #e2e8f0;
}

.elegant-modal .modal-header h3 {
    margin-bottom: 8px;
    font-size: 1.5rem;
    color: #0f172a;
}

.discipline-badge {
    display: inline-block;
    background: #e0f2fe;
    color: #0369a1;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.elegant-modal .modal-body {
    padding: 30px;
}

.project-desc {
    font-size: 1.05rem;
    color: #475569;
    margin-bottom: 25px;
    line-height: 1.6;
}

.authors-section {
    margin-bottom: 25px;
}

.authors-section h4 {
    font-size: 0.9rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 15px;
}

.authors-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.author-card {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    text-decoration: none;
    color: #1e293b;
    font-weight: 500;
    transition: all 0.2s ease;
}

.author-card:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 15px;
    border: 2px solid #e2e8f0;
}

.institution-section p {
    text-align: center;
    color: #64748b;
    margin: 0;
    font-size: 0.95rem;
    padding-top: 15px;
    border-top: 1px dashed #e2e8f0;
}
