/* Main Wrapper */
.wp-bracelet-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    max-width: 1400px;
    /* Increased max-width */
    margin: 0 auto;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

/* Controls */
.wp-bracelet-controls {
    flex: 1;
    min-width: 300px;
    /* Reduced min-width slightly */
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.control-group {
    margin-bottom: 20px;
}

.control-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    text-transform: uppercase;
}

select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Stones Grid */
.stones-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    max-height: 500px;
    overflow-y: auto;
    padding: 5px;
}

.stone-item {
    width: 60px;
    height: auto;
    border-radius: 0;
    cursor: pointer;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    border: none;
}

.info {
    font-style: italic;
    font-size: 12px;
    color: #222;
}

.stone-visual {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    transition: box-shadow 0.2s;
    background-color: #ddd;
    background-size: cover;
    background-position: center;
    box-sizing: border-box;
}

.stone-item:hover .stone-visual {
    /* No scale effect */
}

.stone-item.selected .stone-visual {
    border-color: #c3935b;
    box-shadow: 0 0 0 3px rgba(195, 147, 91, 0.5);
}

.wp-bracelet-big-btn {
    display: block;
    width: 100%;
    padding: 15px !important;
    font-size: 1.2em !important;
    text-transform: uppercase;
    font-weight: bold;
    margin-bottom: 10px;
    background-color: #c3935b !important;
    color: white !important;
    border: none !important;
    text-align: center;
    cursor: pointer;
}

.wp-bracelet-big-btn:hover {
    background-color: #a87b48 !important;
}

/* Secondary Actions Buttons */
#wp-bracelet-reset,
#wp-bracelet-save {
    background-color: #f0f0f1 !important;
    color: #2c3338 !important;
    border: 1px solid #8c8f94 !important;
    text-transform: uppercase;
    font-weight: bold;
    padding: 10px !important;
}

#wp-bracelet-reset:hover,
#wp-bracelet-save:hover {
    background-color: #dcdcde !important;
    color: #0a4b78 !important;
}

.stone-label {
    display: block;
    margin-top: 5px;
    font-size: 11px;
    text-align: center;
    line-height: 1.2;
    color: #444;
    word-break: break-word;
    width: 100%;
}

.stone-tooltip {
    display: none;
}

/* Preview Area (2D) */
.wp-bracelet-preview {
    flex: 2;
    min-width: 300px;
    /* Reduced min-width */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 20px;
}

.bracelet-circle {
    position: relative;
    width: 100%;
    max-width: 600px;
    aspect-ratio: 1 / 1;
    /* Make it square and responsive */
    height: auto;
    /* Allow height to adjust */
    margin: 0 auto 20px auto;
    flex-shrink: 0;
}

.bead {
    cursor: pointer;
    transition: transform 0.1s;
}

.bead:hover {
    z-index: 10;
}

/* Details Section */
.bracelet-details {
    width: 100%;
    background: #f4f4f4;
    padding: 15px;
    border-radius: 5px;
    border: 1px solid #e0e0e0;
    font-size: 14px;
    color: #333;
}

.bracelet-details h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 16px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
}

.bracelet-details ul {
    list-style: disc;
    padding-left: 20px;
    margin: 5px 0;
}

/* Sequence Generator */
.sequence-controls {
    border-top: 1px solid #eee;
    padding-top: 20px;
}

.sequence-inputs {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
    /* Allow wrapping on small screens */
}

.sequence-inputs button {
    flex: 1;
    padding: 8px 10px;
    font-size: 12px;
    cursor: pointer;
    background: #f1f1f1;
    border: 1px solid #ccc;
    border-radius: 4px;
    min-width: 80px;
}

.sequence-inputs button:hover {
    background: #e5e5e5;
}

#current-sequence-display {
    display: flex;
    gap: 5px;
    min-height: 20px;
    flex-wrap: wrap;
}

.sequence-bead {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-size: cover;
}

/* Save Controls (Now in Preview) */
.save-controls {
    /* Styles are handled partly inline or globally, but ensuring layout here */
    width: 100%;
}

.secondary-actions {
    flex-wrap: wrap;
    /* Stack buttons on very small screens */
}

/* Media Queries for Responsiveness */
@media screen and (max-width: 900px) {
    .wp-bracelet-wrapper {
        flex-direction: column;
    }

    .wp-bracelet-controls,
    .wp-bracelet-preview {
        width: 100%;
        min-width: unset;
        /* Remove min-width constraint */
        box-sizing: border-box;
    }

    .bracelet-circle {
        max-width: 100%;
        /* Utilize full width on mobile */
    }
}

@media screen and (max-width: 480px) {
    .stones-grid {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 10px;
        /* Adjust gap for grid */
    }

    .stone-item {
        width: 100%;
        /* Fill grid cell */
        height: auto;
    }

    .stone-visual {
        width: 100%;
        /* Responsive to cell width */
        height: auto;
        aspect-ratio: 1 / 1;
        /* Keep square */
    }

    .stone-label {
        font-size: 10px;
    }

    .wp-bracelet-big-btn {
        font-size: 1em !important;
        padding: 12px !important;
    }

    .secondary-actions {
        flex-direction: column;
    }

    .sequence-inputs button {
        font-size: 11px;
        padding: 6px;
    }
}