@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #3730a3;
    --bg-light: #f9fafb;
    --bg-dark: #111827;
    --text-light: #1f2937;
    --text-dark: #f3f4f6;
    --chat-bg-light: #ffffff;
    --chat-bg-dark: #1f2937;
    --message-bg-light: #f3f4f6;
    --message-bg-dark: #374151;
    --border-radius: 16px;
    --shadow-light: 0 10px 30px -5px rgba(0, 0, 0, 0.1);
    --shadow-dark: 0 10px 30px -5px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
    transition: background-color 0.3s, color 0.3s, transform 0.2s, box-shadow 0.2s;
}

body {
    background-color: var(--bg-light);
    color: var(--text-light);
    line-height: 1.6;
    min-height: 100vh;
    background-image: 
        radial-gradient(at 100% 0%, rgba(99, 102, 241, 0.1) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(55, 48, 163, 0.1) 0px, transparent 50%);
}

body[data-theme="dark"] {
    background-color: var(--bg-dark);
    color: var(--text-dark);
    background-image: 
        radial-gradient(at 100% 0%, rgba(99, 102, 241, 0.05) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(55, 48, 163, 0.05) 0px, transparent 50%);
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    gap: 2rem;
}

header {
    text-align: center;
    padding: 2.5rem 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    color: var(--text-dark);
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1) 0%, transparent 100%);
    pointer-events: none;
}

header h1 {
    margin-bottom: 1rem;
    font-size: 2.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    letter-spacing: -0.5px;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

.chat-container {
    flex: 1;
    background-color: var(--chat-bg-light);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(229, 231, 235, 0.5);
}

body[data-theme="dark"] .chat-container {
    background-color: var(--chat-bg-dark);
    box-shadow: var(--shadow-dark);
    border-color: rgba(55, 65, 81, 0.5);
}

#chat-messages {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-height: 600px;
    scroll-behavior: smooth;
}

.message {
    display: flex;
    margin-bottom: 1rem;
    opacity: 0;
    transform: translateY(20px);
    animation: messageAppear 0.3s ease-out forwards;
}

@keyframes messageAppear {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-content {
    padding: 1.2rem 1.5rem;
    border-radius: 18px;
    max-width: 80%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    position: relative;
}

.user .message-content {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.bot .message-content {
    background-color: var(--message-bg-light);
    color: var(--text-light);
    border-bottom-left-radius: 4px;
    border-left: 4px solid var(--primary-color);
}

body[data-theme="dark"] .bot .message-content {
    background-color: var(--message-bg-dark);
    color: var(--text-dark);
}

.input-area {
    padding: 1.5rem;
    background-color: var(--chat-bg-light);
    border-top: 1px solid rgba(229, 231, 235, 0.5);
    position: relative;
}

body[data-theme="dark"] .input-area {
    background-color: var(--chat-bg-dark);
    border-top-color: rgba(55, 65, 81, 0.5);
}

#chat-form {
    display: flex;
    gap: 1rem;
    position: relative;
}

#user-input {
    flex: 1;
    padding: 1.2rem 1.5rem;
    border: 2px solid rgba(229, 231, 235, 0.8);
    border-radius: 30px;
    outline: none;
    font-size: 1rem;
    background-color: var(--chat-bg-light);
    color: var(--text-light);
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

body[data-theme="dark"] #user-input {
    background-color: var(--message-bg-dark);
    border-color: rgba(55, 65, 81, 0.8);
    color: var(--text-dark);
}

#user-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

button {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    border: none;
    border-radius: 30px;
    padding: 1.2rem 2rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.2);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 8px -1px rgba(99, 102, 241, 0.3);
}

button:active {
    transform: translateY(1px);
}

#theme-toggle {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    padding: 0.8rem;
    border-radius: 50%;
    font-size: 1.2rem;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

#theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(15deg);
}

.article-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.article-item {
    background: rgba(99, 102, 241, 0.05);
    padding: 1.2rem;
    border-radius: 12px;
    border-left: 4px solid var(--primary-color);
    transition: all 0.2s ease;
}

.article-item:hover {
    transform: translateX(5px);
    background: rgba(99, 102, 241, 0.1);
}

.article-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.8rem;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    background: rgba(99, 102, 241, 0.1);
    transition: all 0.2s ease;
}

.article-link:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.loading {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: var(--primary-color);
    font-weight: 500;
}

.loading::after {
    content: "";
    width: 20px;
    height: 20px;
    border: 3px solid rgba(99, 102, 241, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

footer {
    text-align: center;
    padding: 2rem;
    background-color: var(--chat-bg-light);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(229, 231, 235, 0.5);
}

body[data-theme="dark"] footer {
    background-color: var(--chat-bg-dark);
    box-shadow: var(--shadow-dark);
    border-color: rgba(55, 65, 81, 0.5);
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
        gap: 1.5rem;
    }

    header {
        padding: 2rem 1.5rem;
    }

    header h1 {
        font-size: 2rem;
    }

    .message-content {
        max-width: 90%;
    }

    #chat-form {
        gap: 0.8rem;
    }

    button {
        padding: 1rem 1.5rem;
    }
}

@media (max-width: 576px) {
    header h1 {
        font-size: 1.8rem;
    }

    #chat-form {
        flex-direction: column;
    }

    button {
        width: 100%;
        justify-content: center;
    }

    .message-content {
        max-width: 95%;
        padding: 1rem 1.2rem;
    }
}