/**
 * RDS Loop Card Redesign
 * Version: 1.2.0
 * Scoped to .elementor-loop-container — safe to load on all pages
 *
 * Layout: 3-col desktop, 2-col tablet, 1-col mobile
 * Equal height cards with bottom-aligned buttons
 * SOLD ribbon overlay for out-of-stock items
 */

/* ============================
   1. GRID LAYOUT — Equal Heights
   ============================ */

.elementor-loop-container {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    align-items: stretch;
}

/* Each grid cell stretches to full height */
.elementor-loop-container > div {
    display: flex !important;
    flex-direction: column;
    height: 100%;
}

/* Card container — flex column, push buttons to bottom */
.elementor-loop-container .e-con {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    min-height: auto !important; /* Override Elementor's 94vh */
    position: relative;
    isolation: isolate; /* Create stacking context — keeps ribbon below sticky menu */
    overflow: hidden; /* Contain the SOLD ribbon */
    border-radius: 20px;
    box-shadow: -10px -3px 36px -6px rgba(0, 0, 0, 0.09);
    padding-bottom: 16px;
}

/* ============================
   2. IMAGE — Consistent Height
   ============================ */

.elementor-loop-container .elementor-widget-theme-post-featured-image img {
    height: 280px !important;
    width: 100% !important;
    object-fit: contain;
    object-position: center center;
}

/* ============================
   3. TITLE — Clamp to 2 Lines
   ============================ */

.elementor-loop-container .elementor-widget-heading .elementor-heading-title {
    font-size: 22px !important;
    font-weight: 300;
    line-height: 1.3;
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 57px; /* Reserve 2 lines */
    padding: 0 8px;
}

/* ============================
   4. PRICE — Consistent Display
   ============================ */

.elementor-loop-container .elementor-widget-wc-price .price {
    font-size: 24px !important;
    font-weight: 600;
    text-align: center;
    margin: 4px 0;
}

.rds-from-price {
    font-size: 15px;
    font-weight: 400;
    color: #888;
}

/* ============================
   4b. PRODUCT DIMENSIONS — Centered Under Title
   ============================ */

.rds-product-dimensions {
    font-size: 13px;
    line-height: 1.4;
    color: #888;
    text-align: center;
    margin: 0 0 4px;
    padding: 0 12px;
    letter-spacing: 0.3px;
}

/* ============================
   5. DESCRIPTION — Fixed Height
   ============================ */

.rds-card-description {
    font-size: 14px;
    line-height: 1.5;
    color: #666;
    min-height: 63px; /* 3 lines */
    max-height: 63px;
    overflow: hidden;
    text-align: center;
    padding: 0 12px;
    margin: 4px 0 8px;
}

/* ============================
   6. BUTTONS — Bottom Aligned
   ============================ */

/* Remove any absolute positioning hacks */
.elementor-loop-container .elementor-widget-button,
.elementor-loop-container .elementor-widget-wc-add-to-cart {
    position: static !important;
    transform: none !important;
    left: auto !important;
    bottom: auto !important;
}

/* Push the View Artwork button to bottom via flex spacer —
   This ensures horizontal alignment across all cards,
   whether they have a cart button (in-stock) or not (SOLD). */
.elementor-loop-container .elementor-widget-button {
    margin-top: auto;
}

/* "Select Options" / "Add to Cart" — outlined style */
.elementor-loop-container .elementor-widget-wc-add-to-cart a.button,
.elementor-loop-container .elementor-widget-wc-add-to-cart .button {
    background-color: transparent !important;
    color: #6EC1E4 !important;
    border: 2px solid #6EC1E4 !important;
    border-radius: 6px;
    padding: 8px 20px !important;
    font-size: 14px !important;
    font-weight: 500;
    width: 80%;
    max-width: 200px;
    margin: 0 auto 8px !important;
    display: block !important;
    text-align: center !important;
    text-decoration: none;
    transition: all 0.2s ease;
}

.elementor-loop-container .elementor-widget-wc-add-to-cart a.button:hover,
.elementor-loop-container .elementor-widget-wc-add-to-cart .button:hover {
    background-color: #6EC1E4 !important;
    color: #fff !important;
}

/* "View Artwork" button — solid primary style */
.elementor-loop-container .elementor-widget-button .elementor-button {
    background-color: #6EC1E4 !important;
    color: #fff !important;
    border-radius: 6px !important;
    padding: 10px 24px !important;
    font-size: 15px !important;
    font-weight: 500;
    width: 80%;
    max-width: 200px;
    margin: 0 auto 12px !important;
    display: block !important;
    text-align: center !important;
    text-decoration: none;
    transition: all 0.2s ease;
}

