/* Chat container styles */
.chat-container {
    position: fixed;
    bottom: 8rem;
    right: 1rem;
    width: 320px;
    height: 590px; /* Decreased by 10px */
    background-color: white;
    border-radius: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 15;
    transform: scale(0);
    opacity: 0;
    transform-origin: bottom right;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.chat-container.open {
    transform: scale(1);
    opacity: 1;
}

.chat-header {
    background: linear-gradient(135deg, #3B82F6, #8B5CF6);
    color: white;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.chat-header button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.2rem;
    transition: transform 0.3s ease, opacity 0.2s ease;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-header button:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.chat-header button:active {
    opacity: 0.7;
}

.chat-content {
    flex: 1;
    overflow: hidden;
}

.chat-content iframe {
    border: none;
    height: 100%;
}

body.dark-mode .chat-container {
    background-color: #1f2937;
    color: #e5e7eb;
}

/* Dark mode adjustments for chat header */
body.dark-mode .chat-header {
    background: linear-gradient(135deg, #1E40AF, #6D28D9);
    color: #f9fafb;
}

body.dark-mode .chat-input {
    border-top: 1px solid #374151;
}

@media (max-width: 768px) {
    /* chat-button position handled in chat-button-style.css */

    .chat-container {
        bottom: 4rem; /* Adjusted to match button bottom position */
        width: 95vw;
        max-width: 400px;
        height: 80vh;
        max-height: 690px; /* Decreased by 10px */
        right: 0.75rem;
    }

    /* Adjust chat container size when open on mobile */
    .chat-container.open {
        width: 90vw;
        max-width: 350px;
        height: 70vh;
        max-height: 590px; /* Decreased by 10px */
    }
}

@media (max-width: 480px) {
    /* chat-button position handled in chat-button-style.css */

    .chat-container {
        bottom: 4rem; /* Adjusted to match button bottom position */
        width: 95vw;
        max-width: 320px;
        height: 85vh;
        max-height: 740px; /* Decreased by 10px */
        right: 0.5rem;
    }

    .chat-header h3 {
        font-size: 0.9rem;
        letter-spacing: 0.3px;
    }
}

@media (max-width: 360px) {
     /* chat-button position handled in chat-button-style.css */

    .chat-container {
        bottom: 4rem; /* Adjusted to match button bottom position */
        width: 95vw;
        max-width: 300px;
        height: 90vh;
        max-height: 790px; /* Decreased by 10px */
        right: 0.5rem;
    }

    .chat-header h3 {
        font-size: 0.9rem;
        letter-spacing: 0.2px;
    }
}

@media (max-height: 700px) {
    .chat-container {
        height: 75vh;
        max-height: 490px; /* Decreased by 10px */
    }
}

@media (max-height: 600px) {
    .chat-container {
        height: 80vh;
        max-height: 440px; /* Decreased by 10px */
    }
}

/* Portrait orientation adjustments */
@media (max-width: 480px) and (orientation: portrait) {
    /* chat-button position handled in chat-button-style.css */

    .chat-container {
        bottom: 4rem; /* Adjusted to match button bottom position */
    }
}

/* Desktop horizontal center chat layout */
@media (min-width: 1024px) {
    .chat-container {
        bottom: 60%;
        right: 50%;
        transform: translate(50%, 50%) scale(0);
        width: 600px;
        height: 440px; /* Decreased by 10px */
        transform-origin: center;
    }

    .chat-container.open {
        transform: translate(50%, 50%) scale(1);
    }

    .chat-content {
        display: flex;
        justify-content: center;
    }

    .chat-content iframe {
        width: 100%;
    }
}