/* Hero Animation Styles */
/* Force Light Mode Variables locally for the container scope */
.ha-container {
    --ha-bg: #ffffff;
    --ha-sidebar-bg: #f9f9f9;
    --ha-border: #e5e5e5;
    --ha-text: #0d0d0d;
    --ha-text-secondary: #666666;
    --ha-primary: #0083ff;
    --ha-primary-hover: #006ecc;
    --ha-bubble-user: #f3f3f3;
    --ha-bubble-ai: transparent;
    --ha-font-family: 'Inter', sans-serif;
    --ha-radius: 12px;
    --ha-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    --ha-cursor-size: 24px;
    display: flex;
    /* Sidebar + Main Content */
    overflow: hidden;
    font-family: var(--ha-font-family);
    position: relative;
    font-size: 14px;
    line-height: 1.5;
    color: var(--ha-text);
    height: 600px;
    /* Fixed height for consistent animation space */
    border: 1px solid var(--ha-border);
    /* Add border to container */
    border-radius: 12px;
    /* Match design system */
}

/* Sidebar */
.ha-sidebar {
    width: 260px;
    background: var(--ha-sidebar-bg);
    border-right: 1px solid var(--ha-border);
    display: flex;
    flex-direction: column;
    padding: 1rem;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .ha-sidebar {
        display: none;
        /* Hide sidebar on mobile to prevent overflow */
    }

    /* Reduce horizontal padding on mobile */
    .ha-chat-scroll {
        padding: 1rem 12px 5rem !important;
        /* increased bottom padding so input doesn't cover */
    }

    .ha-input-area {
        padding: 0 12px 16px !important;
    }

    /* Center popover on mobile */
    .ha-popover {
        left: 0 !important;
        right: 0 !important;
        margin: 0 auto;
        bottom: 70px;
    }
}

.ha-new-chat-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--ha-bg);
    border: 1px solid var(--ha-border);
    border-radius: 6px;
    cursor: pointer;
    color: var(--ha-text);
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 20px;
    transition: background 0.2s;
}

.ha-new-chat-btn:hover {
    background: var(--ha-border);
}

.ha-sidebar-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ha-sidebar-item {
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--ha-text-secondary);
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ha-sidebar-item.active {
    background: rgba(0, 0, 0, 0.05);
    color: var(--ha-text);
}

/* Main Chat Area */
.ha-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background: var(--ha-bg);
}

.ha-chat-scroll {
    flex: 1;
    padding: 1.5rem 15% 3rem;
    /* Reduced top/bottom padding */
    /* Center the content */
    overflow-y: hidden;
    /* Programmatic scroll */
    display: flex;
    flex-direction: column;
    gap: 16px;
    /* Reduced from 24px */
}

.ha-message {
    display: flex;
    gap: 16px;
    width: 100%;
}

/* User messages aligned to the right */
.ha-message.user-message {
    justify-content: flex-end;
}

.ha-message.user-message .ha-message-content {
    background: #f4f4f4;
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 70%;
    text-align: left;
    /* Ensure left alignment */
}

/* AI messages aligned to the left (default) */
.ha-message.ai-message {
    justify-content: flex-start;
}

.ha-avatar {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    /* ChatGPT style */
    background: #ccc;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    font-size: 12px;
    color: #fff;
    font-weight: bold;
}

.ha-avatar.user {
    background: #7c7c7c;
}

.ha-avatar.ai {
    background: #10a37f;
}

.ha-message-content {
    flex: 1;
    padding-top: 4px;
    font-size: 15px;
    white-space: pre-wrap;
    /* Preserve formatting */
    line-height: 1.5;
    /* Tighter line height */
}

/* Input Area */
.ha-input-area {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to bottom, transparent, var(--ha-bg) 20%);
    padding: 0 15% 30px;
}

.ha-input-box {
    width: 100%;
    border: 1px solid var(--ha-border);
    border-radius: 12px;
    background: var(--ha-bg);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    transition: border-color 0.2s;
    align-items: stretch;
    /* Revert to stretch so bottom row is full width */
}

.ha-input-box.focused {
    border-color: #8e8ea0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Input Text Alignment */
.ha-input-text {
    min-height: 24px;
    color: var(--ha-text);
    outline: none;
    font-size: 15px;
    white-space: pre-wrap;
    position: relative;
    text-align: left;
    width: 100%;
    /* Ensure full width for alignment */
}

/* Typing cursor */
.ha-caret {
    display: inline-block;
    width: 2px;
    height: 1.2em;
    background: #000;
    vertical-align: text-bottom;
    animation: bg-blink 1s step-end infinite;
}

@keyframes bg-blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

.ha-input-bottom-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    /* Slight spacing */
    width: 100%;
    /* Ensure full width for space-between to work */
}

/* Segmented Button Group */
.ha-upscale-group {
    display: flex;
    align-items: stretch;
    background: #2b2b2b;
    border-radius: 8px;
    padding: 0;
    overflow: hidden;
    height: 36px;
    /* Slightly taller */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.ha-ug-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    color: #fff;
    padding: 0 16px;
    transition: filter 0.2s;
    height: 100%;
    flex-shrink: 0;
    white-space: nowrap;
}

