body {
    font-family: 'Roboto', sans-serif;
    background: #f4f6fb;
    color: #222b45;
    min-height: 100vh;
    margin: 0;
    transition: background 0.4s, color 0.4s;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: url('https://www.transparenttextures.com/patterns/cubes.png'), linear-gradient(120deg, #e0e7ef 0%, #f4f6fb 100%);
    opacity: 0.18;
    z-index: 0;
    pointer-events: none;
}

section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1rem;
    z-index: 1;
}

.chat-card {
    border-radius: 18px;
    box-shadow: 0 4px 24px 0 rgba(34, 43, 69, 0.08);
    background: #fff;
    border: none;
    width: 100%;
    max-width: 820px;
    overflow: hidden;
    transition: box-shadow 0.3s;
    z-index: 2;
}

.card-header {
    background: #2563eb;
    color: #fff;
    border-bottom: 1px solid #e0e7ef;
    border-radius: 18px 18px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px 0 rgba(37,99,235,0.08);
}

.gradient-heading {
    background: none;
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px #1e293b33;
}

.card-body {
    background: #f4f6fb;
    height: 420px;
    overflow-y: auto;
    padding: 1.2rem;
    transition: background 0.4s;
    scrollbar-width: thin;
    scrollbar-color: #2563eb #e0e7ef;
}
.card-body::-webkit-scrollbar {
    width: 8px;
}
.card-body::-webkit-scrollbar-thumb {
    background: #2563eb;
    border-radius: 8px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 0.7rem;
    border: 2px solid #2563eb22;
    background: #e0e7ef;
}

