/* Heap Detail Page Styles */

/* Back Button */
.btn-back {
    background-color: #f7941d;
    border-color: #f7941d;
    color: #fff;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-back:hover,
.btn-back:focus {
    background-color: #d97a0a;
    border-color: #d97a0a;
    color: #fff;
}

/* Gallery Count Badge */
.gallery-count-badge {
    background-color: #f7941d !important;
    color: #fff;
}

/* Quick Stats Section */
.quick-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    min-width: 120px;
}

.stat-item .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
}

.stat-item .stat-label {
    font-size: 0.75rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-weight: 600;
    font-size: 0.875rem;
}

.status-badge.status-active {
    background-color: #dc354520;
    color: #dc3545;
}

.status-badge.status-inactive {
    background-color: #f7941d20;
    color: #d97a0a;
}

.status-badge i {
    margin-right: 0.5rem;
}

/* Accordion Sections */
.detail-accordion .accordion-item {
    border: none;
    margin-bottom: 0.5rem;
    border-radius: 0.5rem !important;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.detail-accordion .accordion-header {
    margin: 0;
}

.detail-accordion .accordion-button {
    background-color: #f7941d;
    color: #fff;
    font-weight: 600;
    padding: 1rem 1.25rem;
    border-radius: 0.5rem !important;
}

.detail-accordion .accordion-button:not(.collapsed) {
    background-color: #f7941d;
    color: #fff;
    box-shadow: none;
}

.detail-accordion .accordion-button:focus {
    box-shadow: 0 0 0 0.25rem rgba(247, 148, 29, 0.25);
}

.detail-accordion .accordion-button::after {
    filter: brightness(0) invert(1);
    transition: transform 0.3s;
    transform: rotate(0deg);
}

.detail-accordion .accordion-button.collapsed {
    background-color: #f8f9fa;
    color: #333;
}

.detail-accordion .accordion-button.collapsed::after {
    filter: none;
    transform: rotate(-90deg);
}

.detail-accordion .accordion-body {
    padding: 1.5rem;
    background-color: #fff;
}

/* Definition List Styling */
.info-list {
    margin: 0 0 1.25rem 0;
}

.info-list:last-child {
    margin-bottom: 0;
}

.info-list dt {
    font-weight: 700;
    color: #333;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.info-list dd {
    margin-bottom: 0;
    color: #333;
}

/* Info Row for side-by-side items */
.info-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.info-row .info-item {
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 0.375rem;
}

.info-row .info-item dt {
    margin-bottom: 0.25rem;
}

.info-row .info-item dd {
    margin-bottom: 0;
    font-size: 1rem;
}

/* Drone Visualization Container (also used for fallback map) */
.drone-viz-container {
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.drone-viz-container .viz-wrapper {
    min-height: 450px;
}

.drone-viz-container .viz-wrapper-fallback {
    min-height: 400px;
}

.drone-viz-container .viz-container-2d,
.drone-viz-container .viz-container-3d {
    height: 450px;
}

.drone-viz-container .viz-wrapper-fallback .viz-container-2d {
    height: 400px;
}

#detail-mini-map {
    height: 100%;
    width: 100%;
}

/* All Leaflet Control Buttons - unified 26x26 size */
#detail-mini-map .leaflet-bar a,
.viz-container-2d .leaflet-bar a {
    width: 26px !important;
    height: 26px !important;
    line-height: 26px !important;
    font-size: 14px;
}

#detail-mini-map .leaflet-bar a.leaflet-control-home,
.viz-container-2d .leaflet-bar a.leaflet-control-home {
    color: #333;
    background-color: #fff;
    text-align: center;
    text-decoration: none;
}

#detail-mini-map .leaflet-bar a.leaflet-control-home:hover,
.viz-container-2d .leaflet-bar a.leaflet-control-home:hover {
    background-color: #f4f4f4;
    color: #f7941d;
}

/* Fullscreen icon sprite adjustment */
#detail-mini-map .fullscreen-icon,
#detail-mini-map.leaflet-touch .fullscreen-icon,
.viz-container-2d .fullscreen-icon,
.viz-container-2d.leaflet-touch .fullscreen-icon {
    background-size: 26px 52px !important;
    background-position: 0 0 !important;
}

#detail-mini-map .fullscreen-icon.leaflet-fullscreen-on,
#detail-mini-map.leaflet-touch .fullscreen-icon.leaflet-fullscreen-on,
.viz-container-2d .fullscreen-icon.leaflet-fullscreen-on,
.viz-container-2d.leaflet-touch .fullscreen-icon.leaflet-fullscreen-on {
    background-position: 0 -26px !important;
}

#detail-mini-map .leaflet-control-layers,
.viz-container-2d .leaflet-control-layers {
    font-size: 12px;
}

#detail-mini-map .leaflet-control-layers-toggle,
.viz-container-2d .leaflet-control-layers-toggle {
    width: 30px;
    height: 30px;
    background-size: 20px 20px;
}

#detail-mini-map .leaflet-control-layers-expanded,
.viz-container-2d .leaflet-control-layers-expanded {
    padding: 4px 8px;
}

/* Tables for Cadastral and Sections */
.detail-table {
    width: 100%;
    margin-bottom: 0;
}

.detail-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    font-size: 0.875rem;
    color: #6c757d;
    border-bottom: 2px solid #dee2e6;
}

