/* Complete chat_interface.css extracted from working version */

/* 1) Force full-height, no body scroll */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden; /* Only .chat-history scrolls */
}

body {
    display: flex;
    flex-direction: column;
    font-family: 'Raleway', sans-serif;
    background: linear-gradient(120deg, #84fab0, #8fd3f4);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Container for chat content */
.content-container {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    overflow: hidden;
    box-sizing: border-box;
    padding-bottom: 80px;
}

/* iPhone frame (desktop or large screen) */
.iphone-frame {
    display: flex;
    flex-direction: column;
    width: 400px;
    height: calc(100vh - 140px);
    max-height: 700px;
    background-color: #fff;
    border-radius: 30px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 
                0 10px 20px rgba(0, 0, 0, 0.1);
}

/* iPhone status bar */
.iphone-status-bar {
    width: 100%;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
    font-size: 0.8em;
    background-color: #fff;
    padding: 10px 0 0 20px;
    font-weight: bold;
}

/* Chat container */
.chat-container {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 20px;
    box-sizing: border-box;
    min-height: 0;
}

.chat-box {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    border-radius: 10px;
    min-height: 0;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.chat-header .title {
    font-size: 2em;
    color: #1fb270;
}

.chat-header .title .lemonflow {
    font-weight: 600;
}

.chat-header .title .ai {
    font-weight: 450;
}

.connection-indicator {
    font-size: 0.8em;
    font-weight: bold;
    text-align: center;
    color: #fff;
    background-color: red;
    padding: 3px 6px;
    border-radius: 5px;
    white-space: nowrap;
}

.connection-indicator.connected {
    background-color: #1fb270;
}

.connection-indicator.disconnected {
    color: #ccc;
}

.chat-history {
    flex: 1 1 0;
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 10px;
    margin-bottom: 10px;
    background-color: #f5f5f5;
    overflow-y: auto;
    min-height: 0;
}

.input-container {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

input[type="text"] {
    flex: 1 1 0%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1em;
    font-family: Raleway, sans-serif;
}

button {
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    font-family: Raleway, sans-serif;
}

button.green {
    background-color: #1fb270;
    color: white;
}

button.green:disabled {
    background-color: #ccc;
    color: #666;
    cursor: not-allowed;
}

/* Chat messages */
.chat-message-user {
    margin-bottom: 20px;
}

.chat-message-user .chat-label {
    font-weight: bold;
    color: #555;
    margin-right: 6px;
}

.chat-message-user .chat-text {
    color: #666;
}

.chat-message-assistant {
    margin-bottom: 20px;
}

.chat-message-assistant .chat-label {
    font-weight: bold;
    color: #1fb270;
    margin-right: 6px;
}

.chat-message-assistant .chat-text {
    color: #000;
}

.chat-message-system {
    margin-bottom: 8px;
    text-align: center;
}

.chat-message-system .chat-text {
    color: #999;
    font-size: 0.85em;
    opacity: 0.8;
}

/* Phone link styling */
.phone-link {
    color: #1fb270;
    font-weight: bold;
    text-decoration: none;
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid #1fb270;
    display: inline-block;
    margin: 0 4px;
    white-space: nowrap;
}

.phone-link:hover {
    background-color: rgba(31, 178, 112, 0.1);
}

/* Thinking indicator */
.thinking-indicator {
    display: inline-block;
    margin-left: 4px;
    font-size: 0.8em;
    line-height: 1;
    vertical-align: middle;
}

.pulsing-circle {
    color: #1fb270;
    opacity: 0;
    transform: translateZ(0);
    will-change: opacity, transform;
}

.pulsing-circle.animate {
    animation: pulse 0.8s ease-in-out infinite;
}

@media screen and (min-width: 769px) {
    .chat-message-assistant .chat-text {
        transform: translateZ(0);
    }
}

@keyframes pulse {
    0% {
        opacity: 0;
        transform: scale(0.6);
    }
    50% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.6);
    }
}

/* Escalation banner */
.escalation-banner {
    position: fixed;
    top: -50px;
    left: 0;
    width: 100%;
    background-color: #fedc0b;
    color: black;
    font-weight: bold;
    text-align: center;
    padding: 10px;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: top 0.5s, opacity 0.5s;
    opacity: 0;
}

.escalation-banner.visible {
    top: 0;
    opacity: 1;
}

/* Height-based responsive adjustments */
@media (min-height: 900px) {
    .content-container {
        padding-bottom: 100px;
    }
    .iphone-frame {
        height: 80vh;
        max-height: 800px;
    }
}

@media (min-height: 700px) and (max-height: 899px) {
    .content-container {
        padding-bottom: 90px;
    }
}

/* Mobile styles */
@media (max-width: 768px) {
    html, body {
        height: 100%;
        width: 100%;
        overflow: hidden;
        position: fixed;
        top: 0;
        left: 0;
        background: none !important;
    }

    .content-container {
        height: 50vh;
        width: 100%;
        justify-content: flex-start;
        align-items: flex-start;
        gap: 0;
        padding-bottom: 0;
    }

    .iphone-frame {
        width: 100%;
        height: 50vh;
        max-height: none;
        border-radius: 0;
        box-shadow: none;
        position: relative;
        overflow: hidden;
    }

    .chat-container {
        height: 100%;
        width: 100%;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        padding: 10px;
        box-sizing: border-box;
    }

    .chat-history {
        flex: 1 1 0%;
        height: calc(50vh - 90px);
        overflow-y: auto;
        background-color: #f5f5f5;
    }

    body.keyboard-open {
        position: fixed;
        top: 0;
        width: 100%;
    }

    .input-container {
        display: flex;
        gap: 10px;
        flex-shrink: 0;
        padding: 10px 0;
        background: white;
        width: 100%;
    }

    footer {
        display: none !important;
    }
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner {
    border: 16px solid #1fb270;
    border-top: 16px solid #f3f3f3;
    border-right: 16px solid #f3f3f3;
    border-bottom: 16px solid #f3f3f3;
    border-radius: 50%;
    width: 120px;
    height: 120px;
    animation: spin 2s linear infinite;
}

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

/* Feedback button container */
.feedback-button-container {
    display: flex;
    justify-content: center;
    padding: 20px;
    gap: 12px;
    flex-wrap: wrap;
}

.feedback-button {
    background: #1fb270;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
    min-width: 220px;
}

.feedback-button:hover {
    background: #18945d;
    box-shadow: 0 4px 12px rgba(31, 178, 112, 0.25);
    transform: translateY(-1px);
}

.feedback-button i {
    font-size: 16px;
}

.feedback-button.hub-button {
    background: #6c757d;
}

.feedback-button.hub-button:hover {
    background: #5a6268;
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.25);
}

.hub-text .lemonflow {
    font-weight: 600;
}

.hub-text .hub {
    font-weight: 450;
}

/* Footer styling */
footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: transparent;
    color: white;
    text-align: center;
    padding: 10px 20px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

footer img {
    height: 56px;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

footer p {
    margin: 0;
    font-size: 12px;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

footer .lemonflow-text {
    font-weight: 600;
}

footer .lemonflow-text .lemonflow {
    font-weight: 600;
}

footer .lemonflow-text .ai {
    font-weight: 400;
}