/**
 * Skein Configurator Frontend Styles
 */

/* ============================================
   Image Overlay Wrapper (outside configurator)
   ============================================ */

.skein-image-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.skein-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    mix-blend-mode: multiply;
    z-index: 1;
}

/* ============================================
   Configurator Container
   ============================================ */

#skeinConfigurator .skein-configurator-error {
    padding: 20px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    color: #856404;
}

#skeinConfigurator .skein-section {
    margin-bottom: 30px;
}

#skeinConfigurator .skein-section:last-child {
    margin-bottom: 0;
}

#skeinConfigurator .skein-section-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 15px 0;
    color: #333;
}

/* ============================================
   Length Selection
   ============================================ */

#skeinConfigurator .skein-length-select,
#skeinConfigurator select.skein-length-select,
#skeinConfigurator select#skeinLengthSelect {
    width: 100% !important;
    max-width: 100% !important;
    padding: 12px 40px 12px 16px !important;
    font-size: 16px !important;
    line-height: 1.5 !important;
    color: #333 !important;
    background-color: #fff !important;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 20px !important;
    border: 2px solid #ddd !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    height: auto !important;
    min-height: 48px !important;
    box-sizing: border-box !important;
    vertical-align: middle !important;
    margin: 0 !important;
}

#skeinConfigurator .skein-length-select:hover,
#skeinConfigurator select.skein-length-select:hover {
    border-color: #999 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

#skeinConfigurator .skein-length-select:focus,
#skeinConfigurator select.skein-length-select:focus {
    outline: none !important;
    border-color: #0071a1 !important;
    box-shadow: 0 0 0 3px rgba(0, 113, 161, 0.1) !important;
}

#skeinConfigurator .skein-length-select option,
#skeinConfigurator select.skein-length-select option {
    padding: 10px !important;
    font-size: 16px !important;
    line-height: 1.5 !important;
    color: #333 !important;
    background-color: #fff !important;
}

/* ============================================
   Color Slots
   ============================================ */

#skeinConfigurator .skein-slots-instruction {
    margin: 0 0 15px 0;
    color: #666;
    font-size: 14px;
    font-style: italic;
}

#skeinConfigurator .skein-color-slots {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    list-style: none;
    margin: 0;
    padding: 0;
}

#skeinConfigurator .skein-color-slot {
    width: 90px;
    height: 90px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: move;
    transition: all 0.2s ease;
    position: relative;
    background: #f5f5f5;
}

#skeinConfigurator .skein-color-slot:hover {
    border-color: #999;
    background: #ebebeb;
    transform: scale(1.02);
}

#skeinConfigurator .skein-color-slot.empty {
    background: #f5f5f5;
    cursor: pointer;
}

#skeinConfigurator .skein-color-slot.filled {
    border-style: solid;
    border-color: #333;
    cursor: move;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

#skeinConfigurator .skein-color-slot.filled:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

#skeinConfigurator .skein-color-slot .slot-edit-icon {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    color: #333;
    transition: all 0.2s ease;
    cursor: pointer;
    z-index: 10;
}

#skeinConfigurator .skein-color-slot .slot-edit-icon svg {
    width: 12px;
    height: 12px;
    fill: currentColor;
}

#skeinConfigurator .skein-color-slot .slot-clear-icon svg {
    width: 12px;
    height: 12px;
    fill: currentColor;
}

#skeinConfigurator .skein-color-slot .slot-clear-icon {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    background: rgba(220, 53, 69, 0.9);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

#skeinConfigurator .skein-color-slot.filled .slot-clear-icon {
    display: flex;
}

#skeinConfigurator .skein-color-slot .slot-name {
    padding: 2px 4px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
    font-size: 10px;
    line-height: 1.2;
    font-weight: 600;
    text-align: center;
    max-width: 96%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #333;
}

#skeinConfigurator .skein-color-slot.empty .slot-name {
    color: #999;
}

#skeinConfigurator .skein-slot-placeholder {
    background: #e0e0e0;
    border: 2px dashed #999;
}

/* ============================================
   Lurex Sparkle Shine Animation
   ============================================ */

@keyframes skein-shine {
    0%   { opacity: 0.05; }
    50%  { opacity: 1; }
    100% { opacity: 0.05; }
}

#skeinLurexSparkles rect {
    animation: skein-shine 2s ease-in-out infinite;
    /* duration & delay are set per-element in JS */
    will-change: opacity;
}

/* ============================================
   Nic Lurex Swatches
   ============================================ */

#skeinConfigurator .skein-lurex-swatches {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    list-style: none;
    margin: 0;
    padding: 0;
}

#skeinConfigurator .skein-lurex-swatch {
    min-width: 60px;
    width: auto;
    border: 2px solid #F5F5F5;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 6px 12px;
    background: #f5f5f5;
    background-size: cover;
    background-position: center;
    gap: 8px;
    overflow: hidden;
}

#skeinConfigurator .skein-lurex-swatch:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

#skeinConfigurator .skein-lurex-swatch .slot-name {
    display: inline-block;
    padding: 0 2px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
    font-size: 10px;
    line-height: 1.2;
    font-weight: 600;
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #333;
    z-index: 2;
}

