/* FloatyFAQ Frontend Styles */
/* Version: 2.0.1 - Emoji fix */

/* Balloon button - Higher specificity without !important to allow inline style overrides */
#floatyfaq-balloon.floatyfaq-balloon {
    position: fixed;
    z-index: 999998;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #0073aa;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

#floatyfaq-balloon.floatyfaq-balloon:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.floatyfaq-balloon.position-bottom-right {
    bottom: 20px;
    right: 20px;
}

.floatyfaq-balloon.position-bottom-left {
    bottom: 20px;
    left: 20px;
}

.floatyfaq-balloon.position-top-right {
    top: 20px;
    right: 20px;
}

.floatyfaq-balloon.position-top-left {
    top: 20px;
    left: 20px;
}

/* Overlay - Keep !important for critical positioning and visibility */
.floatyfaq-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 999999 !important;
    background: rgba(0, 0, 0, 0.7) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transition: all 0.3s ease !important;
}

.floatyfaq-overlay.active {
    opacity: 1 !important;
    visibility: visible !important;
}

.floatyfaq-modal {
    background: white !important;
    border-radius: 12px !important;
    width: 90% !important;
    max-width: 600px !important;
    max-height: 80vh !important;
    display: flex !important;
    flex-direction: column !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3) !important;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    position: relative !important;
    z-index: 1000000 !important;
}

.floatyfaq-overlay.active .floatyfaq-modal {
    transform: translateY(0);
}

/* Header */
.floatyfaq-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 25px;
    border-bottom: 1px solid #e0e0e0;
}

.floatyfaq-title {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    color: #333;
}

.floatyfaq-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: color 0.2s;
}

.floatyfaq-close:hover {
    color: #000;
}

/* Search */
.floatyfaq-search {
    padding: 15px 25px;
    border-bottom: 1px solid #e0e0e0;
}

.floatyfaq-search input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.2s;
}

.floatyfaq-search input:focus {
    outline: none;
    border-color: #0073aa;
}

/* Content */
.floatyfaq-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 25px;
}

/* Categories */
.floatyfaq-categories {
    display: grid;
    gap: 12px;
}

.floatyfaq-category-item {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.floatyfaq-category-item:hover {
    background: #e9ecef;
    border-color: #0073aa;
    transform: translateX(4px);
}

.floatyfaq-category-name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.floatyfaq-category-description {
    font-size: 14px;
    color: #666;
    margin: 0;
}

/* Back button */
.floatyfaq-back {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
    transition: all 0.2s;
}

.floatyfaq-back:hover {
    background: #e9ecef;
    color: #333;
}

/* FAQs */
.floatyfaq-faq-item {
    margin-bottom: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.floatyfaq-faq-question {
    padding: 16px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    transition: background 0.2s;
    font-weight: 500;
    color: #333;
}

.floatyfaq-faq-question:hover {
    background: #f8f9fa;
}

.floatyfaq-faq-icon {
    flex-shrink: 0;
    transition: transform 0.3s;
}

.floatyfaq-faq-item.active .floatyfaq-faq-icon {
    transform: rotate(180deg);
}

.floatyfaq-faq-answer {
    padding: 0 20px;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.floatyfaq-faq-item.active .floatyfaq-faq-answer {
    padding: 16px 20px;
    max-height: 500px;
}

.floatyfaq-faq-answer-content {
    color: #555;
    line-height: 1.6;
}

.floatyfaq-faq-answer-content p:first-child {
    margin-top: 0;
}

.floatyfaq-faq-answer-content p:last-child {
    margin-bottom: 0;
}

/* Approfondisci button */
.floatyfaq-faq-link {
    margin-top: 15px;
    text-align: right;
}

.floatyfaq-btn-approfondisci {
    display: inline-block;
    padding: 10px 20px;
    background: #0073aa;
    color: white !important;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    transition: background 0.2s;
}

.floatyfaq-btn-approfondisci:hover {
    background: #005a87;
}

/* No results */
.floatyfaq-no-results {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

/* Responsive */
@media (max-width: 768px) {
    .floatyfaq-modal {
        width: 95%;
        max-height: 90vh;
    }
    
    .floatyfaq-header {
        padding: 15px 20px;
    }
    
    .floatyfaq-title {
        font-size: 18px;
    }
    
    .floatyfaq-content {
        padding: 15px 20px;
    }
    
    .floatyfaq-balloon {
        width: 50px;
        height: 50px;
    }
    
    .floatyfaq-balloon svg {
        width: 24px;
        height: 24px;
    }
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.floatyfaq-category-item,
.floatyfaq-faq-item {
    animation: fadeIn 0.3s ease;
}

/* Rating System */
.floatyfaq-rating-container {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.floatyfaq-rating-question {
    font-size: 13px;
    color: #666;
    margin: 0 0 8px 0;
    font-weight: 500;
}

.floatyfaq-rating-buttons {
    display: flex;
    gap: 8px;
}

.floatyfaq-rating-btn {
    flex: 1;
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    color: #555;
}

/* Fix per emoji WordPress */
.floatyfaq-rating-btn img.emoji {
    display: inline-block !important;
    width: 14px !important;
    height: 14px !important;
    margin: 0 2px 0 0 !important;
    vertical-align: middle !important;
}

.floatyfaq-rating-btn:hover:not(:disabled) {
    border-color: #0073aa;
    background: #f0f8ff;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.floatyfaq-rating-btn:active:not(:disabled) {
    transform: translateY(0);
}

.floatyfaq-rating-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.floatyfaq-rating-feedback {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
}

.floatyfaq-rating-success {
    color: #46b450;
    font-weight: 500;
}

.floatyfaq-rating-error {
    color: #dc3232;
    font-weight: 500;
}

/* Preview Mode Styles */
.floatyfaq-preview-container {
    position: relative;
    width: 100%;
    height: 400px;
    background: #f5f5f5;
    border: 2px dashed #ccc;
    border-radius: 8px;
    margin: 20px 0;
    overflow: hidden;
}

.floatyfaq-preview-balloon {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #0073aa;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.floatyfaq-preview-balloon:hover {
    transform: scale(1.1);
}

.floatyfaq-preview-label {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
}
