/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1e3a5f;
    --primary-dark: #0f2537;
    --primary-light: #2d4a6b;
    --secondary-color: #4a5568;
    --success-color: #047857;
    --warning-color: #b45309;
    --error-color: #b91c1c;
    --bg-color: #f5f7fa;
    --card-bg: #ffffff;
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --border-color: #cbd5e0;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius: 8px;
    --radius-sm: 6px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #e8edf2;
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.7;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
}

/* Screen Management */
.screen {
    display: none;
    min-height: 100vh;
    padding: 1rem 0;
    animation: fadeIn 0.5s ease-in-out;
}

.screen.active {
    display: block;
}

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

/* Welcome Screen */
.welcome-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 2rem 3rem;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
}

.logo-container {
    margin-bottom: 1.5rem;
    text-align: center;
    padding-bottom: 1.25rem;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.header-logo {
    width: 100px;
    height: auto;
    object-fit: contain;
    margin-bottom: 0.25rem;
}

.tagline {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0;
    letter-spacing: 0.5px;
}

.subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.welcome-message {
    text-align: left;
    margin-top: 1.5rem;
}

.welcome-message h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.3;
    text-align: left;
}

.welcome-message p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin-bottom: 0.875rem;
    line-height: 1.6;
    text-align: left;
    max-width: 100%;
}

.info-box {
    background: var(--bg-color);
    border-left: 4px solid var(--primary-color);
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: var(--radius-sm);
    text-align: left;
    border-right: 1px solid var(--border-color);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.info-box h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    font-weight: 600;
    text-align: left;
}

.info-box ul {
    list-style: none;
    padding-left: 0;
    text-align: left;
}

.info-box li {
    padding: 0.375rem 0;
    padding-left: 1.75rem;
    position: relative;
    color: var(--text-secondary);
    line-height: 1.5;
    text-align: left;
    font-size: 0.9375rem;
}

.info-box li::before {
    content: "•";
    position: absolute;
    left: 0.75rem;
    color: var(--primary-color);
    font-weight: bold;
    font-size: 1.25rem;
}

/* Form Styles */
.form-container {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem 2.5rem;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
}

.form-container .logo-container {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
}

.form-header {
    text-align: left;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.form-header h2 {
    font-size: 1.375rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 600;
    text-align: left;
    line-height: 1.3;
}

.form-header p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    text-align: left;
    line-height: 1.5;
}

.form-group {
    margin-bottom: 1.25rem;
    text-align: left;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-size: 0.875rem;
    text-align: left;
    letter-spacing: 0.01em;
}

