/* ============================================================
   Getwine Custom Mixed Cases — Frontend Styles
   ============================================================ */

/* Intro text */
.gwmc-intro-text {
    text-align: center;
    margin: 0 0 20px;
}

/* Layout */
.gwmc-wrapper {
    width: 100%;
}

.gwmc-main {
    min-width: 0;
}

.gwmc-builder-panel-top {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    align-items: stretch;
}

.gwmc-builder-panel-main {
    flex: 2 1 0;
    min-width: 0;
}

.gwmc-running-total {
    flex: 1 1 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.gwmc-running-total-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.gwmc-running-total-value {
    font-size: 32px;
    font-weight: 700;
    color: #721c24;
}

@media ( max-width: 900px ) {
    .gwmc-builder-panel-top {
        flex-direction: column;
    }

    .gwmc-running-total {
        order: -1;
    }
}

/* Accordion */
.gwmc-accordion-item {
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
    overflow: hidden;
}

.gwmc-accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 15px 20px;
    background: #721c24;
    background-image: none;
    box-shadow: none;
    text-shadow: none;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    text-align: left;
    color: #ffffff;
    transition: background 0.2s;
}

.gwmc-accordion-header:hover {
    background: #5c161d;
}

.gwmc-accordion-header--active {
    background: #5c161d;
}

.gwmc-accordion-icon {
    font-size: 18px;
    line-height: 1;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.gwmc-accordion-header--active .gwmc-accordion-icon {
    transform: rotate(45deg);
}

.gwmc-accordion-body {
    padding: 20px;
}

/* Section intro text */
.gwmc-section-intro {
    color: #666;
    margin-bottom: 15px;
    font-size: 14px;
}

/* Product grid */
.gwmc-product-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
}

.gwmc-product-grid.gwmc-loading {
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    grid-template-columns: 1fr;
}

.gwmc-product-grid.gwmc-loading::after {
    content: "Loading…";
    color: #999;
    font-size: 14px;
}

/* Product card */
.gwmc-product-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding-top: 12px;
}

.gwmc-product-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    display: block;
}

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

.gwmc-product-title {
    font-size: 13px;
    margin: 0 0 8px;
    line-height: 1.4;
    flex-grow: 1;
    text-align: center;
    font-weight: 700;
    text-transform: none;
}

.gwmc-product-title a {
    color: #333;
    text-decoration: none;
    font-weight: 700;
    text-transform: none;
}

.gwmc-product-title a:hover {
    color: #c00;
}

.gwmc-product-leaf-category {
    font-style: italic;
    font-size: 12px;
    color: #666;
    text-align: center;
    margin: -4px 0 8px;
}

.gwmc-product-price {
    font-size: 13px;
    margin-top: auto;
    text-align: center;
}

.gwmc-product-price del {
    color: #999;
    font-size: 11px;
}

.gwmc-product-price ins {
    color: #721c24;
    text-decoration: none;
    font-weight: 600;
}

/* Add to Case button */
.gwmc-add-to-case {
    display: block;
    width: 100%;
    padding: 8px;
    background: #721c24;
    background-image: none;
    box-shadow: none;
    text-shadow: none;
    color: #ffffff;
    border: none;
    border-radius: 0 0 4px 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    transition: background 0.2s;
    margin-top: auto;
}

.gwmc-add-to-case:hover {
    background: #5c161d;
}

.gwmc-add-to-case:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Builder panel */
.gwmc-builder-panel {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 20px;
}

.gwmc-builder-title {
    margin: 0 0 10px;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.gwmc-bottle-count {
    font-size: 18px;
    font-weight: 600;
    margin: 5px 0;
    color: #333;
}

.gwmc-progress-bar {
    height: 6px;
    background: #eee;
    border-radius: 3px;
    margin: 8px 0;
    overflow: hidden;
}

.gwmc-progress-fill {
    height: 100%;
    background: #c00;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.gwmc-builder-items {
    min-height: 100px;
    border-top: 1px solid #eee;
    margin-top: 10px;
    padding-top: 10px;
}

.gwmc-builder-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.gwmc-builder-item:last-child {
    border-bottom: none;
}

.gwmc-builder-item img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 2px;
    flex-shrink: 0;
}

.gwmc-builder-item-name {
    flex-grow: 1;
    font-size: 13px;
    line-height: 1.3;
    color: #333;
}

