/* Reset & Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body, input, button {
    font-family: 'Plus Jakarta Sans', sans-serif !important;
}

body {
    background-color: #f5f7fa;
    color: #333;
    position: relative;
}

/* Floating Action Button */
.sticky-button {
    position: fixed;
    top: 12%;
    right: 0;
    background-color: #C2A877;
    color: white;
    border-radius: 35px 0 0 35px;
    display: flex;
    align-items: center;
    text-decoration: none;
    width: 70px;
    height: 70px;
    overflow: hidden;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    justify-content: flex-start;
    animation: 
        buttonFloat 3s ease-in-out infinite,
        subtleGlow 3s ease-in-out infinite;
    z-index: 999;
}

.sticky-button:hover {
    width: 200px;
    animation: none;
}

.icon-container {
    min-width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.sticky-button svg {
    width: 38px;
    height: 38px;
    transition: all 0.3s ease;
    animation: iconPulse 2.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
    transform-origin: center;
}

.sticky-button:hover svg {
    animation: none;
    transform: translateX(6px) scale(1);
}

.button-text {
    margin: 0;
    opacity: 0;
    font-size: 16px;
    font-weight: 400;
    letter-spacing: 0.8px;
    transform: translateX(-12px);
    transition: all 0.3s ease 0.1s;
    padding-right: 25px;
    min-width: 130px;
    font-family: 'Urbanist', sans-serif;
}

.sticky-button:hover .button-text {
    opacity: 0.95;
    transform: translateX(0);
}

/* Animations for Floating Button */
@keyframes buttonFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes subtleGlow {
    0%, 100% { box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); }
    50% { box-shadow: 0 4px 8px rgba(194, 168, 119, 0.3); }
}

/* Chat Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.4s ease;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.chat-modal {
    width: 840px;
    height: 770px;
    background-color: white;
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
    transform: scale(0.95);
    opacity: 0;
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.modal-overlay.active .chat-modal {
    transform: scale(1);
    opacity: 1;
}

.chat-header {
    padding: 16px;
    background-color: #C2A877;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 14px 14px 0 0;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
    position: relative;
}

.header-title {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 14px;
}

.status-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.status-dot {
    width: 10px;
    height: 10px;
    background-color: white;
    border-radius: 50%;
    position: relative;
    z-index: 2;
}

.status-pulse {
    width: 10px;
    height: 10px;
    background-color: white;
    border-radius: 50%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    opacity: 0.5;
    animation: pulse-wave 2s infinite;
}

@keyframes pulse-wave {
    0% { transform: scale(1); opacity: 0.5; }
    70% { transform: scale(2.5); opacity: 0; }
    100% { transform: scale(1); opacity: 0; }
}

.header-title h3 {
    font-weight: 600;
    font-size: 19px;
    color: white;
    padding-bottom: 2px;
}

.close-button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    cursor: pointer;
    color: white;
    height: 38px;
    width: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0);
}

.close-button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg) scale(1.1);
}

.close-button svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

.new-chat-button {
    background: rgba(255, 255, 255, 0.20);
    border: none;
    cursor: pointer;
    color: white;
    height: 40px;
    padding: 0 20px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0);
}

.new-chat-button:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.new-chat-button svg {
    width: 16px;
    height: 16px;
}

.chat-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.message {
    max-width: 75%;
    padding: 16px 18px;
    border-radius: 16px;
    font-size: 15px;
    line-height: 1.9;
    letter-spacing: 0.3px;
    position: relative;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    opacity: 0;
    transform: translateY(10px);
    animation: fadeInMessage 0.5s forwards;
}

/* Initial greeting animation with delay */
.initial-greeting {
    opacity: 0;
    animation: fadeInMessage 0.8s forwards;
    animation-delay: 0.5s;
}

