/* ==========================================================================
   Mesh Gallery & Carousel Layout
   ========================================================================== */

/* Main Container */
.gallery-container {
    margin: 0px;
    width: 100%;
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.caroussel-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

.carousel-container {
    display: flex;
    position: relative;
    width: 100%;
    overflow: hidden;
    flex: 1;
}

/* Track holding the items - must be flex with no wrap */
.carousel-track {
    display: flex;
    flex-wrap: nowrap;
    transition: transform 0.4s ease-out;
    margin: 10px 10px 0px 10px;
    gap: 10px;
}

/* Individual Gallery Item - 3 items per view */
.carousel-item {
    flex: 0 0 calc((100% - 20px) / 3);  /* 3 items minus gaps */
    min-width: 244px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    border: 1px solid transparent;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
    box-sizing: border-box;
    max-width: 244px;
}

.selected-indicator {
    background: #fff9d2ee;
    border-color: #ffb64f;
    box-shadow: 0 0 10px rgb(249 212 200 / 95%);
    border-radius: 8px;
    border-style: inset;
}

/* ==========================================================================
   Mesh Preload Indicators
   ========================================================================== */

/* Green dot when mesh is ready */
.carousel-item.mesh-ready .model-image-container::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 10px;
    height: 10px;
    background: #2a9d8f;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* Red dot on error */
.carousel-item.mesh-error .model-image-container::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 10px;
    height: 10px;
    background: #e63946;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* Loading overlay */
.preload-indicator {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
    z-index: 10;
    border-radius: 6px;
}

.preload-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e0e0e0;
    border-top-color: var(--hud-accent, #2266ff);
    border-radius: 50%;
    animation: preload-spin 0.8s linear infinite;
}

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

.preload-text {
    font-size: 0.7rem;
    color: #666;
    font-weight: 500;
}

/* ==========================================================================
   Item Internal Components
   ========================================================================== */

.model-image-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 5px;
    border-radius: 8px;
}

.model-image {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
    border-radius: 8px;
}

.model-name {
    font-size: 1rem;
    font-weight: 700;
    color: #444444;
    margin: 10px 5px 0px 5px;
}

.model-description {
    font-size: 0.75rem;
    color: #444;
    line-height: 1.3;
    height: 10em;
    overflow: hidden;
    margin: 10px 5px 5px 5px;
}

.model-metadata {
    border-top: 1px dashed var(--hud-fg-dim, #ccc);
}

.meta-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    margin: 0px 5px 3px 5px;
    color: #333333;
}

/* Complexity Badges */
.complexity-badge {
    margin-top: 8px;
    font-size: 0.6rem;
    font-weight: bold;
    text-transform: uppercase;
    text-align: center;
    padding: 2px;
    background-color: #ffffff;
    border-radius: 2px;
    box-shadow: rgba(0, 0, 0, 0.12) 0px 1px 3px, rgba(0, 0, 0, 0.24) 0px 1px 2px;
}

.complexity-unknown {
    color: #333333;
    background-color: #b0b0b0;
}

.complexity-low {
    color: #333333;
    background-color: #aee7b4;
}

.complexity-med {
    color: #333333;
    background-color: #ffee9a;
}

.complexity-high {
    color: #333333;
    background-color: #ffc27e;
}

.complexity-very-high {
    color: #333333;
    background-color: #ffacac;
}

/* ==========================================================================
   Navigation & Controls
   ========================================================================== */

/* Dots */
.nav-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 0px;
}

.nav-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--hud-fg-dim, #ccc);
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-dot:hover {
    background: #79d39c;
    transform: scale(1.2);
}

.nav-dot.active {
    background: #49d27d;
    transform: scale(1.3);
}

/* Buttons Container */
.carousel-controls {
    display: flex;
    justify-content: space-between;
    padding: 0px 15px 15px 15px;
}

.btn-group {
    display: flex;
    gap: 6px;
}

/* Button Base Styles */
.carousel-controls .btn {
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.carousel-controls .btn-secondary:hover:not(:disabled) {
    background: #2aaff1;
}

.carousel-controls .btn:disabled {
    opacity: 0.5;
}

/* Button Variants */
.carousel-controls .btn-primary {
    background: #0f9ce2;
    color: white;
    border-color: #0f9ce2;
}

.carousel-controls .btn-primary:hover:not(:disabled) {
    background: #2aaff1;
}

.carousel-controls .btn-secondary {
    background: #0f9ce2;
    color: white;
    border-color: #0f9ce2;
}


/* ==========================================================================
   Per-Item Solver Selection Dropdown
   ========================================================================== */

.solver-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--hud-fg-dim, #ccc);
}

.solver-row label {
    font-size: 0.7rem;
    font-weight: 500;
    color: #444;
}

.solver-row select {
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    border: 1px solid #ccc;
    background: #fff;
    cursor: pointer;
    max-width: 130px;
}

.solver-row select:hover {
    border-color: var(--hud-accent, #0f9ce2);
}

.solver-row select:focus {
    outline: none;
    border-color: var(--hud-accent, #0f9ce2);
    box-shadow: 0 0 0 2px rgba(34, 102, 255, 0.2);
}

/* ==========================================================================
   Mesh & Solver Selection Dropdowns
   ========================================================================== */

.mesh-row {
    padding-bottom: 8px;
    padding-top: 8px;
}

.mesh-row, .solver-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 8px;
    padding-left: 4px;
    border-bottom: 1px dashed var(--hud-fg-dim, #ccc);
}

.mesh-row label,
.solver-row label {
    font-size: 0.7rem;
    font-weight: 500;
    color: #444;
}

.mesh-row select, .solver-row select {
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    border: 1px solid #ccc;
    background: #fff;
    cursor: pointer;
    max-width: 175px;
    
    /* Remove default arrow */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    
    /* Add custom arrow */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23333333' viewBox='0 0 20 20'%3e%3cpolygon fill='%23333333' points='10,14 4,6 16,6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 6px center; /* Controls arrow position */
    background-size: 10px; /* Slightly smaller for the smaller font size */
    padding-right: 25px; /* Make room for the arrow */
}

.mesh-row select:hover,
.solver-row select:hover {
    border-color: var(--hud-accent, #2266ff);
}

.mesh-row select:focus,
.solver-row select:focus {
    outline: none;
    border-color: var(--hud-accent, #2266ff);
    box-shadow: 0 0 0 2px rgba(34, 102, 255, 0.2);
}

/* Navigation Controls Row */
.navigation-controls {
    display: flex;
    justify-content: center;
    align-items: center;
}

.navigation-controls .btn {
    cursor: pointer;
    transition: all 0.2s ease;
}
.navigation-controls .btn:disabled {
    opacity: 0.5;
}

.navigation-controls .btn img {
    width: 26px;
    height: 26px;
    vertical-align: middle;
    background: #aee7b4;
    border-radius: 14px;
}
