/**
 * Layer Control Panel Styles
 *
 * Shared styles for the layer control panel used in both the interactive
 * viewer and public viewer. Ensures consistent appearance across both views.
 */

/* ============================================================================
   Control Panel Container
   ============================================================================ */

.layer-control-panel {
    position: absolute;
    bottom: 30px;
    right: 10px;
    background: rgba(30, 30, 30, 0.95);
    color: #fff;
    border-radius: 8px;
    width: 280px;
    max-width: calc(100vw - 20px);
    z-index: 1000;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

/* ============================================================================
   Panel Header
   ============================================================================ */

.layer-control-header {
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    order: 2;  /* Place header at bottom */
}

.layer-control-header h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #4ECDC4;
}

.layer-control-header i {
    transition: transform 0.3s ease;
    color: #888;
    transform: rotate(180deg);  /* Point up when expanded */
}

.layer-control-header.collapsed i {
    transform: rotate(0deg);  /* Point down when collapsed */
}

/* ============================================================================
   Panel Body
   ============================================================================ */

.layer-control-body {
    padding: 12px 16px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    transition: all 0.3s ease;
    order: 1;  /* Place body above header */
}

.layer-control-body.collapsed {
    display: none;
}

/* ============================================================================
   Layer Sections
   ============================================================================ */

.layer-section {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.layer-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.layer-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    cursor: pointer;
    gap: 10px;
}

.layer-section-header h5 {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: #e0e0e0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    text-align: center;
    justify-content: center;
}

.layer-section-header .collapse-icon {
    font-size: 0.7rem;
    transition: transform 0.3s ease;
    color: #666;
    flex-shrink: 0;
}

.layer-section-header[aria-expanded="false"] .collapse-icon {
    transform: rotate(-90deg);
}

/* ============================================================================
   Toggle Switch
   ============================================================================ */

.layer-toggle {
    position: relative;
    width: 44px;
    height: 24px;
    background: #444;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.3s;
    flex-shrink: 0;
}

.layer-toggle.active {
    background: #4ECDC4;
}

.layer-toggle::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s;
}

.layer-toggle.active::after {
    transform: translateX(20px);
}

/* ============================================================================
   Control Groups
   ============================================================================ */

.control-group {
    margin-bottom: 12px;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-label {
    display: block;
    font-size: 0.8125rem;
    color: #b0b0b0;
    margin-bottom: 6px;
    font-weight: 500;
}

/* ============================================================================
   Sliders
   ============================================================================ */

.slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: #444;
    border-radius: 3px;
    outline: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #4ECDC4;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
}

.slider::-webkit-slider-thumb:hover {
    background: #3ba8a0;
}

.slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #4ECDC4;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.slider::-moz-range-thumb:hover {
    background: #3ba8a0;
}

.slider-value {
    font-size: 0.8125rem;
    color: #fff;
    min-width: 40px;
    text-align: right;
    font-weight: 500;
}

/* ============================================================================
   Radio Buttons
   ============================================================================ */

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.radio-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.radio-option:hover {
    background: rgba(255, 255, 255, 0.05);
}

.radio-option input[type="radio"] {
    margin: 0 10px 0 0;
    accent-color: #4ECDC4;
    cursor: pointer;
}

.radio-option label {
    margin: 0;
    font-size: 0.8125rem;
    color: #e0e0e0;
    cursor: pointer;
    flex: 1;
}

/* ============================================================================
   Custom Scrollbar
   ============================================================================ */

.layer-control-body::-webkit-scrollbar {
    width: 6px;
}

.layer-control-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.layer-control-body::-webkit-scrollbar-thumb {
    background: rgba(78, 205, 196, 0.5);
    border-radius: 3px;
}

.layer-control-body::-webkit-scrollbar-thumb:hover {
    background: rgba(78, 205, 196, 0.7);
}

/* ============================================================================
   Assay Legend
   ============================================================================ */

/* Old .assay-legend CSS removed - now using Bootstrap card from HTML template */
/* The #assay-legend element in the HTML template uses Bootstrap classes for styling */

.assay-legend-header {
    font-size: 0.875rem;
    color: #4ECDC4;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #444;
    text-align: center;
}

.assay-legend-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.assay-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.assay-legend-color {
    width: 20px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.assay-legend-label {
    font-size: 0.75rem;
    color: #e0e0e0;
    flex: 1;
}

/* Legend sections for combined drill + point sample legends */
/* Legend panel collapse behavior */
.legend-header {
    cursor: pointer;
}

.legend-header .legend-collapse-icon {
    transition: transform 0.3s ease;
}

.legend-header.collapsed .legend-collapse-icon {
    transform: rotate(180deg);
}

.legend-body {
    transition: all 0.3s ease;
}

.legend-body.collapsed,
#legend-content.collapsed {
    display: none !important;
}

.assay-legend-content,
#legend-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.legend-section {
    display: none; /* Hidden by default, shown when active */
    background: transparent; /* Inherit parent background */
}

.legend-section:not(:first-child) {
    padding-top: 12px;
    border-top: 1px solid #444;
    margin-top: 4px;
}

.legend-section-header {
    font-size: 0.875rem;
    color: #4ECDC4;
    margin-bottom: 8px;
    background: transparent; /* No background override */
}

.legend-section-header strong {
    color: #4ECDC4;
    font-weight: 600;
}

.legend-section-subtitle {
    font-size: 0.75rem;
    color: #999;
    margin-top: 2px;
    font-weight: normal;
}

/* ============================================================================
   Mobile Responsiveness
   ============================================================================ */

@media (max-width: 576px) {
    .layer-control-panel {
        bottom: 15px;
        right: 10px;
        left: 10px;
        width: auto;
        max-height: 50vh;
    }

    /* When collapsed on mobile, make it half width to match public map */
    .layer-control-panel:has(.layer-control-body.collapsed) {
        left: auto;
        width: 140px;
    }

    .layer-control-body {
        max-height: calc(50vh - 60px);
    }
}