.ha-ug-upscale {
    background: #0083ff;
    color: white;
    font-weight: 600;
    padding-right: 18px;
    padding-right: 18px;
    gap: 6px;
}

@keyframes sweep-shine {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.ha-ug-upscale {
    background: #0083ff;
    color: white;
    font-weight: 600;
    padding-right: 18px;
    gap: 6px;
    position: relative;
    overflow: hidden;
    /* For shine effect */
}

/* Shine effect overlay */
.ha-ug-upscale::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transform: translateX(-100%);
    pointer-events: none;
}

.ha-ug-upscale.processing::after {
    animation: sweep-shine 0.5s ease-in-out;
}

/* Remove old pulse animation rule if present */
/* .ha-ug-upscale.processing { animation: ... } */

.ha-ug-sparkle {
    display: inline-block;
    font-size: 15px;
    line-height: 1;
    transform: translateY(-1px);
}

.ha-ug-upscale:hover {
    filter: brightness(1.1);
}

.ha-ug-menu {
    background: transparent;
    color: #aeaeae;
    padding: 0 12px;
}

.ha-ug-menu:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.ha-ug-style {
    background: transparent;
    color: #fff;
    gap: 6px;
    padding-left: 12px;
}

.ha-ug-style:hover {
    background: rgba(255, 255, 255, 0.05);
}

.ha-ug-divider {
    width: 1px;
    background: #444;
    height: 100%;
}

.ha-input-actions {

    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
}

.ha-icon-btn {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: grid;
    place-items: center;
    color: #acacbe;
    cursor: pointer;
    transition: all 0.2s;
}

.ha-icon-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--ha-text);
}

.ha-send-btn {
    background: #19c37d;
    /* Inactive grey usually, but let's keep it colorful for visual pop */
    color: white;
    border-radius: 6px;
    padding: 4px 8px;
    transition: opacity 0.2s;
}

.ha-send-btn.disabled {
    background: #e5e5e5;
    color: #fff;
    pointer-events: none;
}

.ha-send-btn.active {
    background: #19c37d;
    color: white;
}

/* Stylevant Button (Overlaid) */
.ha-stylevant-trigger {
    width: 24px;
    height: 24px;
    padding: 2px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ha-stylevant-trigger:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.ha-stylevant-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}


/* Popover */
.ha-popover {
    position: absolute;
    bottom: 60px;
    /* Above input box */
    left: 16%;
    width: 280px;
    background: #fff;
    border: 1px solid var(--ha-border);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    padding: 8px;
    z-index: 10;
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.165, 0.84, 0.44, 1);
    display: flex;
    flex-direction: column;
}

.ha-popover.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.ha-popover-item {
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--ha-text);
    transition: background 0.15s;
}

.ha-popover-item:hover,
.ha-popover-item.active {
    background: #f0f0f0;
}

.ha-popover-header {
    border-bottom: 1px solid #eee;
    padding-bottom: 4px;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 12px;
    color: #999;
    padding-left: 12px;
    text-transform: uppercase;
}

/* Cursor Simulation */
.ha-cursor {
    position: absolute;
    top: 0;
    left: 0;
    width: 24px;
    height: 24px;
    pointer-events: none;
    z-index: 9999;
    transform: translate(0, 0);
    transition: transform 0.65s cubic-bezier(0.19, 1, 0.22, 1);
    /* Natural movement */
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.2));
}

.ha-cursor svg {
    width: 100%;
    height: 100%;
    fill: #000;
    stroke: #fff;
    stroke-width: 1.5px;
    transition: transform 0.15s ease;
}

.ha-cursor.click svg {
    transform: scale(0.8) rotate(-12deg);
}


/* Email Form Response Style */
.ha-email-response {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px 16px 8px 16px;
    /* Added 8px top padding */
    font-family: Arial, sans-serif;
    color: #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-top: 8px;
    animation: fadeUp 0.5s ease-out;
    text-align: left;
    white-space: normal;
    /* Collapse newlines from template string */
}

.ha-email-header {
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 4px;
    /* Reduced from 6px */
    margin-bottom: 4px;
    /* Reduced from 6px */
    display: flex;
    justify-content: space-between;
    text-align: left;
}

.ha-email-response p {
    margin: 0;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ha-email-subject {
    font-weight: bold;
    font-size: 16px;
    color: #000;
}

.ha-highlight {
    background: #e6f3ff;
    padding: 0 2px;
    border-radius: 2px;
    color: #0066cc;
    font-weight: 500;
}

/* Compact email paragraphs */
.ha-email-response p {
    margin: 4px 0 8px 0;
    /* Tighter top margin */
    line-height: 1.4;
    /* Comfortable line height within paragraphs */
    text-align: left;
}

.ha-email-response p:first-of-type {
    margin-top: 0;
}

.ha-email-response p:last-child {
    margin-bottom: 0;
    /* No margin on last paragraph */
}