.required {
    color: var(--error-color);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-family: inherit;
    transition: var(--transition);
    background: var(--card-bg);
    color: var(--text-primary);
    text-align: left;
    line-height: 1.5;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.form-group input::placeholder {
    color: var(--text-secondary);
}

/* Searchable Select */
.searchable-select-wrapper {
    position: relative;
    width: 100%;
}

.searchable-select {
    position: relative;
    width: 100%;
}

.select-trigger {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-family: inherit;
    transition: var(--transition);
    background: var(--card-bg);
    color: var(--text-primary);
    text-align: left;
    line-height: 1.5;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.select-trigger:hover {
    border-color: var(--primary-color);
}

.select-trigger.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.select-placeholder {
    color: var(--text-secondary);
    flex: 1;
    text-align: left;
}

.select-trigger.has-value .select-placeholder {
    color: var(--text-primary);
}

.select-arrow {
    color: var(--text-secondary);
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.select-trigger.active .select-arrow {
    transform: rotate(180deg);
}

.select-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: none;
    max-height: 300px;
    overflow: hidden;
    flex-direction: column;
}

.select-dropdown.active {
    display: flex;
}

.select-search {
    position: relative;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.select-search input {
    width: 100%;
    padding: 0.625rem 2.5rem 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-family: inherit;
    background: var(--bg-color);
    color: var(--text-primary);
    transition: var(--transition);
}

.select-search input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(30, 64, 175, 0.1);
}

.search-icon {
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

.select-options {
    max-height: 250px;
    overflow-y: auto;
    padding: 0.25rem;
}

.select-option {
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    text-align: left;
}

.select-option:hover {
    background: var(--bg-color);
    color: var(--primary-color);
}

.select-option.selected {
    background: rgba(30, 58, 95, 0.1);
    color: var(--primary-color);
    font-weight: 500;
}

.select-option.hidden {
    display: none;
}

.select-options-empty {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Custom scrollbar for select options */
.select-options::-webkit-scrollbar {
    width: 6px;
}

.select-options::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 3px;
}

.select-options::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.select-options::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
}

/* Buttons */
.btn {
    padding: 0.75rem 1.75rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
    text-decoration: none;
    letter-spacing: 0.01em;
    text-align: center;
    justify-content: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: 1px solid var(--primary-color);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-link {
    background: none;
    color: var(--primary-color);
    padding: 0.5rem 1rem;
    text-decoration: underline;
}

.btn-link:hover {
    color: var(--primary-dark);
}

.icon {
    font-size: 1.2rem;
}

/* Assessment Screen */
.assessment-layout {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.assessment-main {
    flex: 1;
    min-width: 0;
}

.assessment-container {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 3rem 3.5rem;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
}

.assessment-header {
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.progress-section {
    margin-bottom: 1.25rem;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: var(--bg-color);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border-color);
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 5px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-align: left;
    letter-spacing: 0.01em;
}

.topic-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--bg-color);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    color: var(--primary-color);
    font-weight: 500;
    margin-top: 0.75rem;
    border: 1px solid var(--border-color);
    text-align: left;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.question-container {
    margin-bottom: 2.5rem;
}

.question-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.question-header h2 {
    font-size: 1.375rem;
    line-height: 1.6;
    color: var(--text-primary);
    font-weight: 600;
    text-align: left;
    letter-spacing: -0.01em;
}

.answer-container {
    margin-bottom: 1.75rem;
    text-align: left;
}

.answer-container label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    font-size: 0.9375rem;
    text-align: left;
    letter-spacing: 0.01em;
}

#answer-textarea {
    width: 100%;
    padding: 1.125rem 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    font-family: inherit;
    resize: vertical;
    min-height: 220px;
    transition: var(--transition);
    background: var(--card-bg);
    color: var(--text-primary);
    line-height: 1.7;
    text-align: left;
}

#answer-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.char-count {
    text-align: right;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 0.625rem;
    font-weight: 400;
}

.question-actions {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

/* Question Sidebar */
.question-sidebar {
    width: 320px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 4rem);
    position: sticky;
    top: 2rem;
    transition: var(--transition);
}

.question-sidebar.collapsed {
    width: 60px;
}

.question-sidebar.collapsed .sidebar-content {
    display: none;
}

.question-sidebar.collapsed .sidebar-header h3 {
    display: none;
}

.sidebar-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-color);
    border-radius: var(--radius) var(--radius) 0 0;
}

.sidebar-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    text-align: left;
}

.sidebar-toggle {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    padding: 0;
}

.sidebar-toggle:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.question-sidebar.collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
}

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

