.ngen-container {
    width: 100%;
    max-width: 60rem;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Greeting State Styles */
.ngen-greeting {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.ngen-greeting-content {
    text-align: center;
    width: 100%;
}

.ngen-greeting-title {
    font-family: 'Roboto Condensed', sans-serif;
    font-weight: bold;
    font-size: 3rem;
    color: var(--ast-global-color-3, #324b6b);
    margin-bottom: 1rem;
}

.ngen-greeting-subtitle {
    font-size: 1.25rem;
    color: var(--ast-global-color-1, #555659);
    margin-bottom: 3rem;
}

.ngen-input-wrapper {
    position: relative;
    max-width: 40rem;
    margin: 0 auto;
}

.ngen-input {
    width: 100%;
    padding: 1rem 4rem 1rem 1.5rem;
    font-size: 1rem;
    border: 2px solid var(--ast-global-color-5, #e6e7e8);
    border-radius: 2rem;
    outline: none;
    transition: border-color 0.3s ease;
    font-family: 'Roboto Condensed', sans-serif;
}

.ngen-input:focus {
    border-color: var(--ast-global-color-3, #324b6b);
}

.ngen-submit-btn {
    position: absolute;
    right: 2.25rem;
    top: 50%;
    transform: translateY(-50%);
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: none;
    background-color: var(--ast-global-color-3, #324b6b);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

.ngen-submit-btn:hover {
    background-color: var(--ast-global-color-2, #F5821F);
}

.ngen-submit-btn:disabled {
    background-color: var(--ast-global-color-4, #8d8d8d);
    cursor: not-allowed;
}

/* Chat State Styles */
.ngen-chat {
    display: flex;
    flex-direction: column;
    border-radius: 0.5rem;
    height: 70vh;
    max-height: 70vh;
}

.ngen-chat-wrapper {
    display: flex;
    flex: 1;
    gap: 10px;
    min-height: 0;
}

.ngen-chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.ngen-chat-sidebar {
    width: 20rem;
    display: flex;
    flex-direction: column;
    height: 60vh;
    position: sticky; /* Activates the sticky behavior */
    top: 167px;       /* Where it should stick (20px from the top) */

    /* --- THE FLEXBOX FIX --- */
    align-self: flex-start; /* CRITICAL FIX for sticky inside flex container */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    border-radius: 5px;
}

.ngen-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 1rem;
}

.ngen-sidebar-empty {
    text-align: center;
    color: var(--ast-global-color-4, #8d8d8d);
    font-style: italic;
    padding: 2rem 1rem;
}

.ngen-source-item {
    background-color: white;
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.ngen-source-item:hover {
    border-color: var(--ast-global-color-3, #324b6b);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ngen-source-thumbnail {
    width: 100%;
    aspect-ratio: 16/9;
    background-color: var(--ast-global-color-5, #e6e7e8);
    border-radius: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
    overflow: hidden;
    position: relative;
}

.ngen-source-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ngen-source-thumbnail i {
    font-size: 2rem;
    color: var(--ast-global-color-4, #8d8d8d);
}

.ngen-source-title {
    font-size: 0.875rem;
    font-weight: bold;
    color: var(--ast-global-color-1, #555659);
    margin-bottom: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ngen-source-meta {
    font-size: 0.75rem;
    color: var(--ast-global-color-4, #8d8d8d);
}

.ngen-source-item.loading {
    opacity: 0.6;
    cursor: wait;
    pointer-events: none;
}

.ngen-source-item.loading .ngen-source-thumbnail::after {
    content: '';
    position: absolute;
    width: 2rem;
    height: 2rem;
    border: 3px solid var(--ast-global-color-5, #e6e7e8);
    border-top: 3px solid var(--ast-global-color-3, #324b6b);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.ngen-source-item .ngen-loading-text {
    display: none;
    font-size: 0.75rem;
    color: var(--ast-global-color-3, #324b6b);
    font-style: italic;
    margin-top: 0.25rem;
}

.ngen-source-item.loading .ngen-loading-text {
    display: block;
}

.ngen-source-download-icon {
    color: var(--ast-global-color-4, #8d8d8d);
    margin-left: 0.5rem;
    font-size: 0.75rem;
}

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

.ngen-chat-header {
    background-color: var(--ast-global-color-3, #324b6b);
    color: white;
    padding: 1rem 1.5rem;
}

.ngen-chat-title {
    margin: 0;
    font-family: 'Roboto Condensed', sans-serif;
    font-weight: bold;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ngen-chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background-color: white;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-height: 0;
}

.ngen-message {
    display: flex;
    width: 100%;
    animation: messageSlideIn 0.3s ease-out;
}

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

.ngen-message-content {
    display: flex;
    gap: 1rem;
    max-width: 80%;
}

.ngen-message-user .ngen-message-content {
    margin-left: auto;
    flex-direction: row-reverse;
}

.ngen-message-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.25rem;
}

.ngen-message-user .ngen-message-avatar {
    background-color: var(--ast-global-color-6, #CCE6F4);
    color: var(--ast-global-color-3, #324b6b);
}

.ngen-message-assistant .ngen-message-avatar {
    background-color: var(--ast-global-color-3, #324b6b);
    color: white;
}

.ngen-message-text {
    padding: 1rem 1.25rem;
    border-radius: 1rem;
    font-size: 1rem;
    line-height: 1.5;
}

.ngen-message-user .ngen-message-text {
    background-color: var(--ast-global-color-6, #CCE6F4);
    color: var(--ast-global-color-3, #324b6b);
}

.ngen-message-assistant .ngen-message-text {
    color: var(--ast-global-color-1, #555659);
}

.ngen-chat-input-wrapper {
    position: relative;
    padding: 1rem 1.5rem;
    background-color: white;
    border-top: 1px solid var(--ast-global-color-5, #e6e7e8);
    flex-shrink: 0;
}

.ngen-chat-input {
    padding: 0.875rem 4rem 0.875rem 1.5rem;
    border-radius: 1.5rem;
}

.ngen-loading-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--ast-global-color-4, #8d8d8d);
    font-style: italic;
}

.ngen-loading-dots {
    display: inline-flex;
    gap: 0.25rem;
}

.ngen-loading-dots span {
    width: 0.5rem;
    height: 0.5rem;
    background-color: var(--ast-global-color-4, #8d8d8d);
    border-radius: 50%;
    animation: loadingDot 1.4s infinite ease-in-out both;
}

.ngen-loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.ngen-loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes loadingDot {
    0%, 80%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    40% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .ngen-greeting-title {
        font-size: 2rem;
    }

    .ngen-greeting-subtitle {
        font-size: 1rem;
    }

    .ngen-chat {
        height: 70vh;
    }

    .ngen-message-content {
        max-width: 90%;
    }

    .ngen-chat-wrapper {
        flex-direction: column;
    }

    .ngen-chat-sidebar {
        width: 100%;
        max-height: 40%;
        border-left: none;
        border-top: 1px solid var(--ast-global-color-5, #e6e7e8);
    }
}