/* browser.css */

.browser-header {
    margin-bottom: 2rem;
    text-align: center;
    color: white;
}

.manufacturer-nav {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
}

/* Styled Select Dropdown for Mobile */
.mobile-select-wrapper {
    position: relative;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
}

.mobile-select-wrapper::after {
    content: '▼';
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    pointer-events: none;
    font-size: 0.8rem;
}

.manufacturer-select {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    background: #3a3a3a;
    color: white;
    padding: 12px 40px 12px 15px;
    border: 2px solid #444;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}

.manufacturer-select:focus {
    outline: none;
    border-color: #FF6B35;
}

.manufacturer-select option {
    background: #2d2d2d;
    color: white;
    padding: 10px;
}

/* Count Info - Desktop (full list) */
.count-info {
    color: white;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.9rem;
}

.count-info-mobile {
    display: none; /* Shown only on mobile */
}

.count-info-desktop {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
}

.current-brand {
    color: #FF6B35;
}

.separator {
    color: #666;
    margin: 0 0.25rem;
}

.total-summary {
    color: #e9ecef;
}

/* Back to Top Button */
.btn-scroll-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: var(--color-primary);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    transform: translateY(20px);
}

.btn-scroll-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.btn-scroll-top:hover {
    background-color: #ff8552;
    transform: scale(1.1);
}

/* SEO Footer */
.seo-footer {
    margin-top: 4rem;
    padding: 2rem;
    background: #1a1a1a;
    border-top: 1px solid #333;
    border-radius: 8px;
    color: #888;
    font-size: 0.85rem;
    line-height: 1.6;
}

.seo-content {
    margin-bottom: 1rem;
    max-width: 800px;
}

.seo-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    opacity: 0.6;
}

.family-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
}

.manufacturer-nav {
    margin-top: 1rem;
}

/* Tabs */
.tabs {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #444;
    background: #3a3a3a;
    color: #e9ecef;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.tab-btn.active {
    background: #FF6B35;
    color: white;
    border-color: #FF6B35;
}

/* Selection Toolbar */
.selection-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #2d2d2d;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    position: sticky;
    top: 1rem;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    border: 1px solid #444;
}

.toolbar-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.toolbar-actions .btn {
    padding: 0.4rem 1rem;
    font-size: 0.9rem;
}

.btn-ase-download {
    background: none;
    border: 1px solid #2d2d2d;
    border-radius: 4px;
    padding: 0.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    transition: border-color 0.2s, transform 0.15s;
}

.btn-ase-download img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.btn-ase-download:hover {
    border-color: #FF6B35;
    transform: scale(1.1);
}

/* Family Sections */
.family-section {
    background: #2d2d2d;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid #444;
    overflow: hidden;
}

.family-header {
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: #3a3a3a;
}

.family-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.family-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid white;
}

.badge {
    background: #444;
    color: #e9ecef;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
}

/* Color Grid */
.color-grid-full {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

/* Overview Grid (View 2) - Compact, no text */
.color-grid-overview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 4px;
    padding: 1rem 0;
}

.color-swatch-compact {
    aspect-ratio: 1;
    border-radius: 2px;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
}

.color-swatch-compact:hover {
    transform: scale(1.1);
    box-shadow: 0 0 8px rgba(255, 107, 53, 0.6);
    z-index: 10;
}

.color-card {
    text-align: center;
    cursor: pointer;
    transition: transform 0.1s;
}

.color-card:hover {
    transform: scale(1.05);
}

.color-swatch {
    aspect-ratio: 1;
    border-radius: 4px;
    border: 1px solid #444;
    position: relative;
    margin-bottom: 0.5rem;
}

.color-card.selected .color-swatch {
    border: 3px solid #FF6B35;
}

.check {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 1.5rem;
    text-shadow: 0 0 4px rgba(0,0,0,0.8);
}

.color-meta {
    display: flex;
    flex-direction: column;
    font-size: 0.75rem;
}

.color-meta .name {
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.color-meta .code {
    color: #aaa;
}

/* ===== FINE-TUNE ===== */
.btn-icon-finetune {
    background-color: transparent;
    border: none;
    color: #FF6B35;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.25rem 0.4rem;
    border-radius: 4px;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-finetune:hover {
    background-color: #FF6B35;
    color: white;
    transform: scale(1.1);
}

/* Modal Overlay */
.finetune-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

/* Modal Container */
.finetune-modal {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

/* Modal Header */
.finetune-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background-color: #4CAF50;
    color: #fff;
    border-radius: 12px 12px 0 0;
}

.finetune-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.btn-modal-close {
    background-color: transparent;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.15s;
}

.btn-modal-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* 3x3 Grid */
.finetune-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 1.5rem;
}

/* Grid Cell */
.finetune-grid-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    cursor: pointer;
    transition: all 0.15s;
    min-height: 140px;
}