.sidebar-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.stat-item {
    text-align: center;
    padding: 0.75rem;
    background: var(--bg-color);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.stat-value.answered {
    color: var(--success-color);
}

.stat-value.remaining {
    color: var(--warning-color);
}

.question-list-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.question-item {
    padding: 0.875rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.875rem;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.question-item:hover {
    border-color: var(--primary-color);
    background: rgba(30, 58, 95, 0.05);
    transform: translateX(2px);
}

.question-item.answered {
    background: rgba(4, 120, 87, 0.08);
    border-color: var(--success-color);
    border-left-width: 3px;
}

.question-item.answered::before {
    content: "✓";
    position: absolute;
    left: 0.5rem;
    color: var(--success-color);
    font-weight: bold;
    font-size: 0.875rem;
}

.question-item.current {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    font-weight: 600;
}

.question-item.current::before {
    content: "→";
    position: absolute;
    left: 0.5rem;
    color: white;
    font-weight: bold;
}

.question-item-number {
    font-weight: 500;
    margin-right: 0.5rem;
}

.question-item.answered .question-item-number {
    color: var(--success-color);
}

.question-item.current .question-item-number {
    color: white;
}

.question-item-topic {
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.7;
    margin-top: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.question-item.current .question-item-topic {
    color: rgba(255, 255, 255, 0.9);
}

.question-item-content {
    flex: 1;
    min-width: 0;
}

/* Thank You Screen */
.thankyou-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 4rem 3.5rem;
    box-shadow: var(--shadow-xl);
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    border: 1px solid var(--border-color);
}

.success-icon {
    margin-bottom: 2.5rem;
}

.thankyou-content h2 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-weight: 600;
    text-align: center;
    line-height: 1.4;
}

.thankyou-content > p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    line-height: 1.8;
    text-align: center;
    max-width: 100%;
}

.thankyou-info {
    background: var(--bg-color);
    border-left: 4px solid var(--success-color);
    padding: 2rem;
    margin: 2.5rem 0;
    border-radius: var(--radius-sm);
    text-align: left;
    border-right: 1px solid var(--border-color);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.thankyou-info p {
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
    font-size: 1rem;
    text-align: left;
}

.thankyou-info ul {
    list-style: none;
    padding-left: 0;
    text-align: left;
}

.thankyou-info li {
    padding: 0.625rem 0;
    padding-left: 2rem;
    position: relative;
    color: var(--text-secondary);
    line-height: 1.7;
    text-align: left;
}

.thankyou-info li::before {
    content: "•";
    position: absolute;
    left: 0.75rem;
    color: var(--success-color);
    font-weight: bold;
    font-size: 1.25rem;
}

.thankyou-actions {
    margin-top: 2.5rem;
    color: var(--text-secondary);
    text-align: center;
    font-size: 0.9375rem;
    line-height: 1.7;
}

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

.loading-overlay.hidden {
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay p {
    font-size: 1.1rem;
    margin-top: 1rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .assessment-layout {
        flex-direction: column;
    }

    .question-sidebar {
        width: 100%;
        max-height: 400px;
        position: relative;
        top: 0;
    }

    .question-sidebar.collapsed {
        width: 100%;
    }

    .question-sidebar.collapsed .sidebar-content {
        display: none;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1.5rem 1rem;
    }

    .welcome-content,
    .form-container,
    .assessment-container,
    .thankyou-content {
        padding: 2rem 1.5rem;
    }

    .header-logo {
        width: 100px;
    }

    .tagline {
        font-size: 1.125rem;
    }

    .welcome-message h2,
    .form-header h2,
    .thankyou-content h2 {
        font-size: 1.5rem;
    }

    .question-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .form-actions .btn {
        width: 100%;
    }

    .question-sidebar {
        width: 100%;
        max-height: 350px;
    }

    .sidebar-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }

    .stat-item {
        padding: 0.5rem;
    }

    .stat-value {
        font-size: 1.125rem;
    }
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.question-container {
    animation: slideIn 0.3s ease-out;
}

/* AI Assistant Chat Widget */
.ai-assistant {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
    font-family: inherit;
    display: none;
}

.ai-chat-toggle {
    width: 60px;
    height: 60px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    position: relative;
    border: 2px solid white;
    padding: 0.5rem;
    overflow: hidden;
}

.ai-logo-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

.ai-chat-toggle:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
    box-shadow: var(--shadow-xl);
}

.ai-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--success-color);
    color: white;
    font-size: 0.5rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    border: 2px solid white;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    white-space: nowrap;
    line-height: 1.2;
    max-width: 90px;
    text-overflow: ellipsis;
    overflow: hidden;
}

.ai-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 400px;
    max-height: 600px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

.ai-chat-window.hidden {
    display: none;
}

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

.ai-chat-header {
    padding: 1rem 1.25rem;
    background: var(--primary-color);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-chat-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.9375rem;
}

