/* Switch Configurator Styles */
.configurator-wrapper {
    max-width: 1000px;
    margin: 40px auto;
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 30px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.preview-area {
    position: relative;
    height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    transition: background-image 0.5s ease-in-out;
}

.preview-area::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, transparent 0%, rgba(0, 0, 0, 0.4) 100%);
}

/* CSS-Driven Glass Switch */
.switch-preview {
    position: relative;
    width: 280px;
    height: 400px;
    /* Increased to accommodate socket */
    z-index: 2;
    padding: 15px;
    border-radius: 24px;
    background: var(--panel-border-color, #444);
    box-shadow:
        0 30px 60px rgba(0, 0, 0, 0.8),
        inset 0 1px 1px rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.glass-front {
    position: relative;
    width: 100%;
    height: 100%;
    background: var(--panel-color, #222);
    border-radius: 12px;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr auto;
    /* Rows adjusted for socket */
    gap: 30px;
    padding: 30px;
    box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
}

/* Glass Reflection */
.glass-front::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%, rgba(255, 255, 255, 0.05) 50%, transparent 100%);
    pointer-events: none;
}

.touch-ring {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
    /* Placeholder for empty state */
}

.touch-ring.empty {
    border: none;
    background: none;
    box-shadow: none;
}

/* The "Circle with One Line" indicator */
.touch-ring.empty::after {
    content: '';
    position: absolute;
    width: 32px;
    /* Increased by 30% */
    height: 32px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.touch-ring.empty::before {
    content: '';
    position: absolute;
    width: 2px;
    height: 11px;
    /* Increased proportionally */
    background: rgba(255, 255, 255, 0.2);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.3s ease;
    border-radius: 2px;
}

/* Active Glow for Empty Rings */
.touch-ring.empty.active::after {
    border-color: var(--gold-primary);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.6), inset 0 0 8px rgba(212, 175, 55, 0.4);
}

.touch-ring.empty.active::before {
    background: var(--gold-primary);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.8);
}

.touch-ring.active {
    filter: drop-shadow(0 0 10px rgba(212, 175, 55, 0.6));
}

/* Power Socket Component */
.universal-socket {
    grid-column: span 2;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.socket-holes {
    width: 60px;
    height: 60px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    position: relative;
}

.socket-holes::before,
.socket-holes::after {
    content: '';
    position: absolute;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

/* Pin indicators */
.socket-holes::before {
    width: 8px;
    height: 8px;
    top: 15px;
    left: 12px;
}

.socket-holes::after {
    width: 8px;
    height: 8px;
    top: 15px;
    right: 12px;
}

.earth-pin {
    position: absolute;
    width: 10px;
    height: 10px;
    background: rgba(255, 255, 255, 0.2);
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 50%;
}

.touch-ring i {
    z-index: 3;
    font-size: 2.2rem;
    /* Significantly larger icon */
    color: rgba(255, 255, 255, 0.3);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    margin: 0;
    /* Ensure no offset */
}

.touch-ring.active i {
    color: var(--gold-primary);
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

.remove-trigger {
    position: absolute;
    bottom: -2px;
    /* Shifted inwards to avoid clipping */
    right: -2px;
    width: 24px;
    height: 24px;
    background: rgba(10, 10, 10, 1);
    /* Solid black background */
    color: var(--gold-primary);
    border: 1px solid var(--gold-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    /* Reduced by another 15% */
    cursor: pointer;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 100;
    /* Ensure it's on top of everything */
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.8);
}

.touch-ring:not(.empty):hover .remove-trigger {
    opacity: 1;
    transform: scale(1);
}

.remove-trigger:hover {
    background: #851d1d;
    /* Deep luxury red */
    color: #fff;
    border-color: #ff4d4d;
    transform: scale(1.15) !important;
    box-shadow: 0 0 15px rgba(255, 77, 77, 0.4);
}

/* Icon Library */
.icon-library {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.icon-scroll {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding: 10px 5px;
    scrollbar-width: thin;
    scrollbar-color: var(--gold-primary) transparent;
}

.icon-item {
    min-width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    /* Make circles to match swatches */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    transition: all 0.2s ease;
    font-size: 1.1rem;
    color: var(--text-gray);
}

.icon-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--gold-primary);
    color: var(--text-white);
}

.icon-item:active {
    cursor: grabbing;
}

.drop-target-active {
    background: rgba(212, 175, 55, 0.2) !important;
    border-color: var(--gold-primary) !important;
    transform: scale(1.1);
}

.configurator-controls {
    padding: 25px;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    gap: 15px;
    /* Slightly tighter gap */
}

/* Toggle Styles */
.toggle-group {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 4px;
    gap: 4px;
}

.toggle-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-gray);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.toggle-btn.active {
    background: var(--gold-primary);
    color: black;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.control-group h4 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gold-primary);
    margin-bottom: 15px;
}

