/**
 * QTD ACF Card Grid Widget Styles
 */

/* ==========================================================================
   Grid Wrapper
   ========================================================================== */
.qtd-acf-card-grid-wrapper {
    position: relative;
    width: 100%;
    margin: 0;
    padding: 0;
}

/* ==========================================================================
   Search & Filter Bar
   ========================================================================== */
.qtd-search-filter-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
    background-color: #f8f9fa;
    border-radius: 4px;
}

.qtd-search-wrapper {
    flex: 1 1 300px;
    min-width: 250px;
    position: relative;
}

.qtd-filters-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    flex: 0 1 auto;
}

.qtd-search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    background-color: #ffffff;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.qtd-search-input::placeholder {
    color: #999999;
    opacity: 1;
}

.qtd-search-input:focus {
    outline: none;
    border-color: #C4A77D;
    box-shadow: 0 0 0 3px rgba(196, 167, 125, 0.1);
}

.qtd-filter-wrapper {
    flex: 0 1 auto;
    min-width: 180px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
}

.qtd-custom-filter {
    flex: 0 1 auto;
    min-width: 180px;
}

.qtd-filter-label {
    font-size: 13px;
    font-weight: 600;
    color: #333333;
    margin: 0;
    padding: 0;
    display: block;
    line-height: 1.2;
    white-space: nowrap;
    flex-shrink: 0;
}

.qtd-filter-select {
    width: 100%;
    min-width: 180px;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    background-color: #ffffff;
    cursor: pointer;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.qtd-filter-select:focus {
    outline: none;
    border-color: #C4A77D;
    box-shadow: 0 0 0 3px rgba(196, 167, 125, 0.1);
}

/* ==========================================================================
   Card Grid
   ========================================================================== */
.qtd-card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

/* Loading State */
.qtd-card-grid.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Card Link Wrapper */
.qtd-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.qtd-card-link:hover {
    transform: translateY(-4px);
}

/* Card Container */
.qtd-card {
    background: #ffffff;
    border-radius: 0;
    overflow: visible;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Image Wrapper */
.qtd-card-grid-image-wrapper {
    position: relative;
    width: 100%;
    height: 250px;
    overflow: visible !important;
    background: #f0f0f0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Offset Border Effect */
.qtd-card-grid-image-wrapper {
    position: relative;
}

.qtd-card-grid-image-wrapper::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    width: 100%;
    height: 100%;
    border: 2px solid #000000;
    border-radius: 0;
    z-index: 99;
    pointer-events: none;
    display: none; /* Hidden by default */

    /* Add smooth transition */
    transition: top 0.3s ease, left 0.3s ease, width 0.3s ease, height 0.3s ease;

}

/* Hover effect - border returns to center and expands */
.qtd-card-link:hover .qtd-card-grid-image-wrapper::before {
    top: 10px !important;
    left: 10px !important;
    width: calc(100% + -20px);
    height: calc(100% + -20px);
}

.qtd-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e0e0e0;
    color: #999;
    font-size: 14px;
}

/* Price Badge */
.qtd-price-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #fff;
    color: #333333;
    padding: 6px 12px;
    border-radius: 0;
    font-size: 12px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
}

.qtd-price-value {
    font-weight: 700;
    color: #333333;
}

.qtd-price-text {
    font-weight: 400;
    color: #333333;
}

.qtd-price-currency {
    font-weight: 400;
    color: #333333;
}

/* Card Content */
.qtd-card-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Label (Category/Type) */
.qtd-card-label {
    margin: 0 0 8px 0;
    font-size: 11px;
    color: #C4A77D;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* Title */
.qtd-card-title {
    margin: 0 0 8px 0;
    font-size: 24px;
    font-weight: 400;
    color: #333333;
    line-height: 1.2;
}

/* Subtitle */
.qtd-card-subtitle {
    margin: 0 0 15px 0;
    font-size: 14px;
    color: #666666;
    line-height: 1.5;
    font-weight: 400;
}

/* Counts Section */
.qtd-card-counts {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 15px 0;
    padding: 0;
}

.qtd-count-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #666666;
}

.qtd-count-item i,
.qtd-count-item svg {
    font-size: 16px;
    color: #666666;
}

.qtd-count-value {
    font-weight: 500;
}

.qtd-count-suffix {
    margin-left: 3px;
    font-weight: 400;
    opacity: 0.8;
}

/* Button */
.qtd-details-button {
    display: inline-flex;
    align-items: center;
    margin-top: auto;
    padding: 8px 0;
    color: #000000;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    border: none;
    text-align: left;
    transition: color 0.3s ease;
    align-self: flex-start;
    position: relative;
    cursor: pointer;
}