#skeinConfigurator .skein-lurex-swatch.selected {
    border-color: #333;
}

#skeinConfigurator .skein-lurex-swatch-none {
    border-style: dashed;
    border-color: #ccc;
    box-shadow: none;
}

#skeinConfigurator .skein-lurex-swatch-none .slot-name {
    color: #999;
    background: transparent;
}

/* ============================================
   Sortable UI States
   ============================================ */

#skeinConfigurator .ui-sortable-helper {
    opacity: 0.8 !important;
    z-index: 1000 !important;
}

#skeinConfigurator .ui-sortable-placeholder {
    background: #e0e0e0 !important;
    border: 2px dashed #999 !important;
    visibility: visible !important;
}

#skeinConfigurator .skein-color-slots {
    position: relative;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
    #skeinConfigurator .skein-color-slots {
        justify-content: center;
    }

    #skeinConfigurator .skein-color-slot {
        width: 80px;
        height: 80px;
    }
}

@media (max-width: 480px) {
    #skeinConfigurator .skein-color-slot {
        width: 70px;
        height: 70px;
    }
}

/* ============================================
   SweetAlert2 Modal Customization
   ============================================ */

.skein-swal-popup .swal-color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 12px;
    margin: 20px 0;
}

.skein-swal-popup .swal-color-option,
.skein-swal-popup .empty-slot-option {
    aspect-ratio: 1;
    border: 2px dashed #ccc;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    padding: 0;
}

.skein-swal-popup .swal-color-option:hover,
.skein-swal-popup .empty-slot-option:hover,
.skein-swal-popup .swal-color-option.selected {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    border-color: #333;
}

.skein-swal-popup .empty-slot-option {
    background: #f5f5f5 !important;
}

.skein-swal-popup .swal-color-option span {
    padding: 4px 2px;
    max-width: 96%;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 10px;
    line-height: 1.2;
    text-align: center;
    font-weight: 500;
    border-radius: 4px;
}

.skein-swal-popup {
    border-radius: 12px;
}

.skein-swal-html {
    max-height: 70vh;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

.skein-swal-html::-webkit-scrollbar {
    width: 8px;
}

.skein-swal-html::-webkit-scrollbar-track {
    background: transparent;
}

.skein-swal-html::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.skein-swal-html::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.skein-swal-popup .skein-swal-deny {
    background-color: #f44336 !important;
}

.skein-swal-popup .skein-swal-deny:hover {
    background-color: #d32f2f !important;
}

.skein-swal-popup .swal2-close {
    position: absolute;
    top: 15px;
    right: 15px;
    color: #666;
    font-size: 28px;
    font-weight: bold;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    z-index: 1000;
}

.skein-swal-popup .swal2-close:hover {
    color: #dc3545;
    background: linear-gradient(135deg, #fff5f5 0%, #fef2f2 100%);
    border-color: #dc3545;
}

@media (max-width: 480px) {
    .skein-swal-popup .swal-color-grid {
        grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
    }
}

/* ============================================
   Next Slot Options (Yes/No buttons)
   ============================================ */

.skein-swal-popup .swal-next-slot-options {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin: 30px 0 10px 0;
    flex-wrap: wrap;
}

.skein-swal-popup .swal-next-slot-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 20px;
    border: 3px solid #ddd;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 160px;
    min-height: 140px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.skein-swal-popup .swal-next-slot-option:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #0071a1;
}

.skein-swal-popup .swal-next-slot-option.yes-option:hover {
    border-color: #28a745;
    background: linear-gradient(135deg, #f8fff9 0%, #e8f5e8 100%);
}

.skein-swal-popup .swal-next-slot-option.no-option:hover {
    border-color: #28a745;
    background: linear-gradient(135deg, #f8fff9 0%, #e8f5e8 100%);
}

.skein-swal-popup .option-icon {
    margin-bottom: 12px;
    color: #666;
    transition: color 0.3s ease;
}

.skein-swal-popup .swal-next-slot-option.yes-option:hover .option-icon {
    color: #28a745;
}

.skein-swal-popup .swal-next-slot-option.no-option:hover .option-icon {
    color: #28a745;
}

.skein-swal-popup .option-content {
    text-align: center;
}

.skein-swal-popup .option-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.skein-swal-popup .option-description {
    font-size: 12px;
    color: #666;
    line-height: 1.3;
}

@media (max-width: 480px) {
    .skein-swal-popup .swal-next-slot-options {
        flex-direction: column;
        gap: 15px;
    }

    .skein-swal-popup .swal-next-slot-option {
        width: 100%;
        padding: 20px 16px;
    }
}

/* ============================================
   Question Text Below Buttons
   ============================================ */

.skein-swal-popup .swal-question-text {
    margin-top: 20px;
    text-align: center;
    font-size: 16px;
    color: #333;
    line-height: 1.4;
    padding: 0 20px;
}

@media (max-width: 480px) {
    .skein-swal-popup .swal-question-text {
        font-size: 14px;
        padding: 0 10px;
    }
}
