/* ==========================================================================
   Simple WooCommerce Subscription — Meal Plan Builder
   ========================================================================== */

/* --- Reset & Base --- */
.sws-meal-plan-wrapper {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 40px 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #1a1a2e;
    box-sizing: border-box;
}

/* Break out of narrow theme containers */
body .sws-meal-plan-wrapper {
    max-width: 1200px !important;
    width: calc(100% - 40px) !important;
    float: none !important;
}

.sws-meal-plan-wrapper *,
.sws-meal-plan-wrapper *::before,
.sws-meal-plan-wrapper *::after {
    box-sizing: border-box;
}

.sws-meal-plan-container {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

/* --- Page Header with Pet Elements --- */
.sws-header {
    text-align: center;
    padding: 56px 40px 40px;
    background: linear-gradient(135deg, #0f3443 0%, #34e89e 100%);
    color: #fff;
    position: relative;
    overflow: hidden;
}

/* Floating pet paw prints */
.sws-header::before {
    content: '🐾';
    position: absolute;
    top: 16px;
    left: 5%;
    font-size: 2.8em;
    opacity: 0.15;
    transform: rotate(-25deg);
    animation: swsFloat 6s ease-in-out infinite;
}

.sws-header::after {
    content: '🐾';
    position: absolute;
    bottom: 12px;
    right: 6%;
    font-size: 2.4em;
    opacity: 0.15;
    transform: rotate(20deg);
    animation: swsFloat 6s ease-in-out infinite 3s;
}

@keyframes swsFloat {

    0%,
    100% {
        transform: translateY(0) rotate(-25deg);
    }

    50% {
        transform: translateY(-8px) rotate(-20deg);
    }
}

/* Pet decorations container */
.sws-pet-decorations {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.sws-pet-deco {
    position: absolute;
    opacity: 0.12;
    font-size: 1.8em;
}

.sws-pet-deco:nth-child(1) {
    top: 20%;
    left: 12%;
    font-size: 2.2em;
    animation: swsFloat 5s ease-in-out infinite 0.5s;
}

.sws-pet-deco:nth-child(2) {
    top: 60%;
    left: 4%;
    font-size: 1.6em;
    animation: swsFloat 7s ease-in-out infinite 1s;
}

.sws-pet-deco:nth-child(3) {
    top: 15%;
    right: 10%;
    font-size: 2em;
    animation: swsFloat 6s ease-in-out infinite 2s;
}

.sws-pet-deco:nth-child(4) {
    top: 65%;
    right: 5%;
    font-size: 1.5em;
    animation: swsFloat 8s ease-in-out infinite 1.5s;
}

.sws-pet-deco:nth-child(5) {
    top: 40%;
    left: 2%;
    font-size: 1.3em;
    animation: swsFloat 5.5s ease-in-out infinite 3.5s;
}

.sws-pet-deco:nth-child(6) {
    top: 35%;
    right: 3%;
    font-size: 1.4em;
    animation: swsFloat 6.5s ease-in-out infinite 2.5s;
}

/* Title icon */
.sws-title-icon {
    font-size: 2em;
    display: block;
    margin-bottom: 8px;
    animation: swsBounce 2s ease-in-out infinite;
}

@keyframes swsBounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-6px);
    }
}

.sws-page-title {
    font-size: 2.6em;
    font-weight: 700;
    margin: 0 0 10px;
    letter-spacing: -0.5px;
    position: relative;
    z-index: 1;
}

.sws-page-subtitle {
    font-size: 1.15em;
    opacity: 0.9;
    margin: 0;
    font-weight: 400;
    position: relative;
    z-index: 1;
}

/* --- Steps Indicator --- */
.sws-steps-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 40px;
    background: #f8fafb;
    border-bottom: 1px solid #e8ecf0;
    gap: 0;
}

.sws-step {
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0.4;
    transition: opacity 0.3s ease;
}

.sws-step.active,
.sws-step.completed {
    opacity: 1;
}

.sws-step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #d1d5db;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1em;
    transition: background 0.3s ease;
}

.sws-step.active .sws-step-number {
    background: #0f3443;
}

.sws-step.completed .sws-step-number {
    background: #34e89e;
}

.sws-step-label {
    font-size: 1em;
    font-weight: 600;
    color: #374151;
}

.sws-step-connector {
    width: 80px;
    height: 3px;
    background: #d1d5db;
    margin: 0 16px;
    border-radius: 2px;
    transition: background 0.3s ease;
}

.sws-step-connector.completed {
    background: #34e89e;
}

/* --- Step Panels --- */
.sws-step-panel {
    padding: 48px;
    animation: swsFadeIn 0.4s ease;
}

@keyframes swsFadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sws-panel-header {
    margin-bottom: 36px;
}

