/**
 * Contact Page Aiesha Integration Styles
 *
 * Styles for the AI-powered contact form assistant.
 */

/* ==========================================================================
   Layout
   ========================================================================== */

.contact-layout {
    display: flex;
    justify-content: center;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem 0 1rem;
}

.aiesha-side {
    flex: 0 1 600px;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.aiesha-side.collapsed {
    flex: 0 1 400px;
    opacity: 0.7;
}

.form-card {
    flex: 0 1 500px;
    background: var(--color-surface, #111);
    border: 1px solid var(--color-border, #2a2a2a);
    border-radius: 12px;
    padding: 2rem;
}

.form-card h3 {
    margin: 0 0 1.5rem 0;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.5rem;
    color: var(--color-text, #fff);
}

/* When only form is shown (Aiesha hidden), center it */
.contact-layout .form-card:only-child,
.contact-layout .aiesha-side[style*="display: none"] + .form-card {
    margin: 0 auto;
}

/* ==========================================================================
   Aiesha Introduction
   ========================================================================== */

.aiesha-intro {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #1a1a1a 0%, #222 100%);
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.aiesha-avatar-large {
    width: 80px;
    height: auto;
    border-radius: 50%;
    flex-shrink: 0;
}

.aiesha-intro-text h2 {
    margin: 0 0 0.5rem 0;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.5rem;
    color: #ff6b2c;
}

.aiesha-intro-text p {
    margin: 0;
    color: #a0a0a0;
    font-size: 0.95rem;
}

/* ==========================================================================
   Department Selection (Aiesha side)
   ========================================================================== */

.department-selection {
    transition: all 0.3s ease;
}

.department-selection.collapsed {
    opacity: 0.5;
    pointer-events: none;
    max-height: 0;
    overflow: hidden;
    margin-bottom: 0;
}

.department-selection .department-cards {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.department-selection .department-card {
    position: relative;
}

.department-selection .department-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.department-selection .department-card label {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: #1a1a1a;
    border: 2px solid #2a2a2a;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.department-selection .department-card label:hover {
    border-color: #ff6b2c;
    background: #222;
}

.department-selection .department-card input:checked + label {
    border-color: #ff6b2c;
    background: rgba(255, 107, 44, 0.1);
}

.department-selection .department-card .icon {
    font-size: 1.5rem;
    width: 40px;
    text-align: center;
}

.department-selection .department-card .name {
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}

.department-selection .department-card .desc {
    color: #666;
    font-size: 0.85rem;
    margin-left: auto;
}

/* ==========================================================================
   Chat Section
   ========================================================================== */

.chat-section {
    background: #111;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    height: 450px;
    overflow: hidden;
}

.aiesha-messages {
    flex: 1 1 0;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 0; /* Required for flex child scrolling */
    max-height: 100%; /* Constrain to parent */
}

.aiesha-message {
    display: flex;
    animation: messageSlideIn 0.3s ease;
    flex-shrink: 0; /* Prevent messages from collapsing - allows scroll */
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.aiesha-message.user {
    justify-content: flex-end;
}

.aiesha-message-content {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.aiesha-message.assistant {
    justify-content: flex-start;
}

.aiesha-message.assistant .aiesha-message-content {
    background: #1a1a1a;
    color: #e0e0e0;
    border-bottom-left-radius: 4px;
    width: 100%;
}

.aiesha-message.user .aiesha-message-content {
    background: linear-gradient(135deg, #ff6b2c 0%, #ff8f5a 100%);
    color: #0a0a0a;
    border-bottom-right-radius: 4px;
    max-width: 85%;
}

.aiesha-message-content a {
    color: #ff6b2c;
    text-decoration: underline;
}

/* Loading animation */
.aiesha-message.loading .aiesha-message-content {
    display: flex;
    gap: 4px;
    padding: 1rem 1.25rem;
}

.aiesha-dot {
    width: 8px;
    height: 8px;
    background: #ff6b2c;
    border-radius: 50%;
    animation: dotBounce 1.4s infinite ease-in-out both;
}

.aiesha-dot:nth-child(1) { animation-delay: -0.32s; }
.aiesha-dot:nth-child(2) { animation-delay: -0.16s; }

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

/* Sources */
.aiesha-sources {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #2a2a2a;
}

.aiesha-sources-label {
    font-size: 0.65rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.aiesha-source-link {
    display: inline-block;
    font-size: 0.7rem;
    color: #ff6b2c;
    padding: 2px 6px;
    background: rgba(255, 107, 44, 0.1);
    border-radius: 4px;
    margin-right: 4px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.aiesha-source-link:hover {
    background: rgba(255, 107, 44, 0.2);
}

/* Feedback */
.aiesha-feedback {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #2a2a2a;
}

.aiesha-feedback-label {
    font-size: 0.7rem;
    color: #666;
}

.aiesha-feedback-btn {
    background: none;
    border: 1px solid #2a2a2a;
    border-radius: 4px;
    padding: 2px 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    color: #666;
}

.aiesha-feedback-btn:hover {
    border-color: #ff6b2c;
    background: rgba(255, 107, 44, 0.1);
}

.aiesha-feedback-btn.selected {
    border-color: #ff6b2c;
    background: rgba(255, 107, 44, 0.2);
    color: #ff6b2c;
}

.aiesha-feedback-thanks {
    font-size: 0.7rem;
    color: #27ae60;
}

/* ==========================================================================
   Input Area
   ========================================================================== */

.aiesha-input-area {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    border-top: 1px solid #2a2a2a;
    background: #0a0a0a;
    flex-shrink: 0; /* Don't shrink - let messages area scroll */
}

.aiesha-input-area textarea {
    flex: 1;
    padding: 0.75rem 1rem;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    color: #fff;
    font-size: 0.9rem;
    resize: none;
    font-family: inherit;
    line-height: 1.4;
}

.aiesha-input-area textarea:focus {
    outline: none;
    border-color: #ff6b2c;
}

.aiesha-send-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #ff6b2c 0%, #ff8f5a 100%);
    border: none;
    border-radius: 8px;
    color: #0a0a0a;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.aiesha-send-btn:hover {
    background: linear-gradient(135deg, #d45520 0%, #ff6b2c 100%);
}

.aiesha-send-btn:disabled {
    background: #333;
    cursor: not-allowed;
}

/* ==========================================================================
   Escalation Section
   ========================================================================== */

.escalation-section {
    padding: 1rem;
    background: #1a1a1a;
    border-top: 1px solid #2a2a2a;
    text-align: center;
    animation: fadeIn 0.3s ease;
    flex-shrink: 0; /* Don't shrink - let messages area scroll */
}

.escalation-section.soft {
    background: transparent;
    padding: 0.75rem;
}

.escalation-section.soft .escalation-prompt {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.escalation-prompt {
    font-size: 0.85rem;
    color: #a0a0a0;
    margin: 0 0 0.75rem 0;
}

.escalation-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

/* ==========================================================================
   Skip to Form Button
   ========================================================================== */

.skip-link {
    text-align: center;
    margin-top: 1rem;
    margin-bottom: 2rem;
}

/* ==========================================================================
   Form Card (small department cards)
   ========================================================================== */

.department-cards-small {
    display: flex;
    gap: 0.5rem;
}

.department-cards-small .department-card label {
    flex-direction: column;
    align-items: center;
    padding: 0.75rem;
    gap: 0.25rem;
}

.department-cards-small .department-card .icon {
    font-size: 1.25rem;
}

.department-cards-small .department-card .name {
    font-size: 0.8rem;
}

/* ==========================================================================
   Mobile Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .contact-layout {
        flex-direction: column;
    }

    .aiesha-side,
    .form-card {
        max-width: 100%;
    }

    .aiesha-side.collapsed {
        max-width: 100%;
        opacity: 1;
    }

    .aiesha-intro {
        flex-direction: column;
        text-align: center;
    }

    .department-selection .department-card .desc {
        display: none;
    }

    .escalation-buttons {
        flex-direction: column;
    }

    .escalation-buttons .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .aiesha-avatar-large {
        width: 60px;
    }

    .aiesha-intro-text h2 {
        font-size: 1.25rem;
    }

    .chat-section {
        min-height: 300px;
    }

    .department-cards-small {
        flex-wrap: wrap;
    }

    .department-cards-small .department-card {
        flex: 1 1 45%;
    }
}
