/**
 * Choice Tray Component Styles
 * A minimal, elegant bottom tray for primary path selection.
 * @adheres {Axiom of Radical Simplicity}
 */

.choice-tray {
    position: absolute;
    bottom: 20px; /* Position inside the map container */
    left: 50%;
    transform: translate(-50%, 120%); /* Start hidden below the map bottom */
    width: auto;
    max-width: 95%; /* Increased from 90% to utilize more horizontal space */
    min-width: 800px; /* Ensure minimum width for configuration panels */
    background: rgba(249, 250, 251, 0.8); /* Light, semi-transparent */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-bottom: none;
    border-radius: 16px; /* Rounded corners on all sides */
    padding: 16px 20px;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.1);
    z-index: 1100;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center; /* Vertically center the buttons */
    gap: 16px; /* Further increased spacing */
}

.choice-tray .choice-tray-btn {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.choice-tray.exiting .choice-tray-btn {
    opacity: 0;
    transform: translateY(10px);
}

.choice-tray.visible {
    transform: translate(-50%, 0); /* Slide into view */
}

.choice-tray-btn {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: #374151; /* Dark Gray */
    padding: 0 28px; /* Padding is now for horizontal only */
    border-radius: 10px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; /* Vertically center content */
    gap: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    height: 100px; /* Increased uniform height for more air */
}

.back-btn {
    padding: 0; /* Centering is handled by flexbox */
    width: 100px; /* Match uniform height for a circle */
    height: 100px; /* Match uniform height */
    flex-shrink: 0;
}

.back-btn .material-symbols-outlined {
    font-size: 24px;
}

.choice-tray-btn:not(.back-btn) {
    min-width: 220px; /* Enforce a consistent minimum width on choice buttons only */
}

.choice-tray-btn:hover {
    background: white;
    border-color: rgba(0, 0, 0, 0.1);
    color: #111827; /* Black */
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.choice-tray-btn .btn-title {
    font-size: 16px;
    font-weight: 500;
    color: #111827;
}

.choice-tray-btn .btn-subtitle {
    font-size: 12px;
    font-weight: 400;
    color: #6B7280; /* Medium Gray */
}

/* Final Configuration Panel Styles */
.config-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 200px; /* Expand card height for better breathing room */
}

/* Configuration Five-Section Layout - A | B | CD | E */
.config-five-section-layout {
    display: flex;
    gap: 20px;
    align-items: center;
    min-height: 100px;
    width: 100%;
}

.config-section-a {
    flex-shrink: 0;
    width: 100px;
}

.config-section-b {
    flex: 1;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.config-section-cd {
    flex: 2;
    min-width: 380px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 100px;
    justify-content: space-between;
    padding: 8px 0;
}

.config-cd-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 30px;
    flex-shrink: 0;
}

.aoi-label {
    display: flex;
    align-items: center;
}

.aoi-label label {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.config-cd-bottom-row {
    display: flex;
    align-items: stretch;
    width: 100%;
    flex: 1;
    min-height: 50px;
}

.config-section-e {
    flex-shrink: 0;
    width: 200px;
    padding-right: 20px;
}

.choice-title {
    text-align: left;
    margin-bottom: 8px;
}

.choice-title h2 {
    margin: 0 0 2px 0;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

.choice-title p {
    margin: 0;
    font-size: 12px;
    color: #6B7280;
}

.config-header h3 {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.config-header p {
    margin: 0;
    font-size: 14px;
    color: #6B7280;
}

.config-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Toggle Switch Styles */
.size-mode-toggle {
    display: flex;
    align-items: center;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

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

.toggle-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background: #E5E7EB;
    border-radius: 12px;
    transition: background 0.2s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-label input[type="checkbox"]:checked + .toggle-slider {
    background: #6B7280;
}

.toggle-label input[type="checkbox"]:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* AOI Slider Styles */
.aoi-slider-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    height: 100%;
    justify-content: center;
}

.aoi-slider-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    height: 100%;
    justify-content: center;
}

.aoi-slider-controls input[type="range"] {
    width: 100%;
    height: 6px;
    background: #E5E7EB;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.aoi-slider-controls input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none !important;
    width: 20px !important;
    height: 20px !important;
    background: #D97706 !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    border: none !important;
}

.aoi-slider-controls input[type="range"]::-moz-range-thumb {
    width: 20px !important;
    height: 20px !important;
    background: #D97706 !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    border: none !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2) !important;
}

.aoi-slider-container label {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.aoi-slider-container input[type="range"] {
    width: 100%;
    height: 6px;
    background: #E5E7EB;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    appearance: none; /* Standard property for compatibility */
}

.aoi-slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: #D97706;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.aoi-slider-container input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #D97706;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

#aoi-size-display {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    text-align: center;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 6px;
}

.config-actions {
    display: flex;
    justify-content: center;
    margin-top: 8px;
}

.config-btn {
    min-width: 200px;
}

/* Back button in header - CONSISTENT STYLING */
.config-section-a .back-btn {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: #374151;
    padding: 0;
    width: 100px;
    height: 100px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    flex-shrink: 0;
}

.config-section-a .back-btn:hover {
    background: white;
    border-color: rgba(0, 0, 0, 0.1);
    color: #111827;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.choice-header .back-btn:hover {
    background: #F9FAFB;
    border-color: #D1D5DB;
    color: #374151;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.choice-header .back-btn:active {
    transform: translateY(0);
    background: #F3F4F6;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Ensure toggle switch displays properly */
.toggle-container {
    margin-bottom: 0;
}

.toggle-switch {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.toggle-switch input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background-color: #E5E7EB;
    border-radius: 12px;
    transition: background-color 0.3s ease;
    flex-shrink: 0;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-switch input[type="checkbox"]:checked + .toggle-slider {
    background-color: #6B7280;
}

.toggle-switch input[type="checkbox"]:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.toggle-text {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

/* Configuration Mode Instructions */
.config-panel::after {
    content: "💡 Click anywhere on the map or drag the AOI area to reposition (pin always snaps to grid center)";
    display: block;
    font-size: 12px;
    color: #6B7280;
    text-align: center;
    margin-top: 20px;
    font-style: italic;
}

/* Choice Content Area - removed as content is now directly in config-panel */

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .choice-tray {
        transition: none;
    }
    
    .toggle-slider,
    .toggle-slider::before {
        transition: none;
    }
}
