/* 3D Nail Design Gallery Custom Styles */

/* Main viewer container */
#viewer-container {
    position: relative; 
    min-height: 600px;
    width: 100%;
    display: flex;
    align-items: stretch;
    gap: 20px;
    justify-content: flex-start;
}

#viewer3d { 
    width: 800px;
    height: 600px;
    order: 2;
    flex-shrink: 0;
}

/* Tab Navigation Panel */
.customization-panel {
    position: relative;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 100;
    width: 380px;
    max-width: 500px;
    min-width: 500px;
    max-height: 500px;
    overflow-y: auto;
    order: 1;
    flex-shrink: 0;
    top: 50px;
    background-color: #4f320c;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.customization-panel::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 12px 15px;
    background: #fff;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.tab-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.tab-btn.active {
    background: linear-gradient(135deg, #ffd89b 0%, #ffcc70 100%);
    transform: translateY(-2px);
}

.tab-btn-icon { 
    width: 35px;
    height: 35px;
    object-fit: contain;
}

.tab-btn-label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    text-align: left;
}

/* Save Design Button */
.save-design-btn {
    padding: 12px 20px;
    background: linear-gradient(45deg, #c8860d, #e4a425);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    font-weight: 600;
    font-size: 14px;
    margin-top: 10px;
}

.save-design-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.save-design-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

.save-design-btn svg {
    width: 20px;
    height: 20px;
}

.save-btn-label {
    font-size: 14px;
    font-weight: 600;
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Shapes Tab */
.shapes-header {
    text-align: center;
    margin-bottom: 15px;
}

.shapes-title {
    background: #fff;
    display: inline-block;
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.shapes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 15px;
}

.shape-option {
    background: #fff;
    border: 3px solid transparent;
    border-radius: 15px;
    padding: 15px 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.shape-option:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.shape-option.active {
    border-color: #ffcc70;
    background-color: rgba(255, 205, 112, 0.758);
}

.shape-nail-preview {
    width: 100px;
    height: 130px;
    margin: 0 auto 8px;
    position: relative;
}

.shape-nail-preview.square {
    border-radius: 10px 10px 5px 5px;
}

.shape-nail-preview.squoval {
    border-radius: 20px 20px 10px 10px;
}

.shape-nail-preview.round {
    border-radius: 50% 50% 50% 50% / 70% 70% 30% 30%;
}

.shape-nail-preview.oval {
    border-radius: 50% 50% 50% 50% / 65% 65% 35% 35%;
}

.shape-nail-preview.almond {
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    clip-path: polygon(20% 0%, 80% 0%, 100% 60%, 50% 100%, 0% 60%);
}

.shape-nail-preview.ballerina {
    border-radius: 10px 10px 0 0;
    clip-path: polygon(15% 0%, 85% 0%, 100% 80%, 70% 100%, 30% 100%, 0% 80%);
}

.shape-nail-preview.stilleto {
    border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 50% 100%, 0% 50%);
}

.shape-label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
}

/* Colors Tab */
.color-section {
    margin-bottom: 20px;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: #ebebeb;
    margin-bottom: 12px;
    padding-left: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.colors-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    background-color: white;
    padding: 30px;
    border-radius: 15px;
}

.color-option {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 4px solid #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
    margin: 0 auto;
}

.color-option:hover {
    transform: scale(1.15);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.25);
}

.color-option.active {
    border-color: #ffcc70;
    border-width: 5px;
    transform: scale(1.2);
}

/* Custom Color Picker */
.custom-color-section {
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
    padding: 15px;
    border-radius: 15px;
    border: 2px solid #e0e6ed;
}

.custom-color-picker {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.color-picker-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    cursor: pointer;
}

.color-picker-icon {
    font-size: 20px;
}

.color-picker-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    padding: 10px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.color-input {
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 10%;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease;
}

.color-input:hover {
    transform: scale(1.1);
}