.ai-logo-small {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 4px;
}

.ai-chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
    line-height: 1;
}

.ai-chat-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 450px;
}

.ai-message {
    display: flex;
    gap: 0.75rem;
    animation: fadeIn 0.3s ease-out;
}

.ai-message-user {
    flex-direction: row-reverse;
}

.ai-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
    overflow: hidden;
    background: var(--primary-color);
    color: white;
}

.ai-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
    padding: 0.25rem;
}

.ai-message-assistant .ai-message-avatar {
    background: var(--primary-color);
    color: white;
}

.ai-message-user .ai-message-avatar {
    background: var(--bg-color);
    color: var(--primary-color);
    border: 1px solid var(--border-color);
}

.ai-message-user .ai-message-avatar .ai-avatar-img {
    display: none;
}

.ai-message-content {
    flex: 1;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    line-height: 1.6;
    text-align: left;
}

.ai-message-assistant .ai-message-content {
    background: var(--bg-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.ai-message-user .ai-message-content {
    background: var(--primary-color);
    color: white;
}

.ai-message-content p {
    margin: 0 0 0.5rem 0;
    text-align: left;
}

.ai-message-content p:last-child {
    margin-bottom: 0;
}

.ai-message-content ul {
    margin: 0.5rem 0;
    padding-left: 1.25rem;
    text-align: left;
}

.ai-message-content li {
    margin: 0.25rem 0;
    text-align: left;
}

.ai-message-content ol {
    margin: 0.5rem 0;
    padding-left: 1.25rem;
    text-align: left;
}

.ai-message-content h3,
.ai-message-content h4,
.ai-message-content h5,
.ai-message-content h6 {
    margin: 0 0 0.5rem 0;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.2px;
}

.ai-message-content h3 {
    font-size: 1.1rem;
}

.ai-message-content h4 {
    font-size: 1rem;
}

.ai-message-content h5,
.ai-message-content h6 {
    font-size: 0.9375rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.ai-message-content hr.ai-divider {
    border: none;
    border-top: 1px dashed var(--border-color);
    margin: 1rem 0;
}

.ai-message-content blockquote {
    margin: 0.75rem 0;
    padding: 0.75rem 1rem;
    border-left: 4px solid var(--primary-color);
    background: rgba(30, 58, 95, 0.05);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
}

.ai-message-content blockquote p {
    margin: 0.25rem 0;
}

.ai-message-content code {
    background: rgba(30, 58, 95, 0.08);
    border-radius: 4px;
    padding: 0.15rem 0.35rem;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.8rem;
    color: var(--primary-color);
}

.ai-message-content pre {
    background: rgba(30, 58, 95, 0.08);
    border-radius: 6px;
    padding: 0.85rem 1rem;
    overflow-x: auto;
    margin: 0.75rem 0;
    border: 1px solid rgba(30, 58, 95, 0.15);
}

.ai-message-content pre code {
    display: block;
    white-space: pre-wrap;
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--text-primary);
}

.ai-message-loading {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
}

.ai-message-loading span {
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

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

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

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

.ai-chat-input-container {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: var(--bg-color);
}

.ai-chat-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

.ai-chat-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-family: inherit;
    line-height: 1.5;
    min-height: 3rem;
    max-height: 220px;
    resize: vertical;
    transition: var(--transition);
    background: var(--card-bg);
    color: var(--text-primary);
}

.ai-chat-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

.ai-chat-send {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.ai-chat-send:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.ai-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-chat-footer {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: left;
}

.ai-chat-footer a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
}

.ai-chat-footer a:hover {
    text-decoration: underline;
}

/* Responsive AI Chat */
@media (max-width: 768px) {
    .ai-assistant {
        bottom: 1rem;
        right: 1rem;
    }

    .ai-chat-window {
        width: calc(100vw - 2rem);
        max-width: 400px;
        bottom: 70px;
        right: 0;
    }

    .ai-chat-toggle {
        width: 56px;
        height: 56px;
    }
}