.sws-panel-header h2 {
    font-size: 1.7em;
    font-weight: 700;
    margin: 0 0 10px;
    color: #1a1a2e;
}

.sws-panel-header p {
    color: #6b7280;
    font-size: 1.05em;
    margin: 0;
}

/* --- Allergen Grid --- */
.sws-allergen-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 36px;
}

.sws-allergen-item {
    cursor: pointer;
    margin: 0;
}

.sws-allergen-checkbox {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.sws-allergen-label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: #f3f4f6;
    border: 2px solid transparent;
    border-radius: 12px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.sws-allergen-item:hover .sws-allergen-label {
    background: #e5e7eb;
    border-color: #d1d5db;
}

.sws-allergen-checkbox:checked+.sws-allergen-label {
    background: #fee2e2;
    border-color: #ef4444;
    color: #b91c1c;
}

.sws-allergen-check {
    width: 24px;
    height: 24px;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85em;
    color: transparent;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sws-allergen-checkbox:checked+.sws-allergen-label .sws-allergen-check {
    background: #ef4444;
    border-color: #ef4444;
    color: #fff;
}

.sws-allergen-name {
    font-size: 1em;
}

/* --- Duration Selector --- */
.sws-duration-selector {
    margin-bottom: 36px;
    padding: 28px;
    background: #f8fafb;
    border-radius: 14px;
    border: 1px solid #e8ecf0;
}

.sws-duration-selector h3 {
    font-size: 1.15em;
    font-weight: 700;
    margin: 0 0 18px;
    color: #1a1a2e;
}

.sws-duration-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.sws-duration-option {
    cursor: pointer;
    margin: 0;
}

.sws-duration-radio {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.sws-duration-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 20px;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 14px;
    transition: all 0.2s ease;
    text-align: center;
}

.sws-duration-option:hover .sws-duration-card {
    border-color: #0f3443;
}

.sws-duration-radio:checked+.sws-duration-card {
    border-color: #0f3443;
    background: #0f3443;
    color: #fff;
    box-shadow: 0 4px 16px rgba(15, 52, 67, 0.25);
}

.sws-duration-days {
    font-size: 2.4em;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 6px;
}

.sws-duration-label {
    font-size: 0.9em;
    font-weight: 500;
    opacity: 0.8;
}

/* --- Products Grid --- */
.sws-products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 36px;
    min-height: 200px;
}

.sws-product-card {
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 14px;
    overflow: hidden;
    transition: all 0.25s ease;
    cursor: pointer;
}

.sws-product-card:hover {
    border-color: #d1d5db;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    transform: translateY(-3px);
}

.sws-product-card.selected {
    border-color: #34e89e;
    box-shadow: 0 8px 24px rgba(52, 232, 158, 0.2);
}

.sws-product-image {
    aspect-ratio: 1;
    overflow: hidden;
    background: #f9fafb;
}

.sws-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.sws-product-card:hover .sws-product-image img {
    transform: scale(1.05);
}

.sws-product-info {
    padding: 18px;
}

.sws-product-title {
    font-size: 1em;
    font-weight: 600;
    margin: 0 0 8px;
    color: #1a1a2e;
    line-height: 1.3;
}

.sws-product-price {
    font-size: 1.05em;
    font-weight: 700;
    color: #0f3443;
}

.sws-product-price del {
    color: #9ca3af;
    font-weight: 400;
    font-size: 0.85em;
}

.sws-product-price ins {
    text-decoration: none;
}

.sws-product-actions {
    padding: 0 18px 18px;
}

.sws-add-product-btn {
    width: 100%;
    padding: 12px 18px;
    border: 2px solid #0f3443;
    background: transparent;
    color: #0f3443;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95em;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.sws-add-product-btn:hover {
    background: #0f3443;
    color: #fff;
}

.sws-add-product-btn .sws-btn-check {
    display: none;
}

.sws-product-card.selected .sws-add-product-btn {
    background: #34e89e;
    border-color: #34e89e;
    color: #fff;
}

.sws-product-card.selected .sws-add-product-btn .sws-btn-text {
    display: none;
}

.sws-product-card.selected .sws-add-product-btn .sws-btn-check {
    display: inline;
    font-size: 1.2em;
}

/* --- Variation Selectors --- */
.sws-variation-selectors {
    margin-top: 10px;
    padding: 12px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
}

.sws-variation-field {
    margin-bottom: 8px;
}

.sws-variation-field:last-child {
    margin-bottom: 0;
}

.sws-variation-field label {
    display: block;
    font-size: 0.8em;
    font-weight: 600;
    color: #374151;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sws-variation-select {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: 500;
    color: #0f3443;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s ease;
    appearance: auto;
}

.sws-variation-select:focus {
    outline: none;
    border-color: #34e89e;
}

.sws-variable-product .sws-product-title::after {
    content: 'Options';
    display: inline-block;
    font-size: 0.65em;
    font-weight: 600;
    background: #dbeafe;
    color: #1d4ed8;
    padding: 2px 8px;
    border-radius: 20px;
    margin-left: 6px;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.sws-variable-product.sws-variation-chosen .sws-product-title::after {
    background: #d1fae5;
    color: #047857;
    content: '✓ Selected';
}

/* --- Quantity Stepper --- */
.sws-qty-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-top: 10px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}

.sws-qty-minus,
.sws-qty-plus {
    width: 40px;
    height: 40px;
    border: none;
    background: #f3f4f6;
    color: #0f3443;
    font-size: 1.2em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.sws-qty-minus:hover,
.sws-qty-plus:hover {
    background: #0f3443;
    color: #fff;
}

.sws-qty-value {
    width: 40px;
    text-align: center;
    font-size: 1.1em;
    font-weight: 700;
    color: #0f3443;
    background: #fff;
    line-height: 40px;
}

/* --- Quota Bar --- */
.sws-quota-section {
    margin-bottom: 28px;
    position: relative;
}

.sws-quota-bar {
    background: #f8fafb;
    border: 1px solid #e8ecf0;
    border-radius: 12px;
    padding: 18px 24px;
    transition: all 0.3s ease;
}

.sws-quota-bar-track {
    height: 12px;
    background: #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 10px;
}

.sws-quota-fill {
    height: 100%;
    background: linear-gradient(90deg, #34e89e, #0f3443);
    border-radius: 6px;
    width: 0%;
    transition: width 0.4s ease, background 0.4s ease;
}

.sws-quota-fill.sws-quota-partial {
    background: linear-gradient(90deg, #34e89e, #0f9b6e);
}

.sws-quota-fill.sws-quota-full {
    background: linear-gradient(90deg, #34e89e, #0f3443);
}

.sws-quota-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.92em;
    color: #6b7280;
}

.sws-quota-info strong {
    color: #0f3443;
    font-size: 1.1em;
}

.sws-quota-remaining-num {
    font-weight: 700;
    color: #0f3443;
}

/* Shake animation */
@keyframes swsShake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-6px);
    }

    40% {
        transform: translateX(6px);
    }

    60% {
        transform: translateX(-4px);
    }

    80% {
        transform: translateX(4px);
    }
}

.sws-quota-shake {
    animation: swsShake 0.5s ease;
    border-color: #ef4444 !important;
}

/* Toast alert — fixed center-screen overlay */
.sws-quota-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: #fef3c7;
    color: #92400e;
    border: 2px solid #fbbf24;
    padding: 20px 32px;
    border-radius: 14px;
    font-size: 1em;
    font-weight: 600;
    text-align: center;
    max-width: 440px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 99999;
}