.elementor-loop-container .elementor-widget-button .elementor-button:hover {
    background-color: #4054B2 !important;
}

/* ============================
   7. SOLD RIBBON — Diagonal Overlay
   ============================ */

/* Allow ribbon to escape shortcode widget and position relative to card */
.elementor-loop-container .elementor-widget-shortcode,
.elementor-loop-container .elementor-widget-shortcode .elementor-widget-container {
    position: static !important;
    overflow: visible !important;
}

.rds-sold-ribbon {
    position: absolute;
    top: 22px;
    right: -32px;
    z-index: 10;
    transform: rotate(45deg);
    background: #c0392b;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    padding: 6px 40px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    pointer-events: none;
}

/* ============================
   8. SOLD BADGE — Replacing Price
   ============================ */

.rds-sold-badge {
    display: inline-block;
    background: #c0392b;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    padding: 4px 16px;
    border-radius: 4px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* ============================
   8b. RECENTLY SOLD BADGE — Urgency/FOMO
   ============================ */

.rds-recently-sold-badge {
    display: inline-block;
    background: #e67e22;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    padding: 4px 14px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    animation: rds-pulse-badge 2s ease-in-out infinite;
}

@keyframes rds-pulse-badge {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* Recently Sold ribbon variant — warm amber */
.rds-sold-ribbon.rds-recently-sold {
    background: #e67e22;
}

/* ============================
   9. EXPLORE SIMILAR WORKS — SOLD CTA
   ============================ */

.rds-explore-btn {
    background-color: transparent !important;
    color: #999 !important;
    border: 2px solid #ccc !important;
    border-radius: 6px;
    padding: 8px 20px !important;
    font-size: 13px !important;
    font-weight: 500;
    width: 80%;
    max-width: 200px;
    margin: 0 auto 8px !important;
    display: block !important;
    text-align: center !important;
    text-decoration: none;
    transition: all 0.2s ease;
}

.rds-explore-btn:hover {
    background-color: #6EC1E4 !important;
    color: #fff !important;
    border-color: #6EC1E4 !important;
}

/* ============================
   10. QUANTITY INPUT — Hide in Loop
   ============================ */

.elementor-loop-container .quantity {
    display: none !important;
}

/* ============================
   11. TABLET — 2 Columns
   ============================ */

@media (max-width: 1024px) {
    .elementor-loop-container {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px;
    }

    .elementor-loop-container .elementor-widget-theme-post-featured-image img {
        height: 240px !important;
    }

    .elementor-loop-container .elementor-widget-heading .elementor-heading-title {
        font-size: 20px !important;
    }

    /* SOLD ribbon — tighter positioning for narrower tablet cards */
    .rds-sold-ribbon {
        top: 18px;
        right: -28px;
        padding: 5px 34px;
        font-size: 12px;
    }
}

/* ============================
   12. MOBILE — 1 Column
   ============================ */

@media (max-width: 767px) {
    .elementor-loop-container {
        grid-template-columns: 1fr !important;
        gap: 16px;
        max-width: 400px;
        margin: 0 auto;
    }

    .elementor-loop-container .e-con {
        min-height: auto !important;
    }

    .elementor-loop-container .elementor-widget-theme-post-featured-image img {
        height: 300px !important;
    }

    .elementor-loop-container .elementor-widget-heading .elementor-heading-title {
        font-size: 20px !important;
        min-height: auto;
    }

    .rds-card-description {
        min-height: auto;
        max-height: none;
    }

    .elementor-loop-container .elementor-widget-wc-add-to-cart a.button,
    .elementor-loop-container .elementor-widget-wc-add-to-cart .button,
    .elementor-loop-container .elementor-widget-button .elementor-button {
        width: 90%;
        max-width: none;
    }

    /* SOLD badge — larger and more prominent on mobile */
    .rds-sold-badge {
        font-size: 18px;
        padding: 6px 24px;
        letter-spacing: 2px;
    }

    .rds-recently-sold-badge {
        font-size: 16px;
        padding: 6px 20px;
    }

    /* SOLD ribbon — full-width banner on mobile (diagonal clips on narrow cards) */
    .rds-sold-ribbon {
        top: 0;
        right: 0;
        transform: none;
        width: 100%;
        text-align: center;
        border-radius: 20px 20px 0 0;
        padding: 8px 0;
        font-size: 14px;
        letter-spacing: 3px;
    }
}

/* ============================
   13. SIMILAR WORKS PAGE
   ============================ */

.rds-similar-works {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

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

.rds-sw-header h2 {
    font-size: 32px;
    font-weight: 300;
    color: #282A2C;
    margin-bottom: 8px;
}

.rds-sw-subtitle {
    font-size: 16px;
    color: #666;
    margin: 0;
}

/* Product grid */
.rds-sw-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 60px;
}

.rds-sw-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rds-sw-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.rds-sw-card-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.rds-sw-card-image img {
    width: 100%;
    height: 260px;
    object-fit: contain;
    object-position: center;
    background: #fafafa;
}

.rds-sw-card-title {
    font-size: 18px;
    font-weight: 400;
    color: #282A2C;
    text-align: center;
    padding: 12px 12px 4px;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 52px;
}

.rds-sw-card-price {
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    color: #282A2C;
    padding: 4px 12px 12px;
}

.rds-sw-btn {
    background-color: transparent !important;
    color: #6EC1E4 !important;
    border: 2px solid #6EC1E4 !important;
    border-radius: 6px;
    padding: 10px 20px !important;
    font-size: 14px !important;
    font-weight: 500;
    width: 80%;
    max-width: 200px;
    margin: 0 auto 16px !important;
    display: block !important;
    text-align: center !important;
    text-decoration: none;
    transition: all 0.2s ease;
}

.rds-sw-btn:hover {
    background-color: #6EC1E4 !important;
    color: #fff !important;
}

.rds-sw-empty {
    text-align: center;
    font-size: 16px;
    color: #666;
    padding: 40px 20px;
    margin-bottom: 20px;
}

/* Commission CTA section */
.rds-sw-commission {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 20px;
    padding: 48px 40px;
    text-align: center;
    margin-top: 40px;
}

.rds-sw-commission h2 {
    font-size: 28px;
    font-weight: 300;
    color: #282A2C;
    margin-bottom: 12px;
}

.rds-sw-commission-intro {
    font-size: 16px;
    color: #555;
    max-width: 600px;
    margin: 0 auto 32px;
}

.rds-sw-commission-steps {
    display: flex;
    gap: 24px;
    justify-content: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.rds-sw-step {
    background: #fff;
    border-radius: 12px;
    padding: 24px 20px;
    flex: 1;
    min-width: 200px;
    max-width: 280px;
    text-align: left;
    font-size: 14px;
    color: #555;
    line-height: 1.5;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.rds-sw-step strong {
    display: block;
    margin-bottom: 4px;
    color: #282A2C;
}

.rds-sw-step-num {
    display: inline-block;
    width: 28px;
    height: 28px;
    background: #6EC1E4;
    color: #fff;
    border-radius: 50%;
    text-align: center;
    line-height: 28px;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 8px;
}

/* Pricing table */
.rds-sw-commission-pricing {
    margin: 24px auto;
    max-width: 400px;
}

.rds-sw-commission-pricing h3 {
    font-size: 20px;
    font-weight: 400;
    color: #282A2C;
    margin-bottom: 12px;
}

.rds-sw-pricing-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.04);
}

.rds-sw-pricing-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 15px;
    color: #444;
}

.rds-sw-pricing-table tr:last-child td {
    border-bottom: none;
}

.rds-sw-pricing-table td:last-child {
    text-align: right;
    color: #282A2C;
}

/* Commission CTA button */
.rds-sw-commission-cta {
    margin-top: 28px;
}

.rds-sw-commission-btn {
    background-color: #6EC1E4 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 8px;
    padding: 14px 36px !important;
    font-size: 16px !important;
    font-weight: 600;
    display: inline-block !important;
    text-decoration: none;
    transition: all 0.2s ease;
    letter-spacing: 0.5px;
}

.rds-sw-commission-btn:hover {
    background-color: #4054B2 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(64, 84, 178, 0.3);
}

/* Tablet */
@media (max-width: 1024px) {
    .rds-sw-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

/* Mobile */
@media (max-width: 767px) {
    .rds-similar-works {
        padding: 12px;
    }

    .rds-sw-header h2 {
        font-size: 24px;
    }

    .rds-sw-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        max-width: 400px;
        margin: 0 auto 40px;
    }

    .rds-sw-commission {
        padding: 32px 20px;
    }

    .rds-sw-commission h2 {
        font-size: 22px;
    }

    .rds-sw-commission-steps {
        flex-direction: column;
        align-items: center;
    }

    .rds-sw-step {
        max-width: 100%;
    }
}

/* ============================
   14. COMMISSION REQUEST FORM
   ============================ */

.rds-commission-form {
    max-width: 640px;
    margin: 40px auto 0;
}

/* Honeypot — invisible to humans */
.rds-cf-hp {
    position: absolute;
    left: -9999px;
    top: -9999px;
    opacity: 0;
    height: 0;
    width: 0;
    overflow: hidden;
}

.rds-cf {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.rds-cf-field label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #282A2C;
    margin-bottom: 6px;
}

.rds-cf-req {
    color: #c0392b;
}

.rds-cf-opt {
    font-weight: 400;
    color: #999;
    font-size: 13px;
}

.rds-cf-field input[type="text"],
.rds-cf-field input[type="email"],
.rds-cf-field input[type="tel"],
.rds-cf-field select,
.rds-cf-field textarea {
    width: 100%;
    padding: 12px 14px;
    font-size: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fafafa;
    color: #333;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-family: inherit;
    box-sizing: border-box;
}

.rds-cf-field input:focus,
.rds-cf-field select:focus,
.rds-cf-field textarea:focus {
    outline: none;
    border-color: #6EC1E4;
    box-shadow: 0 0 0 3px rgba(110, 193, 228, 0.15);
    background: #fff;
}

.rds-cf-field textarea {
    resize: vertical;
    min-height: 120px;
}

.rds-cf-field select {
    cursor: pointer;
    appearance: auto;
}

.rds-cf-checkbox label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-weight: 400;
    font-size: 14px;
    color: #555;
    line-height: 1.5;
    cursor: pointer;
}

