/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Effects */
.glow-orange:hover {
    filter: drop-shadow(0 0 8px rgba(249, 115, 22, 0.8));
}

/* Loaders */
.loader {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #000;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Range Input Styling */
input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    height: 14px;
    width: 14px;
    border-radius: 50%;
    background: white;
    margin-top: -5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    background: #4b5563;
    border-radius: 2px;
}

/* Map Popup Styling (Dark Mode) */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    background: #1f2937;
    color: white;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

.leaflet-container a.leaflet-popup-close-button {
    color: #9ca3af;
}

/* Transitions/Animations */
.animate-in {
    animation-duration: 300ms;
    animation-fill-mode: forwards;
}

@keyframes fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes zoom-in {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes slide-in-right {
    from {
        transform: translateX(20px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.fade-in {
    animation-name: fade-in;
}

.zoom-in {
    animation-name: zoom-in;
}

.slide-in-from-right {
    animation-name: slide-in-right;
}

/* Economic Engine Animations */
.engine-node {
    transition: all 0.5s ease-in-out;
}

.qr-box {
    animation: pulse-qr 4s ease-in-out infinite;
}

@keyframes pulse-qr {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

.flow-line {
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    filter: drop-shadow(0 0 3px currentColor);
    opacity: 0.8;
}

.flow-line-border {
    fill: none;
    stroke: #f9fafb;
    stroke-width: 4;
    stroke-linecap: round;
}

.flow-animate {
    stroke-dasharray: 4, 12;
    animation: flow-dash 2s linear infinite;
}

@keyframes flow-dash {
    from {
        stroke-dashoffset: 50;
    }

    to {
        stroke-dashoffset: 0;
    }
}

.label-float {
    animation: float-text 3s ease-in-out infinite;
}

@keyframes float-text {

}

/* Responsive Grid & Card Optimization */
.responsive-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding-bottom: 3rem;
}

@media (min-width: 640px) {
    .responsive-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .responsive-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.model-card {
    position: relative;
    aspect-ratio: 16 / 9;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    border: 1px solid #f3f4f6;
    overflow: hidden;
    transition: all 0.2s;
}

@media (max-width: 639px) {
    .model-card {
        aspect-ratio: 4 / 3; /* Slightly taller on mobile to make models larger */
    }
}

/* Mobile Controls Styling */
.controls-panel {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border: 1px solid #f3f4f6;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    border-radius: 1rem;
    z-index: 20;
}

@media (min-width: 768px) {
    .controls-panel {
        position: absolute;
        top: 1.5rem;
        left: 1.5rem;
        width: 12rem;
        padding: 1.25rem;
        gap: 1.5rem;
    }
}

@media (max-width: 767px) {
    .controls-panel {
        position: relative !important;
        width: 100% !important;
        top: 0 !important;
        left: 0 !important;
        flex-direction: row !important;
        justify-content: space-around !important;
        padding: 0.75rem !important;
        gap: 1rem !important;
        margin-bottom: 0.5rem;
    }
    
    .color-wheel-container {
        width: 80px !important;
        height: 80px !important;
    }
    
    #color-wheel-canvas {
        width: 80px !important;
        height: 80px !important;
    }
    
    .opacity-slider-container {
        flex: 1;
        max-width: 150px;
    }
}

/* Sidebar Grid - Always 1 column on desktop select view */
.sidebar-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(1, minmax(0, 1fr)) !important;
}

@media (max-width: 767px) {
    .sidebar-grid {
        grid-template-columns: repeat(1, minmax(0, 1fr)) !important;
    }
}