.gwmc-qty-control {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.gwmc-qty-btn {
    width: 24px;
    height: 24px;
    border: 1px solid #ddd;
    background: #f5f5f5;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
    padding: 0;
    line-height: 1;
    color: #333;
}

.gwmc-qty-btn:hover {
    background: #e5e5e5;
}

.gwmc-qty-count {
    min-width: 20px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
}

/* Notice */
.gwmc-notice {
    padding: 10px 12px;
    border-radius: 3px;
    font-size: 13px;
    margin-top: 10px;
    line-height: 1.4;
    text-align: center;
}

.gwmc-notice--success {
    background: #eaf5ea;
    color: #1e7e34;
    border: 1px solid #b8ddb8;
}

.gwmc-notice--error {
    background: #fdecea;
    color: #c62828;
    border: 1px solid #f5c6c6;
}

/* Buttons */
.gwmc-btn {
    display: inline-block;
    padding: 9px 16px;
    border-radius: 3px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    border: 1px solid transparent;
    text-decoration: none;
    line-height: 1.4;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.gwmc-btn--primary {
    background: #721c24;
    background-image: none;
    box-shadow: none;
    text-shadow: none;
    color: #ffffff;
    border: none;
}

.gwmc-btn--primary:hover {
    background: #5c161d;
    color: #ffffff;
}

.gwmc-btn--primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.gwmc-btn--secondary {
    background: transparent;
    color: #555;
    border-color: #ccc;
}

.gwmc-btn--secondary:hover {
    background: #f5f5f5;
    color: #333;
}

.gwmc-btn--secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.gwmc-btn--danger {
    background: transparent;
    color: #c00;
    border-color: #c00;
}

.gwmc-btn--danger:hover {
    background: #fff0f0;
}

.gwmc-btn--small {
    padding: 4px 10px;
    font-size: 12px;
}

/* Builder actions */
.gwmc-builder-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 15px;
}

.gwmc-builder-actions .gwmc-btn {
    width: 100%;
    text-align: center;
}

/* Pagination */
.gwmc-pagination {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-top: 20px;
    align-items: center;
}

.gwmc-page-btn {
    display: inline-block;
    padding: 5px 10px;
    border: none;
    border-radius: 3px;
    font-size: 13px;
    cursor: pointer;
    background: #721c24;
    background-image: none;
    box-shadow: none;
    text-shadow: none;
    color: #ffffff;
    text-decoration: none;
    line-height: 1.4;
    transition: background 0.2s;
}

.gwmc-page-btn:hover {
    background: #5c161d;
}

.gwmc-page-btn--active {
    background: #5c161d;
    color: #ffffff;
    cursor: default;
}

.gwmc-page-btn--active:hover {
    background: #5c161d;
}

/* All products filters */
.gwmc-all-products-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.gwmc-search-input,
.gwmc-category-select {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 14px;
    color: #333;
}

.gwmc-search-input {
    flex: 1;
    min-width: 180px;
}

#gwmc-search {
    padding: 8px 10px;
}

.gwmc-category-select {
    min-width: 160px;
}

/* Section (estates/preferences) filters */
.gwmc-section-filters {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 15px;
}

.gwmc-sort-label {
    font-size: 13px;
    color: #666;
}

.gwmc-sort-select {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 14px;
    color: #333;
    min-width: 200px;
}

/* Previous/Draft cases */
.gwmc-previous-case,
.gwmc-draft-case {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 15px;
}

.gwmc-previous-case-header,
.gwmc-draft-case-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.gwmc-case-date {
    font-size: 13px;
    color: #666;
}

.gwmc-draft-actions,
.gwmc-previous-case-actions {
    display: flex;
    gap: 6px;
}

.gwmc-case-contents {
    border-top: 1px solid #eee;
    padding-top: 8px;
    margin-top: 8px;
}

.gwmc-case-product-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

.gwmc-case-product-row img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 2px;
    flex-shrink: 0;
}

.gwmc-case-product-name {
    flex-grow: 1;
    font-size: 13px;
    color: #333;
}

.gwmc-case-product-qty {
    font-size: 13px;
    color: #666;
    flex-shrink: 0;
}

.gwmc-case-product-row.gwmc-out-of-stock img {
    opacity: 0.5;
}

.gwmc-case-product-row.gwmc-out-of-stock .gwmc-case-product-name {
    color: #999;
    text-decoration: line-through;
}

.gwmc-case-product-stock-badge {
    font-size: 11px;
    font-weight: 600;
    color: #c62828;
    background: #fdecea;
    border: 1px solid #f5c6c6;
    border-radius: 3px;
    padding: 2px 6px;
    flex-shrink: 0;
}

/* Add to cart modal */
.gwmc-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gwmc-modal {
    background: #fff;
    border-radius: 4px;
    padding: 30px;
    max-width: 420px;
    width: 90%;
    text-align: center;
}

.gwmc-modal-message {
    font-size: 16px;
    margin: 0 0 20px;
    color: #333;
}

.gwmc-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Debug output */
.gwmc-debug-output {
    margin-top: 30px;
    padding: 15px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Empty builder state */
.gwmc-builder-empty {
    text-align: center;
    color: #999;
    font-size: 13px;
    padding: 20px 0;
}

/* Cart display */
.gwmc-cart-item-title {
    display: block;
    font-weight: 700;
    margin-bottom: 8px;
}

.gwmc-cart-contents-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.gwmc-cart-contents-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

.gwmc-cart-contents-image img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    display: block;
}

.gwmc-cart-contents-name {
    flex-grow: 1;
    font-size: 13px;
}

.gwmc-cart-contents-price,
.gwmc-cart-contents-qty {
    flex-shrink: 0;
    font-size: 12px;
    color: #666;
}

/* Existing case notice */
.gwmc-existing-case-notice {
    text-align: center;
    margin: 0 0 20px;
}

/* Responsive */
@media ( max-width: 600px ) {
    .gwmc-product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

@media ( max-width: 400px ) {
    .gwmc-product-grid {
        grid-template-columns: 1fr;
    }
}
