/* =============================================
   TREEBIRD FEEDBACK WIDGET
   A floating feedback button + modal for treebird.uk
   Uses CSS variables from style.css:
   --accent, --warning, --bg-surface, --bg-surface-light,
   --border, --text-primary, --text-muted, --font-serif
   ============================================= */

/* Floating Feedback Button */
.feedback-fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent) 0%, var(--warning) 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    z-index: 9999;
}

.feedback-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}

.feedback-fab:active {
    transform: scale(0.95);
}

.feedback-fab.hidden {
    display: none;
}

/* Modal Overlay */
.feedback-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.feedback-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Feedback Modal */
.feedback-modal {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 90%;
    max-width: 420px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

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

/* Modal Header */
.feedback-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface-light);
}

.feedback-header h3 {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.feedback-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.25rem;
    transition: color 0.2s ease;
}

.feedback-close:hover {
    color: var(--text-primary);
}

/* Chat Container */
.feedback-chat {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Chat Messages */
.feedback-message {
    max-width: 85%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.925rem;
    line-height: 1.5;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.feedback-message.sancha {
    background: var(--bg-surface-light);
    border: 1px solid var(--border);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.feedback-message.user {
    background: linear-gradient(135deg, var(--accent) 0%, var(--warning) 100%);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* Input Area */
.feedback-input-area {
    padding: 1rem;
    border-top: 1px solid var(--border);
    background: var(--bg-surface-light);
}

.feedback-input-row {
    display: flex;
    gap: 0.5rem;
}

.feedback-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 0.925rem;
    font-family: inherit;
    resize: none;
    min-height: 44px;
    max-height: 120px;
}

.feedback-input:focus {
    outline: none;
    border-color: var(--accent);
}

.feedback-input::placeholder {
    color: var(--text-muted);
}

.feedback-send {
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    background: var(--warning);
    color: white;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s ease;
}

.feedback-send:hover {
    background: var(--color-rust-dark, #8B4513);
}

.feedback-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Type Selector */
.feedback-types {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.feedback-type-btn {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.feedback-type-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.feedback-type-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* Success State */
.feedback-success {
    text-align: center;
    padding: 2rem;
}

.feedback-success-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feedback-success h4 {
    margin: 0 0 0.5rem 0;
    font-family: var(--font-serif);
}

.feedback-success p {
    color: var(--text-muted);
    margin: 0;
}

/* Responsive */
@media (max-width: 480px) {
    .feedback-fab {
        bottom: 1rem;
        right: 1rem;
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
    }

    .feedback-modal {
        width: 95%;
        max-height: 85vh;
    }
}