.qtd-details-button-text {
    text-decoration: underline !important;
    text-underline-offset: 4px;
}

.qtd-details-button-chevron {
    margin-left: 4px;
    font-size: 16px;
    transition: margin-left 0.3s ease;
    text-decoration: none;
}

.qtd-card-link:hover .qtd-details-button {
    color: #A08656;
}

.qtd-card-link:hover .qtd-details-button-chevron {
    margin-left: 8px;
}

/* ==========================================================================
   Pagination
   ========================================================================== */
.qtd-pagination-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 40px;
}

.qtd-pagination {
    display: flex;
    gap: 10px;
    align-items: center;
}

.qtd-pagination-btn {
    min-width: 40px;
    height: 40px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    background-color: #f0f0f0;
    color: #333333;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.qtd-pagination-btn:hover:not(.active):not(.disabled) {
    background-color: #e0e0e0;
    border-color: #ccc;
}

.qtd-pagination-btn.active {
    background-color: #C4A77D;
    border-color: #C4A77D;
    color: #ffffff;
    cursor: default;
}

.qtd-pagination-btn:disabled,
.qtd-pagination-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Previous/Next button styles */
.qtd-pagination-prev,
.qtd-pagination-next {
    min-width: 40px;
    padding: 8px 12px;
    font-weight: 600;
}

.qtd-pagination-arrow {
    font-size: 20px;
    line-height: 1;
    font-weight: bold;
    display: inline-block;
}

/* Number buttons */
.qtd-pagination-number {
    min-width: 40px;
}

/* ==========================================================================
   Loading & Empty States
   ========================================================================== */
.qtd-loading {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.qtd-no-results {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 16px;
    grid-column: 1 / -1;
}

/* Notice Styles */
.qtd-acf-notice {
    padding: 20px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    color: #856404;
    text-align: center;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

/* Tablet (max-width: 1024px) */
@media (max-width: 1024px) {
    .qtd-search-filter-bar {
        gap: 12px;
    }

    .qtd-search-wrapper {
        flex: 1 1 100%;
        max-width: 100%;
        min-width: 100%;
    }

    .qtd-filters-container {
        flex: 1 1 100%;
        width: 100%;
    }

    .qtd-filter-wrapper,
    .qtd-custom-filter {
        flex: 1 1 calc(50% - 6px);
        min-width: calc(50% - 6px);
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .qtd-filter-select {
        width: 100%;
    }

    .qtd-filter-label {
        font-size: 12px;
    }

    .qtd-card-title {
        font-size: 18px;
    }

    .qtd-card-counts {
        gap: 15px;
    }
}

/* Mobile (max-width: 768px) */
@media (max-width: 768px) {
    .qtd-search-filter-bar {
        padding: 15px;
        margin-bottom: 20px;
        gap: 10px;
    }

    .qtd-search-wrapper {
        flex: 1 1 100%;
        min-width: 100%;
        max-width: 100%;
    }

    .qtd-filters-container {
        flex: 1 1 100%;
        width: 100%;
    }

    .qtd-filter-wrapper,
    .qtd-custom-filter {
        flex: 1 1 100%;
        min-width: 100%;
        max-width: 100%;
    }

    .qtd-filter-wrapper,
    .qtd-custom-filter {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .qtd-search-input,
    .qtd-filter-select {
        padding: 10px 12px;
        font-size: 13px;
        min-width: 100%;
    }

    .qtd-filter-label {
        font-size: 12px;
    }

    .qtd-card-grid-image-wrapper {
        height: 180px;
    }

    .qtd-card-content {
        padding: 15px;
    }

    .qtd-card-title {
        font-size: 16px;
    }

    .qtd-card-subtitle {
        font-size: 13px;
    }

    .qtd-card-counts {
        gap: 10px;
        flex-wrap: wrap;
    }

    .qtd-count-item {
        font-size: 13px;
    }

    .qtd-pagination {
        gap: 6px;
        flex-wrap: wrap;
    }

    .qtd-pagination-btn {
        min-width: 36px;
        height: 36px;
        padding: 6px 10px;
        font-size: 13px;
    }

    .qtd-pagination-prev,
    .qtd-pagination-next {
        min-width: 36px;
        padding: 6px 10px;
    }

    .qtd-pagination-arrow {
        font-size: 18px;
    }

    .qtd-details-button {
        width: 100%;
        text-align: center;
    }
}

/* Small Mobile (max-width: 480px) */
@media (max-width: 480px) {
    .qtd-card-grid {
        gap: 15px;
    }

    .qtd-card-grid-image-wrapper {
        height: 160px;
    }

    .qtd-price-badge {
        font-size: 11px;
        padding: 5px 10px;
    }

    .qtd-search-filter-bar {
        padding: 12px;
    }
}

