/**
 * iFody IA Search - Estilos
 * Sistema de busca inteligente com modal animado
 */

/* ==================== Widget de Busca ==================== */

.ifody-ia-search-widget {
    background: linear-gradient(150deg, rgba(42, 5, 66, 0.92) 0%, rgba(20, 2, 38, 0.95) 100%);
    padding: 14px 16px 16px;
    border-radius: 12px;
    margin: 12px auto;
    box-shadow: 0 12px 28px rgba(10, 0, 25, 0.35);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    max-width: 360px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ifody-ia-search-widget::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.16) 0%, transparent 72%);
    animation: pulse 5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.ifody-ia-search-widget::after {
    content: '';
    position: absolute;
    inset: 8px;
    border-radius: 9px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(4px);
    opacity: 0.4;
    pointer-events: none;
}

.ifody-ia-search-header {
    text-align: center;
    margin-bottom: 2px;
    position: relative;
    z-index: 1;
}

.ifody-ia-search-header h3 {
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 3px 0;
    text-shadow: 0 10px 30px rgba(0,0,0,0.32);
}

.ifody-ia-search-subtitle {
    color: rgba(255,255,255,0.7);
    font-size: 11px;
    margin: 0;
    letter-spacing: 0.25px;
}

.ifody-ia-search-form {
    position: relative;
    z-index: 1;
}

.ifody-search-input-wrapper {
    display: flex;
    gap: 6px;
    margin-bottom: 2px;
    position: relative;
    z-index: 1;
}

.ifody-ia-search-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 9px;
    font-size: 13px;
    background: rgba(20, 2, 33, 0.55);
    box-shadow: 0 8px 18px rgba(12, 0, 30, 0.32);
    transition: all 0.3s;
    color: #fff;
}

.ifody-ia-search-input:focus {
    outline: none;
    background: rgba(54, 0, 80, 0.68);
    box-shadow: 0 12px 26px rgba(70, 0, 110, 0.44);
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.3);
}

.ifody-ia-search-input::placeholder {
    color: rgba(255, 255, 255, 0.55);
}

.ifody-ia-search-btn {
    padding: 10px 18px;
    background: linear-gradient(135deg, rgba(255, 95, 189, 0.95) 0%, rgba(111, 41, 255, 0.95) 100%);
    color: #fff;
    border: none;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s;
    box-shadow: 0 10px 22px rgba(120, 0, 150, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.ifody-ia-search-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 32px rgba(120, 0, 150, 0.45);
    filter: brightness(1.08);
}

.ifody-ia-search-btn:active {
    transform: translateY(0);
}

.ifody-search-icon {
    font-size: 18px;
}

.ifody-ia-search-examples {
    color: rgba(255,255,255,0.62);
    font-size: 10px;
    text-align: center;
    margin: 0;
    font-style: italic;
    letter-spacing: 0.24px;
}

/* ================ Layout dentro de widgets ================= */

.widget .ifody-ia-search-widget,
.ifody-ia-search-widget.is-sidebar {
    max-width: 100%;
    margin: 0 0 16px 0;
    padding: 16px 18px 18px;
    border-radius: 12px;
    box-shadow: 0 8px 22px rgba(10, 0, 25, 0.32);
}

.widget .ifody-ia-search-header h3,
.ifody-ia-search-widget.is-sidebar .ifody-ia-search-header h3 {
    font-size: 17px;
}

.widget .ifody-ia-search-subtitle,
.ifody-ia-search-widget.is-sidebar .ifody-ia-search-subtitle {
    font-size: 10px;
}

.widget .ifody-search-input-wrapper,
.ifody-ia-search-widget.is-sidebar .ifody-search-input-wrapper {
    gap: 6px;
}

.widget .ifody-ia-search-input,
.ifody-ia-search-widget.is-sidebar .ifody-ia-search-input {
    padding: 9px 12px;
    font-size: 12px;
}

.widget .ifody-ia-search-btn,
.ifody-ia-search-widget.is-sidebar .ifody-ia-search-btn {
    padding: 9px 16px;
    font-size: 11px;
}

.widget .ifody-ia-search-examples,
.ifody-ia-search-widget.is-sidebar .ifody-ia-search-examples {
    font-size: 9px;
}

/* ==================== Modal ==================== */

.ifody-ia-search-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.ifody-ia-search-modal.active {
    display: flex;
}

.ifody-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.ifody-modal-content {
    position: relative;
    background: radial-gradient(circle at top left, rgba(86, 0, 120, 0.92), rgba(18, 0, 32, 0.95));
    border-radius: 24px;
    max-width: 920px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 35px 80px rgba(10, 0, 25, 0.85);
    animation: slideUp 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ifody-modal-close {
    position: absolute;
    top: 22px;
    right: 22px;
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.12);
    border: none;
    border-radius: 50%;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 10;
    color: #fdf5ff;
    box-shadow: 0 8px 20px rgba(0,0,0,0.45);
}

.ifody-modal-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

/* ==================== Loading State ==================== */

.ifody-search-loading {
    padding: 60px 40px;
    text-align: center;
    color: #fef1ff;
}

.ifody-loading-animation {
    margin-bottom: 30px;
}

.ifody-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 1s linear infinite;
}

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

.ifody-loading-title {
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 30px 0;
}

.ifody-loading-phases {
    max-width: 400px;
    margin: 0 auto;
}