.detail-table td {
    vertical-align: middle;
}

.table-responsive {
    border-radius: 0.375rem;
    border: 1px solid #dee2e6;
}

/* Image Gallery */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

@media (max-width: 576px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 0.5rem;
    }
}

.gallery-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 0.5rem;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.gallery-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-item .gallery-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: #fff;
    font-size: 0.75rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

/* Gallery Modal */
.gallery-modal .modal-content {
    background-color: transparent;
    border: none;
}

.gallery-modal .modal-body {
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gallery-modal .gallery-image-container {
    position: relative;
    max-width: 100%;
    max-height: 80vh;
}

.gallery-modal .gallery-image-container img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 0.5rem;
}

.gallery-modal .gallery-caption {
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-top: 1rem;
    text-align: center;
    max-width: 100%;
}

.gallery-modal .gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 10;
}

.gallery-modal .gallery-nav:hover {
    background: #fff;
}

.gallery-modal .gallery-nav.prev {
    left: 1rem;
}

.gallery-modal .gallery-nav.next {
    right: 1rem;
}

.gallery-modal .btn-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    padding: 0.75rem;
    z-index: 10;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

/* Text content formatting */
.text-content {
    white-space: pre-line;
    line-height: 1.6;
}

/* Back button */
.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .quick-stats {
        justify-content: center;
    }
    
    .stat-item {
        min-width: 100px;
        padding: 0.5rem 1rem;
    }
    
    .stat-item .stat-value {
        font-size: 1.25rem;
    }
    
    .info-row {
        grid-template-columns: 1fr;
    }
    
    .gallery-modal .gallery-nav {
        width: 40px;
        height: 40px;
    }
}

/* Print styles */
@media print {
    .detail-accordion .accordion-collapse {
        display: block !important;
    }
    
    .btn-back,
    .gallery-modal {
        display: none !important;
    }
}

/* ============================================================
   Drone Visualization Section
   ============================================================ */

/* Visualization Container */
.viz-section {
    margin-bottom: 1rem;
}

.viz-wrapper {
    position: relative;
    background: #1a1a2e;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid #dee2e6;
}

/* Mode Toggle - Orange theme */
.viz-mode-toggle {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: #fff;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    gap: 4px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25);
    border: 2px solid rgba(0, 0, 0, 0.2);
}

.viz-mode-btn {
    padding: 6px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
    background: transparent;
    color: #666;
}