.sws-quota-toast.sws-toast-show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}

/* --- Loading Spinner --- */
.sws-loading {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: #6b7280;
}

.sws-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid #e5e7eb;
    border-top-color: #0f3443;
    border-radius: 50%;
    animation: swsSpin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes swsSpin {
    to {
        transform: rotate(360deg);
    }
}

/* --- No Products --- */
.sws-no-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    color: #6b7280;
}

.sws-no-products p {
    font-size: 1.15em;
}

/* --- Review Section --- */
.sws-review-section {
    background: #f8fafb;
    border-radius: 14px;
    padding: 36px;
    margin-bottom: 36px;
    border: 1px solid #e8ecf0;
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}

.sws-review-duration {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 26px;
    padding-bottom: 18px;
    border-bottom: 1px solid #e8ecf0;
    font-size: 1.1em;
}

.sws-review-label {
    font-weight: 600;
    color: #374151;
}

.sws-review-value {
    font-weight: 700;
    color: #0f3443;
}

.sws-review-products {
    margin-bottom: 26px;
}

.sws-review-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid #e8ecf0;
}

.sws-review-item:last-child {
    border-bottom: none;
}

.sws-review-item-name {
    font-weight: 600;
    color: #1a1a2e;
    flex: 1;
    font-size: 1.02em;
}

.sws-review-item-qty {
    color: #6b7280;
    margin: 0 24px;
    white-space: nowrap;
}

.sws-review-item-price {
    font-weight: 700;
    color: #0f3443;
    white-space: nowrap;
    font-size: 1.02em;
}

.sws-review-item-remove {
    margin-left: 16px;
    background: none;
    border: none;
    color: #ef4444;
    font-size: 1.2em;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background 0.2s;
    line-height: 1;
}

.sws-review-item-remove:hover {
    background: #fee2e2;
}

