/**
 * Theme Override Protection
 * Prevents WoodMart and other themes from breaking MantiLoad styles
 *
 * @package MantiLoad
 * @version 1.0.0
 */

/* ========================================
   High Specificity Overrides
   ======================================== */

/* WoodMart often adds styles with high specificity */
/* We use even higher specificity to override */

body .mantiload-modal {
    font-family: inherit !important;
}

body .mantiload-modal input[type="text"],
body .mantiload-modal input[type="search"],
body .mantiload-search-input,
body .mantiload-inline-search-input {
    width: 100% !important;
    padding: 14px 48px !important;
    font-size: 16px !important;
    line-height: 1.5 !important;
    border: 2px solid #e5e7eb !important;
    border-radius: 8px !important;
    background: #f9fafb !important;
    color: #111827 !important;
    transition: all 0.2s ease !important;
    outline: none !important;
    box-shadow: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    margin: 0 !important;
    height: auto !important;
}

body .mantiload-inline-search-input {
    padding: 12px 8px !important;
    border: none !important;
    background: transparent !important;
}

body .mantiload-search-input:focus,
body .mantiload-inline-search-input:focus {
    background: #fff !important;
    border-color: #667eea !important;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1) !important;
    outline: none !important;
}

body .mantiload-inline-search-input:focus {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Button overrides */
body .mantiload-modal button,
body .mantiload-search-box-inline button {
    font-family: inherit !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

body .mantiload-inline-submit-btn {
    padding: 10px 24px !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border: none !important;
    border-radius: 50px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #fff !important;
    height: auto !important;
    line-height: normal !important;
}

body .mantiload-modal-close,
body .mantiload-search-clear,
body .mantiload-inline-clear {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Link overrides */
body .mantiload-modal a,
body .mantiload-search-box-inline a {
    text-decoration: none !important;
    color: inherit !important;
}

body .mantiload-result-item:hover,
body .mantiload-inline-result-item:hover {
    text-decoration: none !important;
}

/* Image overrides */
body .mantiload-result-thumbnail,
body .mantiload-inline-result-thumb {
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
    height: auto !important;
}

body .mantiload-result-thumbnail {
    width: 60px !important;
    height: 60px !important;
}

body .mantiload-inline-result-thumb {
    width: 70px !important;
    height: 70px !important;
}

/* Typography overrides */
body .mantiload-result-title,
body .mantiload-inline-result-title {
    margin: 0 0 4px !important;
    padding: 0 !important;
    line-height: 1.4 !important;
}

body .mantiload-result-meta,
body .mantiload-inline-result-meta {
    margin: 0 !important;
    padding: 0 !important;
}

/* Prevent theme from adding margins/padding */
body .mantiload-modal * {
    margin: 0 auto 0 0 !important;
    padding: 0 !important;
}

/* Allow specific elements to have their intended spacing */
body .mantiload-modal-content {
    margin: 0 !important;
    padding: 0 !important;
}

body .mantiload-search-form-wrapper {
    padding: 24px 24px 16px !important;
}

body .mantiload-search-results {
    padding: 8px !important;
}

body .mantiload-result-item,
body .mantiload-inline-result-item {
    padding: 12px !important;
    margin: 0 !important;
}

/* WoodMart specific fixes */
.woodmart-theme body .mantiload-search-input,
.woodmart-theme body .mantiload-inline-search-input {
    font-family: inherit !important;
}

/* Remove WoodMart's box-shadow on inputs */
.woodmart-theme body .mantiload-search-input:focus {
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1) !important;
}

/* Prevent WoodMart from changing button colors */
.woodmart-theme body .mantiload-inline-submit-btn:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6842 90%) !important;
}

/* ========================================
   Mobile Responsiveness
   ======================================== */

@media (max-width: 640px) {
    body .mantiload-search-input {
        font-size: 16px !important; /* Prevent zoom on iOS */
    }
}

/* ========================================
   Z-Index Protection
   ======================================== */

/* Ensure modal is above theme elements */
body .mantiload-modal {
    z-index: 999999 !important;
}

body .mantiload-inline-results-dropdown {
    z-index: 99999 !important;
}
