* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --jamesway-blue: #0057B7;
    --jamesway-yellow: #FFD700;
    --blue-dark: #00479E;
    --blue-light: #E6F0FF;
    --yellow-light: #FFF9E6;
    --gray-light: #f7fafc;
    --gray-border: #e2e8f0;
    --text-dark: #2d3748;
    --text-light: #4a5568;
    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --gradient-primary: linear-gradient(135deg, var(--jamesway-blue) 0%, var(--blue-dark) 100%);
    --gradient-yellow: linear-gradient(135deg, var(--jamesway-yellow) 0%, #FFC400 100%);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gradient-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    margin: 0 auto;
    background: white;
    box-shadow: var(--shadow-xl);
    position: relative;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: white;
    border-bottom: 1px solid var(--gray-border);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--gradient-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    box-shadow: var(--shadow-md);
}

.logo-text h1 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.2;
}

.logo-text span {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 500;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.clear-chat-btn {
    background: transparent;
    color: var(--text-light);
    border: 1px solid var(--gray-border);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.clear-chat-btn:hover {
    color: var(--error);
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.05);
}

.contact-btn {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
}

.contact-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Main Chat Area */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 80px);
    position: relative;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    padding-bottom: 1rem;
    scroll-behavior: smooth;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-light);
    animation: fadeInUp 0.8s ease;
}

.welcome-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    animation: bounce 2s infinite;
}

.welcome-message h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-message p {
    font-size: 1.2rem;
    opacity: 0.8;
    max-width: 500px;
    margin: 0 auto;
}

/* Messages */
.message {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    animation: fadeInUp 0.4s ease;
}

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

.message-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
    transition: transform 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.message:hover .message-avatar {
    transform: scale(1.05);
}

.user-avatar {
    background: var(--gradient-primary);
    color: white;
}

.bot-avatar {
    background: var(--gradient-yellow);
    color: var(--text-dark);
}

.message-content {
    max-width: 75%;
    animation: messageSlide 0.3s ease;
}

.user-message .message-content {
    text-align: right;
}

.message-text {
    padding: 1.25rem 1.5rem;
    border-radius: 18px;
    line-height: 1.6;
    word-wrap: break-word;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    position: relative;
}

.user-message .message-text {
    background: var(--gradient-primary);
    color: white;
    border-bottom-right-radius: 6px;
    box-shadow: var(--shadow-md);
}

.bot-message .message-text {
    background: var(--blue-light);
    color: var(--text-dark);
    border: 1px solid var(--gray-border);
    border-bottom-left-radius: 6px;
}

.message.streaming .message-text::after {
    content: '▊';
    animation: blink 1s infinite;
    margin-left: 2px;
    color: var(--jamesway-blue);
    font-weight: bold;
}

.message-time {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 0.5rem;
    opacity: 0.7;
}

.user-message .message-time {
    text-align: right;
}

/* Examples Section */
.examples-section {
    padding: 1rem 2rem 0;
    animation: fadeIn 0.6s ease 0.3s both;
}

.section-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.example-questions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.example-btn {
    padding: 1.25rem 1.5rem;
    background: var(--yellow-light);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 14px;
    color: var(--text-dark);
    font-size: 0.95rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s ease;
    word-break: break-word;
    position: relative;
    overflow: hidden;
    font-weight: 500;
}

.example-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s;
}

.example-btn:hover {
    background: var(--jamesway-yellow);
    border-color: var(--jamesway-yellow);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.example-btn:hover::before {
    left: 100%;
}

/* Input Section */
.input-section {
    padding: 1.5rem 2rem 2rem;
    background: white;
    border-top: 1px solid var(--gray-border);
    position: relative;
}

.input-container {
    max-width: 800px;
    margin: 0 auto;
}

.input-wrapper {
    position: relative;
    border: 2px solid var(--gray-border);
    border-radius: 16px;
    background: var(--gray-light);
    transition: all 0.3s ease;
    padding: 0.75rem;
}

.input-wrapper:focus-within {
    border-color: var(--jamesway-blue);
    background: white;
    box-shadow: 0 0 0 4px rgba(0, 87, 183, 0.1);
    transform: translateY(-1px);
}

#question-input {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 1rem;
    resize: none;
    font-family: 'Inter', sans-serif;
    outline: none;
    color: var(--text-dark);
}

.input-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.5rem;
}

.word-counter {
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 500;
}

.word-counter.warning {
    color: var(--warning);
}

.word-counter.error {
    color: var(--error);
}

.send-btn {
    background: var(--gradient-primary);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.send-btn:hover:not(:disabled) {
    transform: translateY(-2px) scale(1.05);
    box-shadow: var(--shadow-lg);
}

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

.input-hint {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.disclaimer {
    color: var(--jamesway-blue);
    font-weight: 600;
}

.input-hint a {
    color: var(--jamesway-blue);
    text-decoration: none;
    font-weight: 500;
}

.input-hint a:hover {
    text-decoration: underline;
}

/* Loading Bar */
.loading-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--gradient-primary);
    z-index: 1000;
    transition: width 0.4s ease;
    opacity: 0;
}

.loading-bar.active {
    opacity: 1;
    width: 70%;
}

.loading-bar.complete {
    width: 100%;
    opacity: 0;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
    padding: 1rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 20px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid var(--gray-border);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 2rem 1.5rem;
    border-bottom: 1px solid var(--gray-border);
    background: linear-gradient(135deg, var(--blue-light), white);
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.75rem;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-modal:hover {
    color: var(--jamesway-blue);
    background: var(--gray-light);
}

.modal-body {
    padding: 2rem;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.feature-item {
    text-align: center;
    padding: 1.5rem;
    border-radius: 12px;
    background: var(--gray-light);
    border: 1px solid var(--gray-border);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.feature-item h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.feature-item p {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.5;
}

.modal-footer {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-border);
}

.modal-footer p {
    margin-bottom: 0.5rem;
}

.modal-footer strong {
    color: var(--text-dark);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-30px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        height: 100vh;
        height: 100dvh;
    }
    
    .chat-area {
        height: calc(100vh - 80px);
        height: calc(100dvh - 80px);
    }
    
    .app-header {
        padding: 1rem 1.25rem;
    }
    
    .logo-text h1 {
        font-size: 1.1rem;
    }
    
    .logo-text span {
        font-size: 0.8rem;
    }
    
    .chat-messages {
        padding: 1.25rem;
        padding-bottom: 0.5rem;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .input-section {
        padding: 1rem 1.25rem 1.5rem;
    }
    
    .welcome-message {
        padding: 3rem 1rem;
    }
    
    .welcome-icon {
        font-size: 3rem;
    }
    
    .example-questions {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        margin: 0.5rem;
        width: calc(100% - 1rem);
    }
    
    .modal-body {
        padding: 1.5rem;
    }
    
    .feature-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .input-hint {
        flex-direction: column;
        gap: 0.25rem;
    }
}

@media (max-width: 480px) {
    .message-content {
        max-width: 90%;
    }
    
    .logo-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    .logo-text h1 {
        font-size: 1rem;
    }
    
    .header-controls {
        gap: 0.5rem;
    }
    
    .contact-btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    .clear-chat-btn {
        width: 36px;
        height: 36px;
    }
    
    .message-text {
        padding: 1rem 1.25rem;
    }
    
    .examples-section {
        padding: 0.75rem 1.25rem 0;
    }
    
    .example-btn {
        padding: 1rem 1.25rem;
    }
}