.rds-cf-checkbox input[type="checkbox"] {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.rds-cf-submit-wrap {
    text-align: center;
    margin-top: 8px;
}

.rds-cf-submit {
    background: #6EC1E4;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 14px 40px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.5px;
}

.rds-cf-submit:hover {
    background: #4054B2;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(64, 84, 178, 0.3);
}

/* Error messages */
.rds-cf-errors {
    background: #fdf2f2;
    border: 1px solid #e8c4c4;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 8px;
}

.rds-cf-errors p {
    color: #c0392b;
    font-size: 14px;
    margin: 4px 0;
}

/* Success message */
.rds-cf-success {
    background: #f0faf0;
    border: 1px solid #b8e0b8;
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    margin: 40px auto;
    max-width: 640px;
}

.rds-cf-success h3 {
    color: #2d7d2d;
    font-size: 24px;
    font-weight: 400;
    margin-bottom: 12px;
}

.rds-cf-success p {
    color: #555;
    font-size: 15px;
    line-height: 1.6;
    margin: 8px 0;
}

.rds-cf-success a {
    color: #6EC1E4;
    font-weight: 600;
}

/* Mobile */
@media (max-width: 767px) {
    .rds-commission-form {
        margin: 24px 12px 0;
    }

    .rds-cf-submit {
        width: 100%;
    }
}

/* ============================
   15. CATEGORY FILTER BAR
   ============================ */

.rds-filter-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 16px 20px;
    margin: 0 auto 24px;
    max-width: 1200px;
    background: #f8f9fa;
    border-radius: 12px;
}