/* Icon Tabs */
.icon-tabs {
    display: flex;
    gap: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 15px;
    overflow-x: auto;
    padding-bottom: 5px;
    scrollbar-width: none;
}

.icon-tabs::-webkit-scrollbar {
    display: none;
}

.tab-link {
    background: none;
    border: none;
    color: var(--text-gray);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 5px 0;
    cursor: pointer;
    white-space: nowrap;
    position: relative;
    transition: all 0.2s ease;
}

.tab-link.active {
    color: var(--gold-primary);
}

.tab-link.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--gold-primary);
}

/* Clear Action */
.action-bar {
    display: flex;
    justify-content: flex-end;
    margin-top: 15px;
}

.clear-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-gray);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clear-btn:hover {
    background: rgba(255, 77, 77, 0.1);
    color: #ff4d4d;
    border-color: rgba(255, 77, 77, 0.2);
}

.option-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.swatch-opt {
    position: relative;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    padding: 0;
    background: none;
}

.swatch-opt:hover {
    transform: scale(1.15);
}

.swatch-opt.active {
    border-color: var(--gold-primary);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

.swatch-opt .swatch {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.swatch-opt span {
    position: absolute;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.6rem;
    color: var(--text-gray);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.swatch-opt:hover span,
.swatch-opt.active span {
    opacity: 1;
}

/* Material Swatches */
.swatch.black {
    background: #000000;
}

.swatch.white {
    background: #ffffff;
}

.swatch.gray {
    background: #8e8e8e;
}

.swatch.light-gray {
    background: #d3d3d3;
}

.swatch.royal-blue {
    background: #414b8a;
}

.swatch.gold {
    background: #c5a059;
}

.swatch.platinum {
    background: #e5e4e2;
}

.swatch.rose {
    background: #b76e79;
}

.swatch.border-gold {
    background: #e0cca7;
}

.swatch.border-silver {
    background: #aaa;
}

.swatch.border-dark {
    background: #333;
}


.swatch.neutral {
    background: #333;
}

/* Icon Grid Styles */
.icon-grid-display {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-top: 40px;
}

.icon-card {
    background: rgba(255, 255, 255, 0.03);
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.3s ease;
}

.icon-card:hover {
    transform: translateY(-5px);
    border-color: var(--gold-primary);
}

.icon-card i {
    font-size: 2rem;
    color: var(--gold-primary);
    margin-bottom: 15px;
}

@media (max-width: 768px) {
    .configurator-wrapper {
        grid-template-columns: 1fr;
        margin: 20px;
    }

    .preview-area {
        height: 450px;
        /* Increased to fit the 400px switch comfortably */
    }

    .configurator-controls {
        padding: 20px;
    }

    .switch-preview {
        transform: scale(0.85);
        /* Scale down to ensure it fits mobile widths */
    }

    .glass-front {
        gap: 20px;
        /* Tighter gap for mobile */
        padding: 20px;
    }

    .universal-socket {
        height: 80px;
        /* Slightly smaller socket for mobile */
    }

    .socket-holes {
        width: 50px;
        height: 50px;
    }
}

@media (max-width: 480px) {
    .preview-area {
        height: 400px;
    }

    .switch-preview {
        transform: scale(0.7);
        /* Further scale for very small screens */
    }
}