.message-container {
    margin-bottom: 1.1rem;
    display: flex;
    align-items: flex-start;
    animation: fadeInUp 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.user-message {
    background: #2563eb;
    color: #fff;
    border-radius: 1.2rem 1.2rem 0.2rem 1.2rem;
    padding: 0.7rem 1.1rem;
    max-width: 70%;
    word-wrap: break-word;
    font-size: 1.05rem;
    box-shadow: 0 2px 8px #2563eb22;
    transition: background 0.3s, color 0.3s;
}

.user-message:hover {
    background: #1746a2;
}

.ai-message {
    background: #e0e7ef;
    color: #222b45;
    border-radius: 1.2rem 1.2rem 1.2rem 0.2rem;
    padding: 0.7rem 1.1rem;
    max-width: 70%;
    word-wrap: break-word;
    font-size: 1.05rem;
    box-shadow: 0 2px 8px #2563eb11;
    border: 1.5px solid #e0e7ef;
    transition: background 0.3s, color 0.3s;
}

.ai-message:hover {
    background: #c7d2fe;
}

.message-time {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 0.25rem;
    text-shadow: none;
}

.card-footer {
    background: #fff;
    border-top: 1px solid #e0e7ef;
    border-radius: 0 0 18px 18px;
    padding: 1rem;
    display: flex;
    align-items: center;
    box-shadow: 0 -2px 8px 0 rgba(37,99,235,0.04);
}

.form-control {
    border-radius: 32px;
    border: 1.5px solid #e0e7ef;
    padding: 0.7rem 1.1rem;
    flex-grow: 1;
    margin-right: 0.7rem;
    background: #f4f6fb;
    color: #222b45;
    font-size: 1.08rem;
    box-shadow: none;
    transition: border 0.3s, box-shadow 0.3s, background 0.3s, color 0.3s;
}
.form-control:focus {
    border: 1.5px solid #2563eb;
    box-shadow: 0 0 0 2px #2563eb33;
    background: #fff;
    outline: none;
    color: #222b45;
}
.form-control::placeholder {
    color: #94a3b8;
    opacity: 1;
}

.btn-primary {
    background: #2563eb;
    border: none;
    border-radius: 32px;
    padding: 0.7rem 1.5rem;
    font-size: 1.08rem;
    font-weight: 600;
    box-shadow: 0 2px 8px #2563eb22;
    transition: background 0.3s, box-shadow 0.3s, transform 0.2s;
    text-shadow: none;
    color: #fff;
}
.btn-primary:hover, .btn-primary:focus {
    background: #1746a2;
    box-shadow: 0 4px 16px #2563eb33;
    transform: translateY(-2px) scale(1.04);
}
.btn-primary:focus-visible {
    outline: 2.5px solid #2563eb;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px #2563eb33, 0 4px 16px #2563eb33;
}

.social-links {
    display: flex;
    gap: 1.2rem;
}
.social-links a {
    color: #fff;
    text-decoration: none;
    transition: color 0.3s;
    text-shadow: none;
}
.social-links a:hover {
    color: #c7d2fe;
}
.links {
    padding-right: 10px;
}

#darkModeToggle {
    background: #e0e7ef !important;
    color: #2563eb !important;
    border: none;
    transition: background 0.3s, color 0.3s;
}
#darkModeToggle:active {
    background: #c7d2fe !important;
}
#darkModeIcon {
    transition: color 0.3s;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 40px, 0);
    }
    to {
        opacity: 1;
        transform: none;
    }
}
.d-flex.flex-row {
    animation: fadeInUp 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

/* Responsive Design */
@media (max-width: 900px) {
    .chat-card {
        max-width: 98vw;
    }
}
@media (max-width: 768px) {
    .chat-card {
        margin: 0.5rem;
    }
    .card-body {
        height: 320px;
    }
    .avatar {
        width: 32px;
        height: 32px;
    }
    .user-message,
    .ai-message {
        max-width: 90%;
        font-size: 0.98rem;
    }
    .social-links {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}
@media (max-width: 600px) {
    .chat-card {
        max-width: 100vw;
        margin: 0.2rem;
        border-radius: 12px;
    }
    .card-header, .card-footer {
        border-radius: 12px 12px 0 0;
        padding: 0.6rem;
    }
    .card-footer {
        border-radius: 0 0 12px 12px;
    }
    .card-body {
        height: 220px;
        padding: 0.6rem;
    }
    .avatar {
        width: 26px;
        height: 26px;
        margin-right: 0.4rem;
    }
    .user-message, .ai-message {
        max-width: 98vw;
        font-size: 0.92rem;
        padding: 0.4rem 0.7rem;
    }
    .form-control {
        font-size: 0.95rem;
        padding: 0.4rem 0.7rem;
        margin-right: 0.3rem;
    }
    .btn-primary {
        font-size: 0.95rem;
        padding: 0.4rem 0.9rem;
    }
    .social-links {
        gap: 0.3rem;
    }
    .gradient-heading {
        font-size: 1.1rem;
    }
}

/* DARK MODE */
body.dark-mode {
    background: #181c2b;
    color: #e0e6ed;
}
body.dark-mode::before {
    background: url('https://www.transparenttextures.com/patterns/cubes.png'), linear-gradient(120deg, #232946 0%, #181c2b 100%);
    opacity: 0.13;
}
body.dark-mode .chat-card {
    background: #232946;
    box-shadow: 0 8px 32px 0 rgba(30, 34, 54, 0.18);
}
body.dark-mode .card-header {
    background: #1746a2;
    color: #fff;
    box-shadow: 0 2px 8px 0 rgba(23,70,162,0.08);
}
body.dark-mode .gradient-heading {
    color: #fff;
    text-shadow: 0 1px 2px #1e293b33;
}
body.dark-mode .card-body {
    background: #181c2b;
    scrollbar-color: #c7d2fe #232946;
}
body.dark-mode .user-message {
    background: #2563eb;
    color: #fff;
    box-shadow: 0 2px 8px #2563eb22;
}
body.dark-mode .user-message:hover {
    background: #1746a2;
}
body.dark-mode .ai-message {
    background: #313866;
    color: #fff;
    border: 1.5px solid #232946;
    box-shadow: 0 2px 8px #23294611;
}
body.dark-mode .ai-message:hover {
    background: #232946;
}
body.dark-mode .message-time {
    color: #b6c6ff;
}
body.dark-mode .card-footer {
    background: #232946;
    box-shadow: 0 -2px 8px 0 rgba(30,34,54,0.04);
}
body.dark-mode .form-control {
    background: #232946;
    color: #fff;
    border: 1.5px solid #313866;
}
body.dark-mode .form-control:focus {
    border: 1.5px solid #c7d2fe;
    box-shadow: 0 0 0 2px #c7d2fe33;
    background: #313866;
    color: #fff;
}
body.dark-mode .form-control::placeholder {
    color: #b6c6ff;
    opacity: 1;
}
body.dark-mode .btn-primary {
    background: #c7d2fe;
    color: #1746a2;
    box-shadow: 0 2px 8px #c7d2fe22;
}
body.dark-mode .btn-primary:hover, body.dark-mode .btn-primary:focus {
    background: #a5b4fc;
    color: #1746a2;
    box-shadow: 0 4px 16px #c7d2fe33;
}
body.dark-mode .btn-primary:focus-visible {
    outline: 2.5px solid #c7d2fe;
    box-shadow: 0 0 0 4px #c7d2fe33, 0 4px 16px #c7d2fe33;
}
body.dark-mode .social-links a {
    color: #c7d2fe;
}
body.dark-mode .social-links a:hover {
    color: #fff;
}
body.dark-mode #darkModeToggle {
    background: #313866 !important;
    color: #c7d2fe !important;
}
body.dark-mode #darkModeToggle:active {
    background: #232946 !important;
}
body.dark-mode #darkModeIcon {
    color: #c7d2fe !important;
}
body.dark-mode, body.dark-mode p, body.dark-mode li, body.dark-mode ul, body.dark-mode ol, body.dark-mode span, body.dark-mode div, body.dark-mode .markdown-body, body.dark-mode .ai-message * {
    color: #f4f6fb !important;
}
body, p, li, ul, ol, span, div, .markdown-body, .ai-message * {
    color: #222b45;
}