/* Search Modal Styling - Enhanced for WP Masjid Theme Compatibility */
.ss-wpm-modal {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    transition: opacity 0.3s ease;
}

.ss-wpm-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.ss-wpm-modal-content {
    background-color: var(--wp-admin-theme-color, #ffffff);
    margin: 5vh auto;
    padding: 0;
    border: none;
    width: 90%;
    max-width: 800px;
    min-height: 300px;
    max-height: 85vh;
    border-radius: 12px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.ss-wpm-modal-header {
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: white;
    padding: 20px 24px;
    border-radius: 12px 12px 0 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ss-wpm-modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: white;
}

.ss-wpm-close-button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    transition: all 0.2s ease;
    line-height: 1;
}

.ss-wpm-close-button:hover,
.ss-wpm-close-button:focus {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
    outline: none;
}

.ss-wpm-modal-body {
    padding: 24px;
}

#ss-wpm-search-input {
    width: 100%;
    padding: 16px 20px;
    margin: 0 0 20px 0;
    box-sizing: border-box;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    background: #ffffff;
    transition: all 0.2s ease;
    outline: none;
}

#ss-wpm-search-input:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

#ss-wpm-search-input::placeholder {
    color: #8c8f94;
    opacity: 1;
}

#ss-wpm-search-results {
    margin-top: 0;
    max-height: 50vh;
    overflow-y: auto;
    border-radius: 8px;
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
}

#ss-wpm-search-results:empty {
    display: none;
}

#ss-wpm-search-results ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

#ss-wpm-search-results li {
    border-bottom: 1px solid #e1e5e9;
}

#ss-wpm-search-results li:last-child {
    border-bottom: none;
}

#ss-wpm-search-results li a {
    display: block;
    padding: 16px 20px;
    text-decoration: none;
    color: #1e1e1e;
    transition: all 0.2s ease;
    border-left: 4px solid transparent;
}

#ss-wpm-search-results li a:hover,
#ss-wpm-search-results li a:focus {
    background-color: #ffffff;
    border-left-color: #0073aa;
    transform: translateX(4px);
    outline: none;
}

#ss-wpm-search-results h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #0073aa;
    line-height: 1.4;
}

#ss-wpm-search-results p {
    margin: 0;
    font-size: 14px;
    color: #646970;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ss-wpm-no-results {
    text-align: center;
    padding: 40px 20px;
    color: #646970;
    font-style: italic;
}

.ss-wpm-loading {
    text-align: center;
    padding: 20px;
    color: #646970;
}

.ss-wpm-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #e1e5e9;
    border-radius: 50%;
    border-top-color: #0073aa;
    animation: spin 1s ease-in-out infinite;
    margin-left: 10px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .ss-wpm-modal-content {
        width: 95%;
        margin: 2vh auto;
        max-height: 90vh;
        border-radius: 8px;
    }
    
    .ss-wpm-modal-header {
        padding: 16px 20px;
    }
    
    .ss-wpm-modal-header h2 {
        font-size: 18px;
    }
    
    .ss-wpm-modal-body {
        padding: 20px;
    }
    
    #ss-wpm-search-input {
        padding: 14px 16px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    #ss-wpm-search-results {
        max-height: 40vh;
    }
    
    #ss-wpm-search-results li a {
        padding: 12px 16px;
    }
    
    #ss-wpm-search-results h3 {
        font-size: 15px;
    }
    
    #ss-wpm-search-results p {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .ss-wpm-modal-content {
        width: 98%;
        margin: 1vh auto;
        border-radius: 6px;
    }
    
    .ss-wpm-modal-header {
        padding: 12px 16px;
    }
    
    .ss-wpm-modal-body {
        padding: 16px;
    }
    
    #ss-wpm-search-results {
        max-height: 35vh;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .ss-wpm-modal-content {
        background-color: #1e1e1e;
        color: #ffffff;
    }
    
    #ss-wpm-search-input {
        background: #2c2c2c;
        border-color: #404040;
        color: #ffffff;
    }
    
    #ss-wpm-search-input::placeholder {
        color: #a0a0a0;
    }
    
    #ss-wpm-search-results {
        background: #2c2c2c;
        border-color: #404040;
    }
    
    #ss-wpm-search-results li a {
        color: #ffffff;
    }
    
    #ss-wpm-search-results li a:hover {
        background-color: #404040;
    }
    
    #ss-wpm-search-results h3 {
        color: #4fc3f7;
    }
    
    #ss-wpm-search-results p {
        color: #b0b0b0;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .ss-wpm-modal {
        background-color: rgba(0, 0, 0, 0.9);
    }
    
    .ss-wpm-modal-content {
        border: 2px solid #000000;
    }
    
    #ss-wpm-search-input {
        border-width: 3px;
    }
    
    #ss-wpm-search-results li a {
        border-left-width: 6px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .ss-wpm-modal-content {
        animation: none;
    }
    
    .ss-wpm-close-button:hover {
        transform: none;
    }
    
    #ss-wpm-search-results li a:hover {
        transform: none;
    }
    
    .ss-wpm-loading::after {
        animation: none;
    }
}