/**
 * Maxxis MMY Search - Merged Styles
 * Version: 3.0.1 - Modern grid design with Maxxis branding (Patched)
 */

/* ===================================
   CONTAINER & LAYOUT
   =================================== */

.maxxis-mmy-container {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 1rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
}

.maxxis-mmy-main-title {
    text-align: center;
    margin-bottom: 30px;
    font-size: 2em;
    color: #333;
}

/* ===================================
   SEARCH FORM - MULTI-STEP LAYOUT
   =================================== */

.maxxis-mmy-search-form {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
    align-items: end;
    background: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Step 1: Vehicle Type - Full width */
.maxxis-mmy-step-1 {
    grid-column: span 12;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1rem;
}

.maxxis-mmy-vehicle-type-field {
    grid-column: span 12;
    display: flex;
    flex-direction: column;
}

/* Step 2: Make, Model, Year - 3 equal columns in first row */
.maxxis-mmy-step-2 {
    grid-column: span 12;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1rem;
}

.maxxis-mmy-step-2 > .maxxis-mmy-field:nth-child(1),
.maxxis-mmy-step-2 > .maxxis-mmy-field:nth-child(2),
.maxxis-mmy-step-2 > .maxxis-mmy-field:nth-child(3) {
    grid-column: span 4;
}

/* Second row: Product Filter, Grade, Reset - equal columns */
.maxxis-mmy-step-2 .maxxis-mmy-category-field {
    grid-column: span 5;
}

.maxxis-mmy-step-2 .maxxis-mmy-grade-field {
    grid-column: span 5;
}

.maxxis-mmy-step-2 .maxxis-mmy-reset-field {
    grid-column: span 2;
}

.maxxis-mmy-field {
    display: flex;
    flex-direction: column;
}

.maxxis-mmy-search-form label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
    text-transform: capitalize;
}

.maxxis-mmy-search-form select {
    width: 100%;
    padding: 0.5rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #1f2937;
    background-color: #f9fafb;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    transition: all 0.2s 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='%23374151' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
    padding-right: 2.5rem;
    cursor: pointer;
}

.maxxis-mmy-search-form select:hover:not(:disabled) {
    background-color: #ffffff;
    border-color: #9ca3af;
}

.maxxis-mmy-search-form select:focus {
    outline: none;
    background-color: #ffffff;
    border-color: #e31e24;
    box-shadow: 0 0 0 3px rgba(227, 30, 36, 0.1);
}

.maxxis-mmy-search-form select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #f3f4f6;
}

/* Second row fields - HIDDEN BY DEFAULT */
.maxxis-mmy-category-field,
.maxxis-mmy-grade-field,
.maxxis-mmy-reset-field {
    display: none !important;
}

/* SHOW second row when results are displayed */
.maxxis-mmy-container.has-results .maxxis-mmy-category-field,
.maxxis-mmy-container.has-results .maxxis-mmy-grade-field,
.maxxis-mmy-container.has-results .maxxis-mmy-reset-field {
    display: flex !important;
}

.maxxis-mmy-reset {
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    background-color: transparent;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.maxxis-mmy-reset:hover {
    background-color: #f9fafb;
    border-color: #9ca3af;
    color: #374151;
}

/* ===================================
   PRODUCT GRID
   =================================== */

/* Recommended Tyre Sizes */
.maxxis-recommended-sizes {
    background: #ffffff;
    border: 0px solid #000;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    text-align: center;
}

.recommended-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #000;
    margin: 0 0 0 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.recommended-sizes-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 3rem;
    flex-wrap: wrap;
}

.recommended-size-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.size-label {
    font-size: 1.5rem;
    font-weight: 700;
    color: #000;
    text-transform: uppercase;
}

.size-value {
    font-size: 2.5rem;
    font-weight: 900;
    color: #FF5400;
    text-transform: uppercase;
}

.maxxis-mmy-results.maxxis-mmy-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.maxxis-mmy-results.maxxis-mmy-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

/* ===================================
   PRODUCT CARD - MAXXIS ENHANCED
   =================================== */

.maxxis-mmy-item {
    background: #ffffff;
    border: 3px solid #ffffff;
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

.maxxis-mmy-item:hover {
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(-5px);
}

/* ===================================
   IMAGE CONTAINER WITH TERRAIN BADGE
   =================================== */

.maxxis-mmy-image-container {
    position: relative;
    aspect-ratio: 1 / 1;
    background-color: #ffffff;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.maxxis-mmy-image-container a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    transition: opacity 0.3s ease;
}

.maxxis-mmy-image-container a:hover {
    opacity: 0.85;
}

.maxxis-mmy-image-container img,
.maxxis-mmy-single-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.maxxis-mmy-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #9ca3af;
    font-size: 0.875rem;
}