.color-preview {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

.apply-custom-color-btn {
    flex: 1;
    padding: 12px 20px;
    background: linear-gradient(135deg, #ffd89b 0%, #ffcc70 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.apply-custom-color-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.apply-custom-color-btn:active {
    transform: translateY(0);
}

.color-hex-display {
    text-align: center;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: 600;
    color: #667eea;
    background: white;
    padding: 8px 12px;
    border-radius: 8px;
    letter-spacing: 1px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

/* Designs Tab */
.designs-section {
    margin-bottom: 15px;
}

.designs-section-title {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    margin-bottom: 10px;
    padding-left: 5px;
}

.designs-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 12px;
}

.design-option {
    background: #fff;
    border: 3px solid transparent;
    border-radius: 15px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.design-option:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.design-option.active {
    border-color: #ffcc70;
    background-color: rgba(255, 205, 112, 0.758);
}

.design-preview {
    width: 20%;
    height: 170px;
    object-fit: cover;
    object-position: center;
    border-radius: 10px;
    margin-bottom: 8px;
}

.design-label {
    font-size: 11px;
    font-weight: 600;
    color: #555;
}

/* Nail Decos Grid */
.decos-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.deco-option {
    background: #fff;
    border: 3px solid transparent;
    border-radius: 12px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    min-height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.deco-option:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.deco-option.active {
    border-color: #ffcc70;
    background-color: rgba(255, 205, 112, 0.758);
}

.deco-preview {
    width: 50px;
    height: 50px;
    margin: 0 auto 8px;
    object-fit: contain;
}

.deco-option .design-label {
    font-size: 11px;
    font-weight: 600;
    color: #555;
    margin-top: 5px;
}

/* Nail Selection Mode */
.nail-selection-mode {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}

/* Nail Selection UI - Visual Card Layout */
.nail-selection-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.hand-card {
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.hand-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.hand-card.active {
    border: 2px solid #d4a574;
    box-shadow: 0 4px 16px rgba(212, 165, 116, 0.3);
}

.hand-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

.hand-icon {
    font-size: 28px;
}

.hand-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.hand-checkbox {
    margin-left: auto;
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #d4a574;
}

.fingers-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.finger-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 8px;
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 11px;
    color: #555;
}

.finger-btn:hover {
    background: #f0f0f0;
    border-color: #d4a574;
}

.finger-btn.active {
    background: #d4a574;
    border-color: #d4a574;
    color: white;
    font-weight: 600;
}

.finger-emoji {
    font-size: 18px;
}

.all-nails-card {
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    color: #1b1b1b;
    text-align: center;
    padding: 25px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    margin-bottom: 20px;
}

.all-nails-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.all-nails-card.active {
    background: linear-gradient(135deg, #d4a574 0%, #b8935e 100%);
    color: #ffffff;
}

.all-nails-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.all-nails-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.all-nails-description {
    font-size: 12px;
    opacity: 0.9;
}

.mode-btn {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #dee2e6;
    border-radius: 12px;
    padding: 12px 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #555;
}

.mode-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.mode-btn.active {
    background: linear-gradient(135deg, #ffd89b 0%, #ffcc70 100%);
    border-color: #ffcc70;
    color: white;
}

.mode-icon {
    font-size: 24px;
    line-height: 1;
}

.mode-description {
    text-align: center;
    font-size: 11px;
    color: #cecece;
    margin: 5px 0 0 0;
    font-style: italic;
}

/* Loading states */
#loading-container {
    text-align: center;
    padding: 40px 20px;
    color: #fff;
}

#loading-container p {
    font-size: 16px;
    margin-bottom: 15px;
}

#load-progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    overflow: hidden;
    margin: 20px auto;
    max-width: 300px;
}

#load-progress-bar::after {
    content: '';
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #ffd89b, #ffcc70);
    width: var(--progress, 0%);
    transition: width 0.3s ease;
    border-radius: 10px;
}

#cancel-loading {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid #fff;
    color: #fff;
    padding: 10px 25px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

#cancel-loading:hover {
    background: #fff;
    color: #667eea;
}

/* Responsive Design */
@media (max-width: 768px) {
    #viewer-container {
        flex-direction: column;
        min-height: auto;
    }

    .customization-panel {
        width: 100%;
        max-width: 100%;
        min-width: 100%;
        max-height: 400px;
        order: 1;
    }

    #viewer3d {
        order: 2;
        height: 400px;
    }

    .tab-navigation {
        flex-direction: row;
        justify-content: center;
    }

    .tab-btn {
        flex-direction: column;
        padding: 10px;
    }

    .tab-btn-icon {
        width: 30px;
        height: 30px;
    }

    .tab-btn-label {
        font-size: 11px;
        text-align: center;
    }

    .shapes-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .colors-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .color-option {
        width: 50px;
        height: 50px;
    }

    .designs-grid {
        grid-template-columns: repeat(1, 1fr);
        gap: 10px;
    }

    .design-preview {
        height: 100px;
    }

    .decos-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .deco-preview {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .shapes-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .colors-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .designs-grid {
        grid-template-columns: repeat(1, 1fr);
        gap: 8px;
    }

    .design-preview {
        height: 80px;
    }
}