/* New animation for fade-in message */
@keyframes fadeInMessage {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

.bot-message {
    align-self: flex-start;
    background-color: #F3F4F6;
    color: #262a32;
    border-bottom-left-radius: 4px;
}

.user-message {
    align-self: flex-end;
    background-color: #C2A877;
    color: white;
    border-bottom-right-radius: 4px;
}

.loading {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 16px 18px;
    background-color: #F3F4F6;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    align-self: flex-start;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.dot {
    width: 10px;
    height: 10px;
    background-color: #9CA3AF;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.dot:nth-child(2) {
    animation-delay: 0.2s;
}

.dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

.suggestions-section {
    padding: 24px;
    padding-bottom: 6px;
    opacity: 1;
    transition: all 0.4s ease;
    max-height: 280px;
    overflow: hidden;
}

.suggestions-section.hidden {
    opacity: 0;
    max-height: 0;
    padding: 0;
    margin: 0;
    pointer-events: none;
}

/* Progressive Animations for Suggestions */
.suggestions-title {
    font-size: 16px;
    font-weight: 600;
    color: #4B5563;
    margin-bottom: 16px;
    position: relative;
    padding-bottom: 16px;
    text-align: center;
    opacity: 0;
    animation: fadeInTitle 1s forwards;
    animation-delay: 1s;
}

@keyframes fadeInTitle {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

.suggestions-title:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background: linear-gradient(
        to right,
        rgba(229, 231, 235, 0) 0%,
        rgba(229, 231, 235, 1) 25%,
        rgba(229, 231, 235, 1) 75%,
        rgba(229, 231, 235, 0) 100%
    );
    animation: growLine 0.8s forwards;
    animation-delay: 1.2s;
}

@keyframes growLine {
    0% { width: 0; }
    100% { width: 100%; }
}

.suggestion-tiles {
    display: flex;
    gap: 16px;
    margin-bottom: 18px;
}

.suggestion-tile {
    flex: 1;
    padding: 34px;
    background-color: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    min-height: 160px;
    opacity: 0;
    transform: translateY(15px);
}

.suggestion-tile:nth-child(1) {
    animation: fadeInTile 0.6s forwards;
    animation-delay: 1.7s;
}

.suggestion-tile:nth-child(2) {
    animation: fadeInTile 0.6s forwards;
    animation-delay: 1.9s;
}

.suggestion-tile:nth-child(3) {
    animation: fadeInTile 0.6s forwards;
    animation-delay: 2.1s;
}

@keyframes fadeInTile {
    0% { opacity: 0; transform: translateY(15px); }
    100% { opacity: 1; transform: translateY(0); }
}

.suggestion-tile h4 {
    margin-bottom: 12px;
    color: #4B5563;
    font-weight: 600;
    font-size: 16px;
    position: relative;
    padding-bottom: 14px;
}

.suggestion-tile h4:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 1px;
    background-color: #C2A877;
    border-radius: 2px;
}

.suggestion-tile p {
    color: #6B7280;
    line-height: 1.7;
    font-size: 14px;
    margin-top: 2px;
}

.suggestion-tile:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    border-color: #C2A877;
}

/* Input wrapper + campo testo + pulsante invio */
.chat-input-area {
    padding: 15px !important;
    border-top: 1px solid #E5E7EB !important;
    display: flex !important;
    align-items: center !important;
    gap: 16px !important;
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.05) !important;
}

.chat-input-wrapper {
    position: relative !important;
    flex: 1 !important;
}

.chat-input {
    width: 100% !important;
    padding: 16px 20px !important;
    padding-right: 55px !important;
    background-color: #F3F4F6 !important;
    border: 1px solid #E5E7EB !important;
    border-radius: 30px !important;
    font-size: 15px !important;
    outline: none !important;
    transition: border-color 0.3s ease, box-shadow 0.3s ease !important;
}

.chat-input:focus {
    border-color: #C2A877 !important;
    box-shadow: 0 0 12px rgba(194, 168, 119, 0.25) !important;
}

.send-button {
    position: absolute !important;
    right: 10px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background-color: #C2A877 !important;
    border: none !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    cursor: pointer !important;
    transition: background-color 0.3s ease, transform 0.3s ease !important;
    box-shadow: 0 2px 6px rgba(194, 168, 119, 0.3) !important;
}

.send-button:hover {
    background-color: #B09966 !important;
    transform: translateY(-50%) scale(1.05) !important;
}

.send-icon {
    width: 18px !important;
    height: 18px !important;
    fill: white !important;
}