.ifody-phase {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    margin-bottom: 12px;
    background: rgba(36, 1, 54, 0.55);
    border-radius: 14px;
    opacity: 0.45;
    transition: all 0.5s;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.ifody-phase.active {
    opacity: 1;
    background: linear-gradient(135deg, rgba(255, 63, 168, 0.55) 0%, rgba(101, 24, 209, 0.55) 100%);
    transform: translateX(12px);
    box-shadow: 0 14px 28px rgba(101, 24, 209, 0.35);
    border-color: rgba(255, 255, 255, 0.22);
}

.ifody-phase-icon {
    font-size: 24px;
}

.ifody-phase-text {
    flex: 1;
    text-align: left;
    font-size: 15px;
    font-weight: 500;
    color: rgba(255,255,255,0.8);
}

.ifody-phase.active .ifody-phase-text {
    color: #fff;
    font-weight: 600;
}

.ifody-loading-stats {
    margin-top: 20px;
    color: #999;
    font-size: 14px;
}

/* ==================== Results State ==================== */

.ifody-search-results {
    padding: 42px;
    background: rgba(18, 0, 32, 0.8);
}

.ifody-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.08);
}

.ifody-results-header h3 {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.ifody-results-count {
    color: #667eea;
}

.ifody-search-again-btn {
    padding: 12px 26px;
    background: rgba(255, 63, 168, 0.15);
    color: #ff92d1;
    border: 1px solid rgba(255, 63, 168, 0.45);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.ifody-search-again-btn:hover {
    background: rgba(255, 63, 168, 0.35);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(255, 63, 168, 0.3);
}

.ifody-results-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ifody-result-item {
    display: flex;
    gap: 20px;
    padding: 22px;
    background: linear-gradient(135deg, rgba(43, 6, 59, 0.9), rgba(22, 1, 38, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 18px;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.ifody-result-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(135deg, #ff3ba7 0%, #6618d1 100%);
    transform: scaleY(0);
    transition: transform 0.3s;
}

.ifody-result-item:hover {
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: 0 25px 45px rgba(10, 0, 30, 0.65);
    transform: translateX(6px);
}

.ifody-result-item:hover::before {
    transform: scaleY(1);
}

.ifody-result-image {
    width: 150px;
    height: 150px;
    flex-shrink: 0;
    border-radius: 14px;
    overflow: hidden;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.ifody-result-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.ifody-result-item:hover .ifody-result-image img {
    transform: scale(1.1);
}

.ifody-result-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.ifody-result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.ifody-result-name {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 5px 0;
}

.ifody-result-relevance {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #ff3ba7 0%, #6618d1 100%);
    color: #fff;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 12px 30px rgba(102, 24, 209, 0.4);
}

.ifody-result-rating {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    color: rgba(255,255,255,0.6);
    margin-bottom: 10px;
}

.ifody-result-stars {
    color: #ffc107;
}

.ifody-result-summary {
    font-size: 14px;
    color: rgba(255,255,255,0.75);
    line-height: 1.7;
    margin-bottom: 12px;
}

.ifody-result-features {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.ifody-feature-tag {
    padding: 6px 12px;
    background: rgba(255, 63, 168, 0.16);
    color: #ffa8e0;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid rgba(255, 63, 168, 0.35);
}

.ifody-result-reasons {
    background: rgba(15, 52, 34, 0.55);
    padding: 12px 15px;
    border-radius: 12px;
    margin-bottom: 15px;
    border-left: 3px solid #38c979;
}

.ifody-result-reasons-title {
    font-size: 12px;
    font-weight: 700;
    color: #38c979;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.ifody-result-reasons-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ifody-result-reasons-list li {
    font-size: 13px;
    color: rgba(255,255,255,0.75);
    padding-left: 18px;
    position: relative;
    margin-bottom: 4px;
}

.ifody-result-reasons-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #38c979;
    font-weight: bold;
}

.ifody-result-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.ifody-result-price {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ifody-price-regular {
    font-size: 14px;
    color: rgba(255,255,255,0.45);
    text-decoration: line-through;
}

.ifody-price-pix {
    font-size: 20px;
    font-weight: 700;
    color: #38c979;
}

.ifody-price-label {
    font-size: 12px;
    color: #8cffba;
    font-weight: 600;
}

.ifody-result-actions {
    display: flex;
    gap: 10px;
}

.ifody-btn {
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    text-decoration: none;
    display: inline-block;
}

.ifody-btn-primary {
    background: linear-gradient(135deg, #ff3ba7 0%, #6618d1 100%);
    color: #fff;
    box-shadow: 0 18px 36px rgba(102, 24, 209, 0.4);
}

.ifody-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.ifody-btn-secondary {
    background: rgba(255, 63, 168, 0.18);
    color: #ff92d1;
    border: 1px solid rgba(255, 63, 168, 0.45);
}

.ifody-btn-secondary:hover {
    background: rgba(255, 63, 168, 0.38);
    color: #fff;
}

/* ==================== Error State ==================== */

.ifody-search-error {
    padding: 60px 40px;
    text-align: center;
}

.ifody-error-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.ifody-search-error h3 {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin: 0 0 15px 0;
}

.ifody-search-error p {
    font-size: 16px;
    color: #666;
    margin-bottom: 30px;
}

#ifody-error-retry-btn {
    margin: 0 auto;
}

/* ==================== Responsive ==================== */

@media (max-width: 768px) {
    .ifody-ia-search-widget {
        padding: 20px;
    }
    
    .ifody-ia-search-header h3 {
        font-size: 22px;
    }
    
    .ifody-search-input-wrapper {
        flex-direction: column;
    }
    
    .ifody-modal-content {
        border-radius: 20px 20px 0 0;
        max-height: 95vh;
    }
    
    .ifody-search-results {
        padding: 20px;
    }
    
    .ifody-results-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .ifody-result-item {
        flex-direction: column;
    }
    
    .ifody-result-image {
        width: 100%;
        height: 200px;
    }
    
    .ifody-result-footer {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .ifody-result-actions {
        flex-direction: column;
    }
}
