/* wpf-style.css - Woo Product Finder Frontend Styles */

/* ===== MODAL STYLES ===== */
#wpf-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

#wpf-modal .wpf-modal-content {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
    position: relative;
    animation: wpf-modal-appear 0.3s ease-out;
}

@keyframes wpf-modal-appear {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ===== KEYBOARD FALLBACK STYLES ===== */
#wpf-keyboard-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin: 20px 0;
}

#wpf-text-input {
    width: 100%;
    max-width: 300px;
    padding: 14px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 16px;
    background: #fff;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#wpf-text-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
    transform: translateY(-2px);
}

#wpf-text-submit {
    padding: 14px 28px;
    background: linear-gradient(135deg, #0073aa, #005a87);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.4);
    min-width: 120px;
}

#wpf-text-submit:hover {
    background: linear-gradient(135deg, #005a87, #004670);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 115, 170, 0.5);
}

/* ===== SPEECH TEXT ===== */
#wpf-speech-text {
    font-style: italic;
    margin-bottom: 20px;
    color: #555;
    font-size: 16px;
    line-height: 1.4;
}

/* ===== PRODUCT RESULTS ===== */
#wpf-product-results {
    /* Note: Grid display commented out in original code */
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

#wpf-product-results a {
    text-decoration: none;
    color: inherit;
}

#wpf-product-results .wpf-product-card {
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    transition: all 0.3s ease;
}

#wpf-product-results .wpf-product-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

#wpf-product-results img {
    max-width: 100%;
    height: auto;
    margin-bottom: 8px;
    border-radius: 4px;
}

/* ===== VIEW ALL BUTTON ===== */
#wpf-view-all-btn {
    display: inline-block;
    padding: 12px 24px;
    background: #0073aa;
    color: #fff;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-top: 20px;
}

#wpf-view-all-btn:hover {
    background: #005a87;
    transform: translateY(-1px);
}

/* ===== MIC BUTTON STYLES ===== */
.wpf-mic-btn {
    margin-left: 8px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.wpf-mic-btn:hover {
    background: #005a87;
    transform: scale(1.05);
}

/* Floating mic button */
#wpf-floating-mic-btn {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 9999;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#wpf-floating-mic-btn:hover {
    background: #005a87;
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
}

/* Listening states */
.wpf-mic-btn.listening,
#wpf-floating-mic-btn.listening {
    background: #ff4b4b;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* AI-enabled visual state */
.wpf-mic-btn.wpf-ai-enabled,
#wpf-floating-mic-btn.wpf-ai-enabled {
    background: linear-gradient(135deg, #6a5cff, #00c2ff);
}

/* Responsive design */
@media (max-width: 768px) {
    #wpf-modal .wpf-modal-content {
        padding: 20px;
        margin: 10px;
    }
    
    #wpf-product-results {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }
}

/* Product Grid */
.wpf-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

/* Product Card Placeholder */
.wpf-product-grid .wpf-product-card {
    border: 1px solid #eee;
    padding: 10px;
    text-align: center;
    border-radius: 4px;
    background: #fafafa;
}

/* Footer */
.wpf-modal-footer {
    text-align: right;
    margin-top: 15px;
}

/* Core modal (duplicate but needed for compatibility) */
.wpf-modal { 
    display: none; 
    position: fixed; 
    inset: 0; 
    z-index: 10000; 
    align-items: center; 
    justify-content: center; 
}

.wpf-modal[aria-hidden="false"] { 
    display: flex; 
}

.wpf-modal-overlay { 
    position: absolute; 
    inset: 0; 
    background: rgba(0,0,0,.6); 
}

.wpf-modal-content { 
    position: relative; 
    background: #fff; 
    border-radius: 8px; 
    padding: 20px; 
    max-width: 900px; 
    width: 92%; 
    max-height: 90vh; 
    overflow: auto; 
    box-shadow: 0 10px 30px rgba(0,0,0,.2); 
}

.wpf-modal-close { 
    position: absolute; 
    top: 10px; 
    right: 12px; 
    border: none; 
    background: none; 
    font-size: 20px; 
    cursor: pointer; 
}

/* Speech text */
.wpf-speech-text { 
    font-style: italic; 
    margin-bottom: 12px; 
    font-size: 1.05rem; 
}