.sws-review-delivery-charge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    margin-bottom: 4px;
    font-size: 1.05em;
    color: #374151;
}

.sws-review-delivery-charge .sws-review-label {
    font-weight: 600;
}

.sws-review-delivery-charge .sws-review-value {
    font-weight: 700;
    color: #0f3443;
}

.sws-review-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 22px;
    border-top: 2px solid #0f3443;
    font-size: 1.4em;
}

.sws-review-total-label {
    font-weight: 700;
    color: #1a1a2e;
}

.sws-review-total-value {
    font-weight: 800;
    color: #0f3443;
    font-size: 1.15em;
}

/* --- Buttons --- */
.sws-step-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.sws-btn {
    padding: 16px 32px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1.02em;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.sws-btn-primary {
    background: #0f3443;
    color: #fff;
    border-color: #0f3443;
}

.sws-btn-primary:hover {
    background: #1a4f66;
    border-color: #1a4f66;
    box-shadow: 0 4px 16px rgba(15, 52, 67, 0.3);
}

.sws-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.sws-go-to-review.sws-btn-not-ready {
    opacity: 0.5;
    cursor: pointer;
}

.sws-btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border-color: #e5e7eb;
}

.sws-btn-secondary:hover {
    background: #e5e7eb;
}

.sws-btn-outline {
    background: transparent;
    color: #374151;
    border-color: #d1d5db;
}

.sws-btn-outline:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.sws-btn-large {
    padding: 18px 40px;
    font-size: 1.1em;
}

/* --- Notice --- */
.sws-notice {
    padding: 18px 24px;
    border-radius: 12px;
    border: 1px solid;
    grid-column: 1 / -1;
}

.sws-notice-info {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

/* Large Desktop (1200px+): 4 columns — already default */

/* Medium Desktop / Tablets Landscape (901px-1199px): 3 columns */
@media (max-width: 1199px) {
    .sws-products-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .sws-allergen-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Tablets Portrait (601px-900px): 2 columns */
@media (max-width: 900px) {
    .sws-meal-plan-wrapper {
        padding: 24px 16px;
    }

    .sws-step-panel {
        padding: 32px 28px;
    }

    .sws-header {
        padding: 40px 28px 32px;
    }

    .sws-page-title {
        font-size: 2em;
    }

    .sws-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .sws-allergen-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .sws-step-connector {
        width: 50px;
    }

    .sws-review-section {
        max-width: 100%;
    }
}

/* Mobile (600px and below) */
@media (max-width: 600px) {
    .sws-meal-plan-wrapper {
        padding: 8px 4px;
        width: 100% !important;
    }

    .sws-meal-plan-container {
        border-radius: 10px;
    }

    .sws-step-panel {
        padding: 24px 16px;
    }

    .sws-header {
        padding: 32px 16px 24px;
    }

    .sws-page-title {
        font-size: 1.5em;
    }

    .sws-page-subtitle {
        font-size: 0.95em;
    }

    .sws-title-icon {
        font-size: 1.6em;
    }

    .sws-pet-deco {
        display: none;
    }

    .sws-panel-header h2 {
        font-size: 1.3em;
    }

    .sws-allergen-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .sws-allergen-label {
        padding: 12px 14px;
        font-size: 0.9em;
        gap: 8px;
    }

    .sws-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .sws-product-info {
        padding: 12px;
    }

    .sws-product-title {
        font-size: 0.88em;
    }

    .sws-product-actions {
        padding: 0 12px 12px;
    }

    .sws-add-product-btn {
        padding: 10px 12px;
        font-size: 0.85em;
    }

    .sws-steps-indicator {
        padding: 20px 16px;
    }

    .sws-step-label {
        display: none;
    }

    .sws-step-connector {
        width: 28px;
        margin: 0 8px;
    }

    .sws-step-number {
        width: 34px;
        height: 34px;
    }

    .sws-duration-options {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .sws-duration-card {
        padding: 16px 10px;
    }

    .sws-duration-days {
        font-size: 1.8em;
    }

    .sws-step-actions {
        flex-direction: column;
    }

    .sws-btn {
        width: 100%;
        justify-content: center;
        padding: 14px 24px;
    }

    .sws-review-section {
        padding: 20px 16px;
    }

    .sws-review-item {
        flex-wrap: wrap;
        gap: 4px;
    }

    .sws-review-item-qty {
        margin: 0 12px;
    }

    .sws-review-total {
        font-size: 1.15em;
    }
}

/* Extra small screens */
@media (max-width: 380px) {
    .sws-allergen-grid {
        grid-template-columns: 1fr;
    }

    .sws-products-grid {
        grid-template-columns: 1fr;
    }

    .sws-duration-options {
        grid-template-columns: 1fr;
    }
}