* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #8B4513;
}

.main-content {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
}

#diy-bead-designer-root{
    max-width: unset !important;
}

.wp-block-post-content-is-layout-constrained{
    padding: 0;
}

.bead-selection {
    flex: 1;
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
}

.bead-preview {
    flex: 2;
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.bead-selector-mobile {
    display: none;
    background-color: white;
    padding: 14px 12px;
    border-radius: 14px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
    margin-top: 12px;
    margin-bottom: 30px;
}

.bead-selector-mobile .mobile-selector {
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: 10px;
    align-items: start;
}

.bead-selector-mobile .mobile-categories {
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: sticky;
    top: 8px;
}

.bead-selector-mobile .mobile-category-btn {
    border: 1px solid #f0e6dc;
    background: #faf7f3;
    color: #8B4513;
    padding: 5px 5px;
    border-radius: 10px;
    font-size: 13px;
    cursor: pointer;
    text-align: center;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.bead-selector-mobile .mobile-category-btn.active {
    background: #8B4513;
    color: #fff;
    border-color: #8B4513;
    box-shadow: 0 6px 12px rgba(139, 69, 19, 0.18);
}

.bead-selector-mobile .mobile-category-content .bead-list {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
}

.bead-preview .design-stats {
    justify-content: center;
    margin: 12px 0 18px;
    gap: 24px;
}

.bead-preview .stat-item {
    min-width: 90px;
}

.bead-preview .stat-value {
    font-size: 22px;
}

.canvas-container {
    position: relative;
    width: 500px;
    height: 500px;
    margin: 0 auto;
}

canvas {
    border: 1px solid #ddd;
    border-radius: 0;
}

.bead-category-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 20px;
}

.bead-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    user-select: none;
}

.bead-item {
    border: 1px solid #eee;
    border-radius: 14px;
    padding: 12px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    background: #fff;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.06);
}

.bead-item:hover {
    border-color: #8B4513;
    transform: translateY(-2px);
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.12);
}

.bead-category {
    margin-top: 20px;
}

.bead-category:first-child {
    margin-top: 0;
}

.bead-category h3 {
    font-size: 16px;
    color: #8B4513;
    margin-bottom: 0;
    text-align: left;
}

.bead-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 6px 4px;
    border-radius: 6px;
}

.bead-category-header:hover {
    background-color: #f7f2ed;
}

.bead-category-title {
    font-size: 16px;
    color: #8B4513;
    margin: 0;
}

.bead-category-toggle {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #8B4513;
    background: #f1e6dc;
}

.bead-category.collapsed .bead-list {
    display: none;
}

.bead-item img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 50%;
    margin-bottom: 10px;
    background: #f3f3f3;
}
.mobile-category-content .bead-item img {
    width: 50px;
    height: 50px;
}

.mobile-category-content p {
    font-size: 8px;
}

.mobile-category-content .bead-size {
    font-size: 10px;
    font-weight: 500;
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    white-space: nowrap;
}
.mobile-category-content .bead-size h4{
    font-size: 12px;
    font-weight: 600;
    display: inline;
    margin: 0;
}

.bead-item h3 {
    font-size: 13px;
    margin-bottom: 5px;
    color: #8B4513;
}

.bead-item p {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.bead-item .bead-stock {
    font-size: 12px;
    color: #8B4513;
    margin-bottom: 0;
}

.current-design {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.design-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.design-stats {
    display: flex;
    gap: 20px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #8B4513;
}

.stat-label {
    font-size: 14px;
    color: #666;
}

.design-beads {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 10px 0;
}

.design-bead {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    min-width: 100px;
}

.design-bead img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 50%;
    margin-bottom: 10px;
}

.design-bead h4 {
    font-size: 12px;
    margin-bottom: 5px;
}

.design-bead p {
    font-size: 10px;
    color: #666;
    margin-bottom: 10px;
}

.remove-bead {
    background-color: #ff4444;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 10px;
    cursor: pointer;
}

.remove-bead:hover {
    background-color: #cc0000;
}

.controls {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.design-history {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid #eee;
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.history-header h3 {
    font-size: 16px;
    color: #8B4513;
    margin: 0;
}

.history-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.history-item {
    border: 1px solid #f0e6dc;
    border-radius: 12px;
    padding: 12px;
    background: #fffaf5;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-thumb {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    object-fit: cover;
    background: #f3efe8;
    border: 1px solid #f0e6dc;
}

.history-thumb.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #b0a59a;
    font-size: 12px;
}

.history-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.history-title {
    font-size: 13px;
    color: #6b3410;
    font-weight: 600;
}

.history-stats {
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: #666;
    flex-wrap: wrap;
}

.history-actions {
    display: flex;
    gap: 8px;
}

.history-empty {
    padding: 16px;
    text-align: center;
    color: #999;
    background: #faf7f3;
    border-radius: 10px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.btn.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

.btn-primary {
    background-color: #8B4513;
    color: white;
}

.btn-primary:hover {
    background-color: #6B3410;
}

.btn-secondary {
    background-color: #ddd;
    color: #333;
}

.btn-secondary:hover {
    background-color: #ccc;
}

.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 9999;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

@media (max-width: 900px) {
    #previewCanvas{
        padding: 10px !important;
    }

    .main-content {
        flex-direction: column;
    }

    .bead-selection,
    .bead-preview {
        width: 100%;
    }

    .bead-selection {
        display: none;
    }

    .bead-selector-mobile {
        display: block;
    }

    .bead-selector-mobile .mobile-selector {
        max-height: 70vh;
        overflow: hidden;
    }

    .bead-selector-mobile .mobile-categories,
    .bead-selector-mobile .mobile-category-content {
        max-height: 100%;
        overflow-y: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .bead-selector-mobile .mobile-categories::-webkit-scrollbar,
    .bead-selector-mobile .mobile-category-content::-webkit-scrollbar {
        width: 0;
        height: 0;
    }

    .canvas-container {
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1;
        max-width: 420px;
    }

    .bead-list {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .bead-selector-mobile .mobile-category-content .bead-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 2px;
    }

    .history-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .controls {
        gap: 8px;
    }

    .btn {
        padding: 8px 14px;
        font-size: 12px;
        border-radius: 4px;
    }

    .btn.btn-small {
        padding: 4px 8px;
        font-size: 11px;
        border-radius: 6px;
    }
}
