/**
 * MMY Search Pro - Enhanced Styles
 * Version: 3.2 - Fixed Mobile Layout
 */

.mmy-pro-container {
    width: 100%;
    margin: 0 auto;
}

.mmy-pro-search-form {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.5rem;
    width: 100%;
    margin-bottom: 0.75rem;
}

.mmy-pro-search-form select {
    flex: 1 1 100%;
    min-width: 150px;
    padding: 1rem;
    font-size: 1rem;
    border-radius: 5px;
    border: 1px solid #ccc;
    background-color: #fff;
    height: 60px;
    transition: border-color 0.3s ease;
    font-family: inherit;
    color: inherit;
}

.mmy-pro-search-form select:hover:not(:disabled) {
    border-color: #999;
}

.mmy-pro-search-form select:focus {
    outline: none;
    border-color: currentColor;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

.mmy-pro-search-form select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #f5f5f5;
}

.mmy-pro-reset {
	text-align: center;
	vertical-align: middle;
    font-size: 1rem;
    background-color: #27348e;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-family: inherit;
    height: 60px;
}

.mmy-pro-reset:hover {
    background-color: #0D0054;
}

.mmy-pro-loading {
    text-align: center;
    padding: 2rem;
    font-size: 1rem;
    color: inherit;
}

.mmy-pro-loading:before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-right: 10px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid currentColor;
    border-radius: 50%;
    animation: mmy-pro-spin 1s linear infinite;
}

@keyframes mmy-pro-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Desktop Grid */
.mmy-pro-results.mmy-pro-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    width: 100%;
}

.mmy-pro-results.mmy-pro-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

.mmy-pro-grid .mmy-pro-item {
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    padding: 1rem;
    text-align: center;
    font-family: inherit;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.mmy-pro-grid .mmy-pro-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.mmy-pro-grid .mmy-pro-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    margin-bottom: 1rem;
    border-radius: 4px;
    background-color: #fafafa;
}

.mmy-pro-list .mmy-pro-item {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: row;
    padding: 1rem;
    gap: 1rem;
    transition: box-shadow 0.3s ease;
}

.mmy-pro-list .mmy-pro-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.mmy-pro-list .mmy-pro-item-image {
    flex: 0 0 150px;
}

.mmy-pro-list .mmy-pro-item-image img {
    width: 100%;
    height: 250px;
    object-fit: contain;
    border-radius: 4px;
    background-color: #fafafa;
}

.mmy-pro-list .mmy-pro-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.mmy-pro-list .mmy-pro-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.mmy-pro-list .mmy-pro-details span {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background-color: #f5f5f5;
    border-radius: 3px;
    font-size: 0.85rem;
}

.mmy-pro-title {
    font-weight: bold;
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: inherit;
    line-height: 1.3;
}

.mmy-pro-part {
    text-align: center;
    color: #0D0054;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.mmy-pro-part a {
    color: inherit;
    text-decoration: underline;
    font-weight: 500;
}

.mmy-pro-part a:hover {
    text-decoration: none;
}

.mmy-pro-divider {
    border-top: 1px solid #eaeaea;
    width: 100%;
    margin: 0.5rem 0;
}

.mmy-pro-price {
    text-align: center;
	font-size: 1rem;
    font-weight: 600;
    color: inherit;
}

.mmy-pro-category {
    color: #666;
    font-size: 0.85rem;
}

.mmy-pro-download-wrapper {
    text-align: center;
    margin: 1.5rem 0;
}

.mmy-pro-download-pdf {
    background-color: #333;
    color: white;
    padding: 0.6rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    font-family: inherit;
}

.mmy-pro-download-pdf:hover:not(:disabled) {
    background-color: #555;
    transform: translateY(-2px);
}

.mmy-pro-download-pdf:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.mmy-pro-no-results {
    text-align: center;
    padding: 2rem 1rem;
    color: inherit;
    font-size: 1rem;
    background-color: #f9f9f9;
    border-radius: 8px;
}

.mmy-pro-error {
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 5px;
    padding: 1rem;
    margin: 1rem 0;
    color: #856404;
}

/* Tablet Responsive */
@media (max-width: 1024px) {
    .mmy-pro-results.mmy-pro-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem;
    }
}

