/* Premium Style for Build Your Own Gift Box */

.gift-box-builder {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    color: #333333;
}

.gbb-header {
    text-align: center;
    margin-bottom: 40px;
}

.gbb-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 12px;
}

.gbb-subtitle {
    font-size: 1.1rem;
    color: #666666;
    max-width: 600px;
    margin: 0 auto;
}

/* Controls */
.gbb-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 40px;
}

@media(min-width: 768px) {
    .gbb-controls {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.gbb-search-wrapper {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.gbb-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: #888;
}

#gbb-search {
    width: 100%;
    padding: 12px 16px 12px 46px;
    font-size: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 30px;
    background: #f8fafc;
    transition: all 0.3s ease;
}

#gbb-search:focus {
    outline: none;
    border-color: #1a1a1a;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.gbb-categories {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: none;
}

.gbb-categories::-webkit-scrollbar {
    display: none;
}

.gbb-cat-btn {
    white-space: nowrap;
    padding: 8px 18px;
    font-size: 0.95rem;
    background: #f1f5f9;
    border: 1px solid transparent;
    color: #475569;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.gbb-cat-btn.active, .gbb-cat-btn:hover {
    background: #1a1a1a;
    color: #ffffff;
}

/* Layout */
.gbb-main-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    align-items: start;
}

@media(min-width: 1024px) {
    .gbb-main-layout {
        grid-template-columns: 1fr 380px;
    }
}

/* Products Container & Grid */
.gbb-products-container {
    width: 100%;
}

.gbb-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
}

.gbb-product-card {
    background: #ffffff;
    border: 1px solid #f1f5f9;
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.gbb-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.06);
    border-color: #e2e8f0;
}

.gbb-product-card.selected {
    border-color: #1a1a1a;
    box-shadow: 0 4px 16px rgba(0,0,0,0.04);
}

.gbb-product-card.out-of-stock {
    opacity: 0.6;
}

.gbb-product-img-wrapper {
    position: relative;
    padding-top: 100%; /* 1:1 Aspect ratio */
    background: #fafafa;
}

.gbb-product-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gbb-stock-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #ef4444;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
}

.gbb-product-info {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.gbb-product-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 8px 0;
}

.gbb-product-desc {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 16px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gbb-product-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
}

.gbb-product-price {
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
}

/* Quantity controls */
.gbb-qty-controls {
    display: flex;
    align-items: center;
    background: #f1f5f9;
    border-radius: 20px;
    padding: 4px;
}

.gbb-qty-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    font-weight: 600;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1e293b;
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.gbb-qty-btn:hover:not(:disabled) {
    background: #e2e8f0;
}

.gbb-qty-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.gbb-qty-val {
    width: 24px;
    text-align: center;
    font-weight: 600;
    font-size: 0.95rem;
    color: #1e293b;
}

/* Summary Panel */
.gbb-summary-panel {
    position: sticky;
    top: 40px;
}

body.admin-bar .gbb-summary-panel {
    top: calc(40px + var(--wp-admin--admin-bar--height, 32px));
}

.gbb-summary-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.04);
}

.gbb-summary-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.gbb-selected-list {
    min-height: 80px;
    max-height: 240px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.gbb-empty-msg {
    color: #94a3b8;
    font-size: 0.9rem;
    text-align: center;
    padding: 20px 0;
}

.gbb-selected-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px dashed #f1f5f9;
}

.gbb-selected-details {
    display: flex;
    flex-direction: column;
}

.gbb-selected-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: #334155;
}

.gbb-selected-qty {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 2px;
}

.gbb-selected-price {
    font-size: 0.9rem;
    font-weight: 600;
    color: #0f172a;
}

/* Pricing Breakdown */
.gbb-pricing-breakdown {
    border-top: 1px solid #f1f5f9;
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gbb-price-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #64748b;
}

.gbb-total-row {
    font-size: 1.2rem;
    font-weight: 700;
    color: #0f172a;
    border-top: 1px solid #e2e8f0;
    padding-top: 12px;
    margin-top: 4px;
}

/* CTA */
.gbb-primary-btn {
    width: 100%;
    padding: 16px;
    background: #1a1a1a;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.gbb-primary-btn:hover:not(:disabled) {
    background: #000000;
}

.gbb-primary-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.gbb-primary-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}

.gbb-spinner {
    animation: gbb-spin 1s linear infinite;
    width: 20px;
    height: 20px;
    color: #ffffff;
}

.gbb-cart-message {
    margin-top: 14px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    text-align: center;
}

.gbb-cart-message.success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.gbb-cart-message.error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

@keyframes gbb-spin {
    to { transform: rotate(360deg); }
}
