/**
 * Route Planner Widget Styles
 *
 * @package Voxel_Toolkit
 */

/* Fix OpenStreetMap route line - prevent fill */
.vt-route-map path.leaflet-interactive {
    fill: none !important;
    fill-opacity: 0 !important;
}

/* ============================================
   Container Styles
   ============================================ */

.vt-route-planner-wrapper {
    position: relative;
}

/* ============================================
   Content Layout
   ============================================ */

.vt-route-content {
    display: flex;
    gap: 16px;
}

.vt-panel-right .vt-route-content {
    flex-direction: row;
}

.vt-panel-left .vt-route-content {
    flex-direction: row-reverse;
}

.vt-panel-bottom .vt-route-content {
    flex-direction: column;
}

/* ============================================
   Map Container
   ============================================ */

.vt-route-map {
    flex: 1;
    min-height: 400px;
    border-radius: 8px;
    overflow: hidden;
    background: #f3f4f6;
}

/* ============================================
   Travel Mode Buttons
   ============================================ */

.vt-route-travel-modes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.vt-travel-mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.vt-travel-mode-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

.vt-travel-mode-btn.active {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}

.vt-travel-mode-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ============================================
   Directions Panel
   ============================================ */

.vt-route-directions-panel {
    width: 320px;
    min-width: 280px;
    max-height: 600px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    flex-shrink: 0;
}

.vt-panel-bottom .vt-route-directions-panel {
    width: 100%;
    max-height: 350px;
}

/* Custom scrollbar for directions panel */
.vt-route-directions-panel::-webkit-scrollbar {
    width: 6px;
}

.vt-route-directions-panel::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.vt-route-directions-panel::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.vt-route-directions-panel::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* ============================================
   Route Summary
   ============================================ */

.vt-route-summary {
    display: flex;
    gap: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 14px;
}

.vt-route-distance,
.vt-route-duration {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 15px;
    color: #1f2937;
}

.vt-route-distance svg,
.vt-route-duration svg {
    color: #6b7280;
}

/* ============================================
   Waypoints List
   ============================================ */

.vt-waypoints {
    list-style: none;
    padding: 0;
    margin: 0 0 16px 0;
}

.vt-waypoint-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #f9fafb;
    margin-bottom: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.vt-waypoint-item:hover {
    background: #f3f4f6;
}

.vt-waypoint-item[draggable="true"] {
    cursor: grab;
}

.vt-waypoint-item[draggable="true"]:active {
    cursor: grabbing;
}

.vt-waypoint-item.dragging {
    opacity: 0.5;
    background: #e5e7eb;
}

.vt-waypoint-marker {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #3b82f6;
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.vt-waypoint-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.vt-waypoint-label {
    font-size: 14px;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vt-waypoint-address {
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vt-waypoint-link {
    font-size: 12px;
    color: #3b82f6;
    text-decoration: none;
    flex-shrink: 0;
}

.vt-waypoint-link:hover {
    text-decoration: underline;
}

/* ============================================
   Direction Steps
   ============================================ */

.vt-direction-steps {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: step;
}

.vt-direction-step {
    display: flex;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    transition: background 0.2s;
}

.vt-direction-step:last-child {
    border-bottom: none;
}

.vt-direction-step:hover {
    background: #f9fafb;
    margin: 0 -16px;
    padding-left: 16px;
    padding-right: 16px;
}

.vt-direction-step.active {
    background: #eff6ff;
    margin: 0 -16px;
    padding-left: 16px;
    padding-right: 16px;
}

.vt-step-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: #6b7280;
    flex-shrink: 0;
}

.vt-step-content {
    flex: 1;
    min-width: 0;
}

.vt-step-instruction {
    display: block;
    font-size: 14px;
    color: #1f2937;
    line-height: 1.4;
    margin-bottom: 4px;
}

.vt-step-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #6b7280;
}

/* ============================================
   Map Markers
   ============================================ */

/* Voxel wraps markers in .marker-wrapper - needs absolute positioning */
.vt-route-map .marker-wrapper {
    position: absolute;
}

.vt-route-marker {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #3b82f6;
    color: #fff;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.vt-route-marker:hover {
    transform: scale(1.1);
}

/* ============================================
   Map Popups
   ============================================ */

.vt-route-popup {
    padding: 12px;
    min-width: 150px;
    max-width: 250px;
}

.vt-popup-title {
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}

.vt-popup-address {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 8px;
}

.vt-popup-link {
    display: inline-block;
    font-size: 13px;
    color: #3b82f6;
    text-decoration: none;
}

.vt-popup-link:hover {
    text-decoration: underline;
}

/* ============================================
   Loading State
   ============================================ */

.vt-route-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.9);
    z-index: 10;
    border-radius: 8px;
}

.vt-route-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: vt-route-spin 0.8s linear infinite;
}

.vt-route-loading-text {
    font-size: 14px;
    color: #6b7280;
}

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

/* ============================================
   Empty/Error States
   ============================================ */

.vt-route-empty,
.vt-route-error {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    padding: 40px;
    text-align: center;
    color: #6b7280;
    font-size: 15px;
    background: #f9fafb;
    border-radius: 8px;
}

.vt-route-error {
    color: #ef4444;
    background: #fef2f2;
}

/* ============================================
   Placeholder in Editor
   ============================================ */

.vt-route-planner-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 40px;
    background: #f9fafb;
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    text-align: center;
}

.vt-placeholder-icon {
    font-size: 48px;
    color: #9ca3af;
}

.vt-placeholder-text {
    font-size: 18px;
    font-weight: 600;
    color: #374151;
}

.vt-placeholder-description {
    font-size: 14px;
    color: #6b7280;
    max-width: 300px;
}

/* ============================================
   Export Buttons
   ============================================ */

.vt-route-export-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

.vt-route-export-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.vt-route-export-btn:hover {
    background: #2563eb;
}

.vt-route-export-btn:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.vt-route-export-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ============================================
   Responsive Styles
   ============================================ */

@media (max-width: 768px) {
    .vt-route-content {
        flex-direction: column;
    }

    .vt-panel-left .vt-route-content,
    .vt-panel-right .vt-route-content {
        flex-direction: column;
    }

    .vt-route-directions-panel {
        width: 100%;
        min-width: 100%;
        max-height: 350px;
    }

    .vt-route-travel-modes {
        justify-content: center;
    }

    .vt-travel-mode-btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    .vt-travel-mode-btn span {
        display: none;
    }

    .vt-route-map {
        min-height: 300px;
    }

    .vt-route-summary {
        justify-content: center;
    }

    .vt-route-export-buttons {
        justify-content: center;
    }

    .vt-route-export-btn {
        padding: 8px 12px;
        font-size: 13px;
    }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    .vt-route-travel-modes,
    .vt-route-export-buttons {
        display: none;
    }

    .vt-route-map {
        min-height: 400px;
        page-break-inside: avoid;
    }

    .vt-route-directions-panel {
        max-height: none;
        overflow: visible;
        page-break-inside: avoid;
    }

    .vt-direction-step:hover,
    .vt-direction-step.active {
        background: none;
        margin: 0;
        padding-left: 0;
        padding-right: 0;
    }
}