.finetune-grid-cell:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.finetune-grid-cell.selected {
    border-color: #4CAF50;
    background-color: rgba(76, 175, 80, 0.05);
}

/* Original Color (Center) */
.finetune-grid-cell.finetune-original {
    border: 3px solid #FF6B35;
    cursor: default;
    pointer-events: none;
}

.finetune-grid-cell.finetune-original:hover {
    transform: none;
}

/* Color Sample in Grid */
.finetune-color-sample {
    width: 100%;
    height: 80px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    margin-bottom: 0.5rem;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Checkmark Overlay */
.finetune-checkmark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #4CAF50;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Color Name in Grid */
.finetune-color-name {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.finetune-color-name strong {
    font-size: 0.8rem;
    color: #333;
    line-height: 1.2;
}

.finetune-color-name small {
    font-size: 0.72rem;
    color: #888;
}

/* Responsive Classes */
.mobile-only { display: block; }
.desktop-only { display: none; }

@media (min-width: 1024px) {
    .mobile-only { display: none; }
    .desktop-only { display: block; }
    
    .color-grid-full {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 2rem;
    }
    
    .color-grid-overview {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 6px;
    }
    
    .color-meta {
        font-size: 0.9rem;
    }
}

/* 2K / 4K Optimizations */
@media (min-width: 2000px) {
    .container {
        max-width: 2400px;
    }
    
    .color-grid-full {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
    
    .color-grid-overview {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 8px;
    }
    
    .color-meta {
        font-size: 0.9rem;
    }
}

/* MOBILE FIX: Stacked toolbar with scrollable count-info */
@media (max-width: 768px) {
    .btn-save-icon { display: none; }

    /* Don't hide .count-info - its children are controlled separately */
    
    .count-info-mobile {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }
    
    .count-info-desktop {
        display: none;
    }
    
    .count-info {
        /* Override base .count-info flex behavior for mobile */
        display: block;
        width: 100%;
    }
    
    .mobile-summary {
        font-size: 0.85rem;
        color: #e9ecef;
    }
    
    .count-info-scroll {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 0.25rem;
        padding-bottom: 0.25rem;
        -webkit-overflow-scrolling: touch;
    }
    
    .count-info-scroll .summary-item {
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    .selection-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .toolbar-actions {
        width: 100%;
        justify-content: stretch;
    }
    
    .toolbar-actions .btn {
        flex: 1;
    }
    
    .color-grid-overview {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: 3px;
    }

    /* Fine-Tune Modal - Mobile */
    .finetune-modal {
        max-width: 100%;
        margin: 0.5rem;
    }

    .finetune-grid {
        gap: 0.5rem;
        padding: 1rem;
    }

    .finetune-grid-cell {
        padding: 0.5rem;
        min-height: 120px;
    }

    .finetune-color-sample {
        height: 60px;
    }

    .finetune-checkmark {
        width: 32px;
        height: 32px;
        font-size: 1.1rem;
    }

    .finetune-modal-header h3 {
        font-size: 1rem;
    }
}

/* ===== COLOR TOAST ===== */
.color-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #2d2d2d;
    border: 1px solid #444;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    z-index: 200;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    animation: toastSlideUp 0.25s ease-out;
    min-width: 280px;
    max-width: 90vw;
}

.color-toast-swatch {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    border: 1px solid #555;
    flex-shrink: 0;
}

.color-toast-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    color: white;
    gap: 0.2rem;
    overflow: hidden;
}

.color-toast-info strong {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.color-toast-info small {
    color: #aaa;
    font-size: 0.8rem;
}

.color-toast-close {
    background: none;
    border: none;
    color: #aaa;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
    flex-shrink: 0;
}

.color-toast-close:hover {
    color: white;
}

.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.85rem;
    white-space: nowrap;
}

@keyframes toastSlideUp {
    from {
        transform: translateX(-50%) translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* Overview swatch: indicate selected state */
.color-swatch-compact.in-palette {
    outline: 3px solid #FF6B35;
    outline-offset: -2px;
}

/* ===== PALETTE VIEW ===== */
.palette-view {
    background: #2d2d2d;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.palette-view h3 {
    color: white;
    margin: 0 0 0.75rem 0;
    font-size: 1rem;
    font-weight: 600;
}

.palette-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 220px;
    overflow-y: auto;
}

.palette-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #3a3a3a;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
}

.palette-color-sample {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    border: 1px solid #555;
    flex-shrink: 0;
}

.palette-color-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    overflow: hidden;
}

.palette-color-info strong {
    color: white;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.palette-color-info small {
    color: #aaa;
    font-size: 0.78rem;
}

.btn-icon-remove {
    background: none;
    border: none;
    color: #aaa;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.25rem 0.4rem;
    border-radius: 4px;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
}

.btn-icon-remove:hover {
    color: white;
    background: #555;
}
