/* styles/hub-assistant.css */

/* --- 1. Main Card --- */
.chat-wrap {
    display: flex;
    flex-direction: column;
    height: 700px; /* Nice and tall */
    max-height: 85vh;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

/* --- 2. Header (Gold & Black) --- */
.chat__title {
    background: #fff;
    padding: 1rem 1.5rem;
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #000;
    border-bottom: 2px solid #b08a48; /* Brand Gold Underline */
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Ensure the FontAwesome icon is Gold */
.chat__title i {
    color: #b08a48;
    margin-right: 0.5rem;
}

/* --- 3. Messages Area --- */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background-color: #fafafa;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    scroll-behavior: smooth;
}

/* --- 4. Message Cards --- */
.msg {
    background: #ffffff;
    padding: 1.25rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    border: 1px solid #f0f0f0;
    border-left-width: 4px;
    animation: fadeIn 0.3s ease-in-out;
}

/* USER: Gold Border */
.msg--user { border-left-color: #b08a48; }
.msg--user .msg__who { color: #b08a48; }

/* AI: Black Border */
.msg--ai { border-left-color: #000; }
.msg--ai .msg__who { color: #000; }

.msg__who {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.msg__text {
    font-size: 1rem;
    line-height: 1.6;
    color: #333;
}
.msg__text strong { color: #000; font-weight: 700; }
.msg__text ul { padding-left: 1.2rem; margin-bottom: 0.5rem; }

/* --- 5. Input Area (NEW STACKED LAYOUT) --- */
.chat-form {
    padding: 1.25rem;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    
    /* ✅ KEY CHANGE: Wrap elements so buttons drop to next line */
    display: flex;
    flex-wrap: wrap; 
    gap: 10px; /* Space between rows */
}

/* THE INPUT BOX */
.chat-input {
    /* ✅ KEY CHANGE: Force 100% width on its own row */
    flex: 1 1 100%; 
    width: 100%;
    
    border: 1px solid #ced4da;
    border-radius: 8px;
    padding: 1rem;
    font-family: inherit;
    font-size: 1rem; /* 16px prevents iOS zoom */
    
    /* ✅ KEY CHANGE: Much taller by default */
    min-height: 120px; 
    
    resize: vertical;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-input:focus {
    border-color: #b08a48;
    box-shadow: 0 0 0 3px rgba(176, 138, 72, 0.15);
}

/* --- 6. Buttons (Gold Primary) --- */
.chat-btn {
    height: 50px; /* Good touch target size */
    padding: 0 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* Ensure buttons don't stretch weirdly */
    flex: 0 0 auto; 
}

/* Push buttons to the right side of the second row */
/* This selects the microphone button (usually the first button after textarea) */
.chat-form > button:first-of-type {
    margin-left: auto; 
}

/* SEND Button */
#chatSend {
    background-color: #b08a48; 
    color: #fff;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    min-width: 100px; /* Ensure it looks substantial */
}
#chatSend:hover {
    background-color: #9a773f;
    transform: translateY(-1px);
}
#chatSend:disabled {
    background-color: #e0e0e0;
    cursor: not-allowed;
    transform: none;
}

/* MIC Button */
#hubChatRecord {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    color: #000; 
    min-width: 50px; /* Minimum square size */
    width: auto;     /* Allow expansion for "Stop Recording" text */
    font-size: 1.2rem;
    padding: 0 1rem;
}
#hubChatRecord:hover {
    border-color: #b08a48;
    color: #b08a48;
}
#hubChatRecord.recording {
    background-color: #dc3545;
    color: #fff;
    border-color: #dc3545;
    animation: pulse 1.5s infinite;
}

/* --- Animations --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(220, 53, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}

/* Mobile Tweaks */
@media (max-width: 600px) {
    .chat-wrap {
        height: 100%; 
        border-radius: 0;
        border: none;
        box-shadow: none;
    }
    /* Buttons span full width on very small screens for easier tapping */
    .chat-btn {
        flex: 1; 
        justify-content: center;
    }
    .chat-form > button:first-of-type {
        margin-left: 0; /* Reset the "push right" so they fill the row */
    }
}