.viz-mode-btn.active {
    background: #f7941d;
    color: #fff;
}

.viz-mode-btn:hover:not(.active) {
    background: #f0f0f0;
    color: #333;
}

/* Fullscreen Button - Leaflet style */
.viz-fullscreen-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    width: 30px;
    height: 30px;
    padding: 5px;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    cursor: pointer;
    background: #fff;
    color: #333;
    display: flex;  /* Always visible */
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25);
}

.viz-fullscreen-btn:hover {
    background: #f4f4f4;
}

.viz-fullscreen-btn svg {
    display: block;
}

/* Fullscreen mode styles */
.viz-wrapper.fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    background: #1a1a2e;
}

.viz-wrapper.fullscreen .viz-container-2d,
.viz-wrapper.fullscreen .viz-container-3d {
    height: 100vh !important;
}

.viz-wrapper.fullscreen .viz-controls-2d {
    position: fixed;
    bottom: 10px;
    left: 10px;
    top: auto !important;
    right: auto !important;
    width: auto !important;
    height: auto !important;
    max-width: 240px;
    max-height: calc(100vh - 20px);
    overflow-y: auto;
}

.viz-wrapper.fullscreen .viz-controls-3d {
    position: fixed;
    bottom: 10px;
    left: 10px;
    top: auto !important;
    right: auto !important;
    width: auto !important;
    height: auto !important;
    max-width: 240px;
    max-height: calc(100vh - 20px);
    overflow-y: auto;
}

.viz-wrapper.fullscreen .viz-stats {
    display: none !important;
}

.viz-wrapper.fullscreen .viz-mode-toggle {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
}

.viz-wrapper.fullscreen .viz-fullscreen-btn {
    position: fixed;
    top: 10px;
    right: 10px;
}

/* Visualization Containers */
.viz-container-2d,
.viz-container-3d {
    width: 100%;
    height: 500px;
    position: relative;
}

.viz-container-2d {
    display: none;
}

/* Fallback map - always show 2D container */
.viz-wrapper-fallback .viz-container-2d {
    display: block;
}

.viz-container-3d {
    display: block;
}

/* 2D Map Leaflet Customization - Basemap Switcher (orange/white theme) */
.viz-container-2d .leaflet-control-layers {
    background: #fff;
    color: #333;
    border-radius: 4px;
    border: 2px solid rgba(0, 0, 0, 0.2);
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25);
}

/* Push top-right controls down below the fullscreen button */
.viz-container-2d .leaflet-top.leaflet-right {
    top: 42px;
}

/* All Leaflet Control Buttons - unified 26x26 size */
.viz-container-2d .leaflet-bar a,
.viz-container-2d .leaflet-touch .leaflet-bar a {
    width: 26px !important;
    height: 26px !important;
    line-height: 26px !important;
    font-size: 14px;
}

/* Home button styling for 2D viz */
.viz-container-2d .leaflet-bar a.leaflet-control-home {
    color: #333;
    background-color: #fff;
    text-align: center;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.viz-container-2d .leaflet-bar a.leaflet-control-home:hover {
    background-color: #f4f4f4;
    color: #f7941d;
}

.viz-container-2d .leaflet-control-layers-toggle {
    background-color: #fff;
    width: 32px;
    height: 32px;
}

.viz-container-2d .leaflet-control-layers-expanded {
    padding: 10px 12px;
}

.viz-container-2d .leaflet-control-layers label {
    color: #333;
    font-size: 12px;
}

.viz-container-2d .leaflet-control-layers-base label {
    margin-bottom: 4px;
}

.viz-container-2d .leaflet-control-layers input[type="radio"] {
    accent-color: #f7941d;
}

/* Controls Panel - Leaflet style */
.viz-controls {
    position: absolute;
    bottom: 15px;
    left: 15px;
    background: #fff;
    color: #333;
    padding: 12px 14px;
    border-radius: 4px;
    z-index: 500;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25);
    border: 2px solid rgba(0, 0, 0, 0.2);
    max-width: 220px;
    font-size: 12px;
}