/* Typed input fallback */
.wpf-typed-input-wrapper { 
    display: none; 
    margin-bottom: 12px; 
}

.wpf-typed-input-wrapper.active { 
    display: flex; 
    gap: 8px; 
    align-items: center; 
}

.wpf-typed-input { 
    flex: 1; 
    padding: 8px 10px; 
    border: 1px solid #ddd; 
    border-radius: 4px; 
    font-size: 1rem; 
}

/* Product grid - 3x3 */
.wpf-product-grid { 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); 
    gap: 14px; 
    margin-top: 14px; 
}

.wpf-product-grid .wpf-grid-item { 
    background: #fafafa; 
    border: 1px solid #eee; 
    padding: 10px; 
    border-radius: 6px; 
    text-align: center; 
}

.wpf-product-image { 
    max-width: 100%; 
    height: auto; 
    display: block; 
    margin: 0 auto 8px; 
    border-radius: 4px; 
}

.wpf-product-title { 
    font-size: 0.95rem; 
    margin: 6px 0; 
    color: #111; 
}

.wpf-product-price { 
    font-weight: 700; 
    color: #0073aa; 
}

/* View all button */
.wpf-view-all-btn { 
    display: inline-block; 
    padding: 8px 14px; 
    background: #0073aa; 
    color: #fff; 
    border-radius: 6px; 
    text-decoration: none; 
    margin-top: 14px; 
}

/* Mic button base styling (search bar button) */
.wpf-mic-btn {
    margin-left: 6px;
    padding: 6px 9px;
    font-size: 16px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    vertical-align: middle;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Listening states */
.wpf-mic-btn.listening,
#wpf-floating-mic-btn.listening {
    background: #004f70;
    transform: scale(1.03);
}

/* AI-enabled visual state */
.wpf-mic-btn.wpf-ai-enabled,
#wpf-floating-mic-btn.wpf-ai-enabled {
    background: linear-gradient(135deg, #6a5cff 0%, #00c2ff 100%);
    color: #fff;
}

/* Responsive: grid -> 1 column on small screens */
@media (max-width: 640px) {
    .wpf-product-grid { 
        grid-template-columns: 1fr; 
    }
    
    .wpf-modal-content { 
        padding: 16px; 
    }
}

/* Screen reader text helper */
.screen-reader-text { 
    position: absolute !important; 
    clip: rect(1px, 1px, 1px, 1px); 
    padding: 0; 
    border: 0; 
    height: 1px; 
    width: 1px; 
    overflow: hidden; 
}

/* Default mic button styling (duplicate - for compatibility) */
.wpf-mic-btn {
    margin-left: 6px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 50%;
    padding: 6px 10px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* Listening state */
.wpf-mic-btn.listening {
    background: #ff4b4b;
    color: #fff;
    animation: pulse 1s infinite;
}

/* AI-enhanced mic styling (duplicate - for compatibility) */
.wpf-mic-btn.wpf-ai-enabled {
    background: linear-gradient(135deg, #6a11cb, #2575fc);
    color: #fff;
    box-shadow: 0 0 12px rgba(106, 17, 203, 0.7);
    border: none;
}

.wpf-mic-btn.wpf-ai-enabled.listening {
    animation: glowPulse 1s infinite alternate;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes glowPulse {
    0% {
        box-shadow: 0 0 8px rgba(106, 17, 203, 0.6);
    }
    100% {
        box-shadow: 0 0 20px rgba(37, 117, 252, 0.9);
    }
}

/* Email sent indicator */
.wpf-email-sent { 
    cursor: default; 
}

.wpf-email-sent[title] { 
    position: relative; 
}

/* FIX FOR MODAL CENTERING */
.wpf-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.wpf-modal[aria-hidden="false"] {
    display: flex;
}

.wpf-modal-content {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
    position: relative;
    animation: wpf-modal-appear 0.3s ease-out;
}

/* ===== MODAL CLOSE BUTTON ===== */
.wpf-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    border: none;
    background: #f5f5f5;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    line-height: 1;
    color: #555;
    transition: all 0.3s ease;
    z-index: 10;
}

.wpf-modal-close:hover {
    background: #e0e0e0;
    color: #333;
    transform: rotate(90deg);
}

.wpf-modal-close:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* ===== MODAL OVERLAY ===== */
.wpf-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    cursor: pointer;
}