.rds-fb-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 500;
    color: #555;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: inherit;
    line-height: 1.4;
}

.rds-fb-item:hover {
    color: #fff;
    background: #6EC1E4;
    border-color: #6EC1E4;
}

.rds-fb-item.rds-fb-active {
    color: #fff;
    background: #000;
    border-color: #000;
}

.rds-fb-arrow {
    font-size: 10px;
    transition: transform 0.2s ease;
}

/* Dropdown container */
.rds-fb-dropdown {
    position: relative;
}

.rds-fb-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 8px 0;
    min-width: 200px;
    z-index: 100;
}

.rds-fb-dropdown.rds-fb-open .rds-fb-menu {
    display: block;
}

.rds-fb-dropdown.rds-fb-open .rds-fb-arrow {
    transform: rotate(180deg);
}

.rds-fb-menu-item {
    display: block;
    padding: 10px 20px;
    font-size: 14px;
    color: #555;
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.rds-fb-menu-item:hover {
    background: #f0f7fc;
    color: #6EC1E4;
}

.rds-fb-menu-item.rds-fb-active {
    color: #000;
    font-weight: 600;
    background: #f0f0f0;
}

/* Tablet */
@media (max-width: 1024px) {
    .rds-filter-bar {
        gap: 4px;
        padding: 12px 16px;
    }

    .rds-fb-item {
        padding: 6px 14px;
        font-size: 13px;
    }
}

/* Mobile */
@media (max-width: 767px) {
    .rds-filter-bar {
        gap: 4px;
        padding: 10px 12px;
        border-radius: 8px;
        margin-bottom: 16px;
    }

    .rds-fb-item {
        padding: 6px 12px;
        font-size: 12px;
        border-radius: 20px;
    }

    .rds-fb-menu {
        left: 0;
        transform: none;
        min-width: 180px;
    }
}