/* CRITICAL MOBILE FIX - Force single column */
@media (max-width: 768px) {
    .mmy-pro-search-form {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .mmy-pro-search-form select {
        width: 100%;
        font-size: 16px; /* Prevents zoom on iOS */
        height: 40px;
        padding: 0.5rem;
    }
    
    .mmy-pro-reset {
        width: 100%;
        height: 40px;
        font-size: 0.9rem;
    }
    
    /* FORCE SINGLE COLUMN ON MOBILE */
    .mmy-pro-results.mmy-pro-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    /* Override any column settings */
    .mmy-pro-results.mmy-pro-grid[data-columns] {
        grid-template-columns: 1fr !important;
    }
    
    .mmy-pro-grid .mmy-pro-item {
        padding: 0.75rem;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .mmy-pro-grid .mmy-pro-item img {
        height: 250px;
        margin-bottom: 0.75rem;
    }
    
    .mmy-pro-title {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    
    .mmy-pro-part,
    .mmy-pro-price {
        font-size: 0.85rem;
    }
    
    .mmy-pro-download-pdf {
        width: 100%;
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    .mmy-pro-list .mmy-pro-item {
        flex-direction: column;
        padding: 0.75rem;
    }
    
    .mmy-pro-list .mmy-pro-item-image {
        flex: 0 0 auto;
        width: 100%;
    }
    
    .mmy-pro-list .mmy-pro-item-image img {
        height: 200px;
        width: 100%;
    }
}

/* Small Mobile - Extra Force */
@media (max-width: 480px) {
    .mmy-pro-container {
        padding: 0;
    }
    
    /* Double force single column */
    .mmy-pro-results.mmy-pro-grid,
    .mmy-pro-results[class*="mmy-pro-"] {
        display: block !important;
    }
    
    .mmy-pro-results.mmy-pro-grid .mmy-pro-item {
        display: block !important;
        margin-bottom: 1rem !important;
        width: 100% !important;
    }
    
    .mmy-pro-search-form select,
    .mmy-pro-reset {
        height: 38px;
        font-size: 14px;
    }
    
    .mmy-pro-grid .mmy-pro-item {
        border-radius: 6px;
    }
    
    .mmy-pro-grid .mmy-pro-item img {
        height:200px;
    }
    
    .mmy-pro-download-wrapper {
        margin: 1rem 0;
    }
}

/* Print Styles */
@media print {
    .mmy-pro-search-form,
    .mmy-pro-download-wrapper,
    .mmy-pro-reset {
        display: none !important;
    }
    
    .mmy-pro-results.mmy-pro-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .mmy-pro-item {
        break-inside: avoid;
    }
}

/* Accessibility */
.mmy-pro-search-form select:focus-visible,
.mmy-pro-download-pdf:focus-visible,
.mmy-pro-reset:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* Remove any theme-specific overrides */
.mmy-pro-container * {
    box-sizing: border-box;
}

/* Ensure images fill width properly */
.mmy-pro-item img {
    max-width: 100%;
    width: 100%;
    height: auto;
    display: block;
}

/* Image Slider Styles */
.mmy-pro-slider {
    position: relative;
    width: 100%;
    height: 200px;
    margin-bottom: 1rem;
    border-radius: 4px;
    overflow: hidden;
    background-color: #fafafa;
}

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

.mmy-pro-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mmy-pro-slide.active {
    opacity: 1;
}

.mmy-pro-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Navigation Arrows */
.mmy-pro-slider-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 10px;
    pointer-events: none;
}

.mmy-pro-slider-prev,
.mmy-pro-slider-next {
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    pointer-events: all;
    transition: background 0.3s ease;
    opacity: 0;
}

.mmy-pro-slider:hover .mmy-pro-slider-prev,
.mmy-pro-slider:hover .mmy-pro-slider-next {
    opacity: 1;
}

.mmy-pro-slider-prev:hover,
.mmy-pro-slider-next:hover {
    background: rgba(0, 0, 0, 0.7);
}

/* Dots Navigation */
.mmy-pro-slider-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 2;
}

.mmy-pro-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: background 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

.mmy-pro-dot.active {
    background: rgba(255, 255, 255, 0.9);
    width: 10px;
    height: 10px;
}

.mmy-pro-dot:hover {
    background: rgba(255, 255, 255, 0.8);
}

/* List Layout Slider Adjustments */
.mmy-pro-list .mmy-pro-slider {
    height: 150px;
    width: 150px;
    flex-shrink: 0;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .mmy-pro-slider {
        height: 200px;
    }
    
    /* Always show arrows on mobile */
    .mmy-pro-slider-prev,
    .mmy-pro-slider-next {
        opacity: 0.7;
    }
    
    /* Larger touch targets on mobile */
    .mmy-pro-slider-prev,
    .mmy-pro-slider-next {
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
    
    .mmy-pro-list .mmy-pro-slider {
        height: 200px;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .mmy-pro-slider {
        height: 200px;
    }
    
    .mmy-pro-slider-dots {
        bottom: 5px;
    }
    
    .mmy-pro-dot {
        width: 6px;
        height: 6px;
    }
    
    .mmy-pro-dot.active {
        width: 8px;
        height: 8px;
    }
}

/* Hide navigation elements when only one image */
.mmy-pro-slider:not(:has(.mmy-pro-slide:nth-child(2))) .mmy-pro-slider-nav,
.mmy-pro-slider:not(:has(.mmy-pro-slide:nth-child(2))) .mmy-pro-slider-dots {
    display: none;
}

/* Loading state for images */
.mmy-pro-slider img {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

.mmy-pro-slider img[src] {
    animation: none;
    background: none;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Image Slider Styles */
.mmy-pro-slider {
    position: relative;
    width: 100%;
    height: 200px;
    margin-bottom: 1rem;
    border-radius: 4px;
    overflow: hidden;
    background-color: #fafafa;
}

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

.mmy-pro-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mmy-pro-slide.active {
    opacity: 1;
}

.mmy-pro-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Navigation Arrows */
.mmy-pro-slider-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 10px;
    pointer-events: none;
}

.mmy-pro-slider-prev,
.mmy-pro-slider-next {
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    pointer-events: all;
    transition: background 0.3s ease;
    opacity: 0;
}

.mmy-pro-slider:hover .mmy-pro-slider-prev,
.mmy-pro-slider:hover .mmy-pro-slider-next {
    opacity: 1;
}

.mmy-pro-slider-prev:hover,
.mmy-pro-slider-next:hover {
    background: rgba(0, 0, 0, 0.7);
}

/* Dots Navigation */
.mmy-pro-slider-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 2;
}

.mmy-pro-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: background 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

.mmy-pro-dot.active {
    background: rgba(255, 255, 255, 0.9);
    width: 10px;
    height: 10px;
}

.mmy-pro-dot:hover {
    background: rgba(255, 255, 255, 0.8);
}

/* List Layout Slider Adjustments */
.mmy-pro-list .mmy-pro-slider {
    height: 200px;
    width: 200px;
    flex-shrink: 0;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .mmy-pro-slider {
        height: 200px;
    }
    
    /* Always show arrows on mobile */
    .mmy-pro-slider-prev,
    .mmy-pro-slider-next {
        opacity: 0.7;
    }
    
    /* Larger touch targets on mobile */
    .mmy-pro-slider-prev,
    .mmy-pro-slider-next {
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
    
    .mmy-pro-list .mmy-pro-slider {
        height: 200px;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .mmy-pro-slider {
        height: 200px;
    }
    
    .mmy-pro-slider-dots {
        bottom: 5px;
    }
    
    .mmy-pro-dot {
        width: 6px;
        height: 6px;
    }
    
    .mmy-pro-dot.active {
        width: 8px;
        height: 8px;
    }
}

/* Hide navigation elements when only one image */
.mmy-pro-slider:not(:has(.mmy-pro-slide:nth-child(2))) .mmy-pro-slider-nav,
.mmy-pro-slider:not(:has(.mmy-pro-slide:nth-child(2))) .mmy-pro-slider-dots {
    display: none;
}

/* Loading state for images */
.mmy-pro-slider img {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

.mmy-pro-slider img[src] {
    animation: none;
    background: none;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}