/* Terrain Badge - Top Right Corner */
.maxxis-mmy-terrain-badge {
    position: absolute;
    top: 0;
    right: 0;
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: #ffffff;
    background-color: #ff5400;
    border-bottom-left-radius: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ===================================
   PRODUCT CONTENT
   =================================== */

.maxxis-mmy-content {
    padding-bottom: 1rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* Product Title */
.maxxis-mmy-title {
    font-size: 2em;
    font-weight: 900;
    color: #FF5400;
    line-height: 1;
    margin: 0;
    padding: 0rem 1.25rem 0.5rem;
    text-align: left;
    text-transform: uppercase;
}

/* Product Description */
.maxxis-mmy-description {
    font-size: 0.8em;
    color: #9b9a9a;
    line-height: 1.2;
    margin: 0;
    padding: 0 1.25rem 0rem;
    text-align: left;
}

/* ===================================
   TERRAIN RATINGS WITH STARS
   =================================== */

.maxxis-mmy-terrain-ratings {
    padding: 0 1.25rem;
    margin: 0.5rem 0 0 0;
}

.maxxis-rating-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0px;
    font-size: 0.7em;
}

.rating-label {
    font-size: 1em;
    color: #9b9a9a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.rating-stars {
    display: flex;
    gap: 2px;
}

.rating-stars .star {
    font-size: 1.4em;
    line-height: 1;
}

.rating-stars .star.filled {
    color: #ff4500;
}

.rating-stars .star.empty {
    color: #d0d0d0;
}

/* ===================================
   FITMENT SECTION (Front/Rear)
   =================================== */

.maxxis-mmy-fitments {
    padding: 1rem;
    margin-top: auto;
    border-top: 2px solid #e0e0e0;
    padding-top: 15px;
}

/* Two-column container for front and rear */
.maxxis-fitments-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

/* Individual column styling */
.maxxis-fitment-column {
    display: flex;
    flex-direction: column;
    gap: 0rem;
}

/* Column headers (FRONT: / REAR:) */
.fitment-column-header {
    font-weight: 700;
    color: #000;
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
}

/* Individual tire item row */
.maxxis-fitment-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0 0 0;
}

/* Tire size links */
.fitment-size-link {
    color: #FF5400;
    text-decoration: none;
    font-weight: 700;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
    font-size: 0.8em;
}

.fitment-size-link:hover {
    color: #e31e24;
    border-bottom: 2px solid #FF5400;
}

/* Price styling */
.fitment-price {
    font-weight: 500;
    color: #000;
    font-size: 0.8em;
    white-space: nowrap;
}

/* Legacy support for old class name */
.fitment-part-link {
    color: #FF5400;
    text-decoration: none;
    font-weight: 700;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
}

.fitment-part-link:hover {
    color: #e31e24;
    border-bottom: 2px solid #FF5400;
}

.maxxis-fitment-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 1rem;
}

.maxxis-fitment-row:last-child {
    margin-bottom: 0;
}

.fitment-label {
    font-weight: 700;
    color: #000;
    font-size: 1.2em;
}

/* ===================================
   FOOTER WITH PART NUMBER
   =================================== */

.maxxis-mmy-footer {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    margin-top: auto;
    padding: 1.25rem;
    border-top: 3px solid #000;
}

.maxxis-mmy-part {
    font-size: 0.875rem;
    color: #666;
    margin: 0;
    font-weight: 400;
}

.maxxis-mmy-part strong {
    font-weight: 600;
    color: #000;
}

.maxxis-mmy-part a {
    color: #e31e24;
    text-decoration: none;
    font-weight: 600;
}

.maxxis-mmy-part a:hover {
    text-decoration: underline;
}

/* ===================================
   IMAGE SLIDER
   =================================== */

.maxxis-mmy-slider {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: #f8f8f8;
}

.maxxis-mmy-slider-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.maxxis-mmy-slider-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.maxxis-mmy-slider-image.active {
    opacity: 1;
    pointer-events: auto;
    z-index: 1;
}

.maxxis-mmy-slider-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.maxxis-mmy-slider-prev,
.maxxis-mmy-slider-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0;
    z-index: 2;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-size: 1.25rem;
    color: #111827;
    font-weight: bold;
}

.maxxis-mmy-slider-prev {
    left: 0.5rem;
}

.maxxis-mmy-slider-next {
    right: 0.5rem;
}

.maxxis-mmy-image-container:hover .maxxis-mmy-slider-prev,
.maxxis-mmy-image-container:hover .maxxis-mmy-slider-next {
    opacity: 1;
}

.maxxis-mmy-slider-prev:hover,
.maxxis-mmy-slider-next:hover {
    background: #ffffff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.maxxis-mmy-slider-dots {
    position: absolute;
    bottom: 0.75rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.375rem;
    z-index: 2;
}