.viz-controls-2d,
.viz-controls-3d {
    display: none;
}

/* Fallback map - always show 2D controls */
.viz-wrapper-fallback .viz-controls-2d {
    display: block;
}

.viz-controls label {
    display: block;
    margin: 6px 0;
    cursor: pointer;
    color: #333;
}

.viz-controls input[type="range"] {
    width: 100%;
    margin-top: 4px;
    accent-color: #f7941d;
}

.viz-controls input[type="checkbox"] {
    margin-right: 8px;
    accent-color: #f7941d;
}

.viz-slider-container {
    margin-bottom: 10px;
}

.viz-slider-container span {
    color: #f7941d;
    font-weight: 600;
}

/* Thermal Legend */
.viz-thermal-legend {
    margin-top: 8px;
    margin-bottom: 12px;
    padding: 8px 0;
}

.thermal-legend-title {
    font-size: 11px;
    font-weight: 500;
    color: #666;
    margin-bottom: 4px;
}

.thermal-legend-bar {
    width: 100%;
    height: 12px;
    border-radius: 2px;
    background: linear-gradient(to right,
        #000000 0%,
        #1a0a2e 10%,
        #3d1a5b 20%,
        #6a1b6b 30%,
        #8b2d5e 40%,
        #b84a3b 50%,
        #d97019 60%,
        #f7941d 70%,
        #f9b52e 80%,
        #fdd65c 90%,
        #ffffff 100%
    );
    border: 1px solid #ccc;
}

.thermal-legend-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #666;
    margin-top: 2px;
}

.viz-controls-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #f7941d;
    border-bottom: 1px solid #ddd;
    padding-bottom: 6px;
}

/* Stats Panel (3D) - HIDDEN, no longer used */
.viz-stats {
    display: none !important;
}

/* Loading Overlay */
.viz-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    padding: 25px 40px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 2000;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(0, 0, 0, 0.1);
}

.viz-loading .spinner {
    border: 3px solid #eee;
    border-top: 3px solid #f7941d;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    animation: viz-spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes viz-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* No Data State */
.viz-no-data {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    background: #f8f9fa;
    border-radius: 0.5rem;
    color: #6c757d;
}

.viz-no-data i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Responsive adjustments for visualization */
@media (max-width: 768px) {
    .viz-container-2d,
    .viz-container-3d {
        height: 400px;
    }
    
    .viz-controls {
        bottom: 10px;
        left: 10px;
        padding: 10px;
        max-width: 200px;
        font-size: 12px;
    }
    
    .viz-info,
    .viz-stats {
        display: none !important;
    }
    
    .viz-mode-toggle {
        padding: 4px 8px;
    }
    
    .viz-mode-btn {
        padding: 4px 12px;
        font-size: 12px;
    }
}

/* Section Labels and Tooltips */
.section-label {
    background: transparent;
    border: none;
    white-space: nowrap;
}

.section-label span {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    color: #333;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.section-tooltip {
    background: rgba(0, 0, 0, 0.85);
    border: none;
    border-radius: 4px;
    color: #fff;
    font-size: 12px;
    padding: 8px 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.section-tooltip strong {
    color: #fff;
    font-size: 13px;
}

.leaflet-tooltip.section-tooltip::before {
    border-top-color: rgba(0, 0, 0, 0.85);
}

/* Remove default focus outline on Leaflet paths */
.leaflet-interactive:focus {
    outline: none !important;
}

.leaflet-container path.leaflet-interactive:focus {
    outline: none !important;
    box-shadow: none !important;
}

@media (max-width: 576px) {
    .viz-container-2d,
    .viz-container-3d {
        height: 300px;
    }
    
    .viz-controls {
        position: static;
        max-width: 100%;
        border-radius: 0;
        margin-top: -1px;
    }
}