/* Hidden state */
.hidden {
    display: none !important;
}

/* Static Gallery */
#static-gallery {
    text-align: center;
    padding: 40px 20px;
}

.static-gallery-grid {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.design-card {
    background: #fff;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.design-card:hover {
    transform: translateY(-5px);
}

.design-card img {
    width: 200px;
    height: auto;
    border-radius: 10px;
}

/* WebGL Error */
#webgl-error {
    text-align: center;
    padding: 40px 20px;
    color: #fff;
}

#webgl-error h3 {
    font-size: 24px;
    margin-bottom: 15px;
}

#webgl-error p {
    font-size: 16px;
}

/* Nail Map Selector */
.nail-map-section {
    padding: 10px 0;
}

.nail-map-hint {
    text-align: center;
    font-size: 11px;
    color: #666;
    margin-bottom: 15px;
}

.hands-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.hand-map {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 15px;
    border-radius: 15px;
    border: 2px solid #dee2e6;
}

.hand-label {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 10px;
}

.fingers-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.finger-col {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.nail-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 8px;
    background: white;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.nail-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #ffcc70;
}

.nail-btn.active {
    border-color: #ffcc70;
    background-color: rgba(255, 205, 112, 0.758);
    box-shadow: 0 4px 12px rgba(255, 205, 112, 0.3);
}

.nail-shape {
    width: 35px;
    height: 50px;
    background: linear-gradient(180deg, #ffb3d9 0%, #ff8cc5 100%);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.nail-btn:hover .nail-shape {
    transform: scale(1.1);
}

.nail-btn.active .nail-shape {
    box-shadow: 0 4px 12px rgba(255, 205, 112, 0.758);

}

.nail-shape.thumb {
    width: 38px;
    height: 48px;
    border-radius: 50% 50% 50% 50% / 65% 65% 35% 35%;
}

.nail-shape.index {
    width: 34px;
    height: 52px;
}

.nail-shape.middle {
    width: 35px;
    height: 55px;
}

.nail-shape.ring {
    width: 33px;
    height: 50px;
}

.nail-shape.pinky {
    width: 30px;
    height: 45px;
}

.finger-label {
    font-size: 9px;
    font-weight: 600;
    color: #6c757d;
    text-align: center;
}

.selected-nail-info {
    margin-top: 15px;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    text-align: center;
}

.selected-nail-info p {
    color: white;
    font-size: 12px;
    font-weight: 600;
    margin: 0;
}

/* Design Color Controls */
.design-color-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.design-color-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.design-color-option label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    min-width: 90px;
}

.apply-design-color-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, #ffd89b 0%, #ffcc70 100%);
    color: rgb(0, 0, 0);
    border: none;
    border-radius: 20px;
    font-weight: 600;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 205, 112, 0.3);
    white-space: nowrap;
}

.apply-design-color-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 205, 112, 0.4);
}

.apply-design-color-btn:active {
    transform: translateY(0);
}

.color-hint {
    font-size: 11px;
    color: #888;
    text-align: center;
    margin-top: 5px;
    font-style: italic;
}

@media (max-width: 768px) {
    .fingers-grid {
        gap: 5px;
    }
    
    .nail-shape {
        width: 28px;
        height: 40px;
    }
    
    .nail-shape.thumb {
        width: 30px;
        height: 38px;
    }
    
    .nail-shape.index {
        width: 27px;
        height: 42px;
    }
    
    .nail-shape.middle {
        width: 28px;
        height: 45px;
    }
    
    .nail-shape.ring {
        width: 26px;
        height: 40px;
    }
    
    .nail-shape.pinky {
        width: 24px;
        height: 35px;
    }
    
    .finger-label {
        font-size: 8px;
    }
}