.maxxis-mmy-slider-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.maxxis-mmy-slider-dot.active {
    background: rgba(255, 255, 255, 0.95);
    width: 1.5rem;
    border-radius: 0.25rem;
}

/* ===================================
   LOADING & EMPTY STATES
   =================================== */

.maxxis-mmy-loading {
    text-align: center;
    padding: 3rem 1rem;
    color: #6b7280;
    position: relative;
}

.maxxis-mmy-loading span {
    display: block;
    margin-bottom: 1.5rem;
    font-size: 1.125rem;
    font-weight: 500;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Animated progress bar container */
.maxxis-mmy-loading::after {
    content: '';
    display: block;
    width: 100%;
    max-width: 600px;
    height: 3rem;
    margin: 0 auto;
    background-color: #1f2937;
    border: 3px solid #FF5400;
    border-radius: 0.75rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(255, 84, 0, 0.3);
    background-image: repeating-linear-gradient(
        45deg,
        #FF5400 0,
        #FF5400 30px,
        #FF7A33 30px,
        #FF7A33 60px
    );
    background-size: 84.85px 84.85px;
    animation: maxxis-loading-stripes 1.5s linear infinite;
}

/* Animated stripes - using a wrapper approach */
@keyframes maxxis-loading-stripes {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 60px 0;
    }
}

.maxxis-mmy-no-results {
    text-align: center;
    padding: 3rem 1rem;
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    color: #6b7280;
}

.maxxis-mmy-no-results h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
    margin: 0 0 0.5rem 0;
}

.maxxis-mmy-no-results p {
    font-size: 0.875rem;
    margin: 0;
}

.maxxis-mmy-error {
    padding: 1rem;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 0.5rem;
    color: #991b1b;
    font-size: 0.875rem;
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */

/* Tablet */
@media (max-width: 1024px) {
    .maxxis-mmy-results.maxxis-mmy-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }
    
    .maxxis-mmy-step-2 .maxxis-mmy-category-field,
    .maxxis-mmy-step-2 .maxxis-mmy-grade-field {
        grid-column: span 5;
    }
    
    .maxxis-mmy-step-2 .maxxis-mmy-reset-field {
        grid-column: span 2;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .maxxis-mmy-container {
        padding: 0 0.75rem;
    }
    
    .maxxis-mmy-search-form {
        padding: 1rem;
    }
    
    /* Step 1: Full width on mobile */
    .maxxis-mmy-step-1 {
        grid-template-columns: 1fr;
    }
    
    .maxxis-mmy-vehicle-type-field {
        grid-column: span 1 !important;
    }
    
    /* Step 2: Stack all fields on mobile */
    .maxxis-mmy-step-2 {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .maxxis-mmy-step-2 > .maxxis-mmy-field:nth-child(1),
    .maxxis-mmy-step-2 > .maxxis-mmy-field:nth-child(2),
    .maxxis-mmy-step-2 > .maxxis-mmy-field:nth-child(3),
    .maxxis-mmy-step-2 .maxxis-mmy-category-field,
    .maxxis-mmy-step-2 .maxxis-mmy-grade-field,
    .maxxis-mmy-step-2 .maxxis-mmy-reset-field {
        grid-column: span 1 !important;
    }
    
    .maxxis-mmy-search-form select {
        font-size: 16px;
    }
    
    /* Recommended sizes mobile */
    .maxxis-recommended-sizes {
        padding: 1.5rem 1rem;
    }
    
    .recommended-title {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }
    
    .recommended-sizes-row {
        flex-direction: column;
        gap: 0;
    }
    
    .recommended-size-item {
        flex-direction: column;
        gap: 0;
    }
    
    .size-label {
        font-size: 1.25rem;
    }
    
    .size-value {
        font-size: 2rem;
    }
    
    .maxxis-mmy-results.maxxis-mmy-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }
    
    .maxxis-mmy-title {
        font-size: 2em;
    }
    
    .maxxis-mmy-image-container .maxxis-mmy-slider-prev,
    .maxxis-mmy-image-container .maxxis-mmy-slider-next {
        opacity: 0.7;
    }
    
    .maxxis-mmy-slider-prev,
    .maxxis-mmy-slider-next {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1.5rem;
    }
    
    /* Stack fitment columns on mobile */
    .maxxis-fitments-columns {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .maxxis-fitment-column {
        padding-bottom: 0.5rem;
    }
    
    .maxxis-fitment-column:first-child {
        border-bottom: 1px solid #e0e0e0;
        padding-bottom: 1rem;
        margin-bottom: 0rem;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .maxxis-mmy-main-title {
        font-size: 1.5em;
    }
    
    .maxxis-mmy-title {
        font-size: 2.3em;
    }
}

/* ===================================
   UTILITIES
   =================================== */

.maxxis-mmy-hidden {
    display: none !important;
}