html {
    background: #0b2347; /* matches your auth/signin page bg */
    overscroll-behavior: none; /* disables the bounce/overscroll on most browsers */
}

body.chat-page,
body.chat-page html {
    background: #0f0f0f; /* matches your chat page dark bg */
    overscroll-behavior: none;
}

body.landing-body {
    background: var(--page-bg);
    overscroll-behavior: none;
}
.admin-dashboard #analytics-section.content-section {
    max-height: 70vh;
    overflow-y: auto;
    padding-bottom: 2rem;
}
.admin-dashboard .content-section,
.admin-dashboard .content-section *,
.admin-dashboard .stat-card,
.admin-dashboard .stat-card *,
.admin-dashboard .announcement-card,
.admin-dashboard .announcement-card *,
.admin-dashboard .help-content-card,
.admin-dashboard .help-content-card * {
    color: #fff !important;
}
/* --- Admin Dashboard Card/Text Fixes --- */

.admin-dashboard .table,
.admin-dashboard .table th,
.admin-dashboard .table td {
    background: transparent !important;
    color: #fff !important;
}

.admin-dashboard .card-header h5,
.admin-dashboard .card-header span,
.admin-dashboard .card-title {
    color: #1e3a8a !important;
}

html, body {
    max-width: 100vw;
    overflow-x: hidden !important;
    width: 100%;
}

/* Only lock height/overflow for the chat page */
body.chat-page {
    height: 100vh;
    overflow-y: hidden !important;
}

/* Auth pages (signup, signin) must scroll freely */
body.auth-page {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    height: auto !important;
    min-height: 100vh;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

.chat-window {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    min-width: 0;
    min-height: 0;
    height: 100%;
    scroll-behavior: smooth;
    padding-bottom: 0;
}

@media (max-width: 600px) {
    .chat-page .sidebar {
        width: 100vw !important;
        min-width: 0 !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        z-index: 1000;
        margin-top: 0;
    }
    .chat-page .app,
    .app-layout {
        flex-direction: column;
        overflow-x: hidden;
        padding-top: 56px !important;
    }
    .profile-menu {
        left: 10px !important;
        padding-left: 0.4rem !important;
        min-width: 120px;
        max-width: 90vw;
    }
}

.new-chat {
  border: 1px solid #555;
  padding: 0 2.5rem 0 0.4rem;
  border-radius: 6px;
  background: transparent;
  color: white;
  cursor: pointer;
  margin-bottom: 0.5rem;
}

.search {
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  border-radius: 6px;
  border: none;
}

.sidebar-btn {
  background: transparent;
  border: none;
  color: var(--text);
  padding: 0.6rem;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
  margin-bottom: 0.5rem;
}

.sidebar-btn:hover {
  background: #2a2b32;
}

.chat-list {
    flex: 1;
    overflow-y: auto;
    gap: 2px;
    padding: 0 4px;
}

.chat-item {
    width: 100%;
    border: none;
    color: #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    padding: 8px 12px;
    background: none;
    margin-bottom: 0;
}

.chat-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #f5f5f5;
}

.chat-item.active {
    background: rgba(255, 255, 255, 0.12);
    color: #d1d5db;
}

/* Main */
.main {
    flex: 1 1 0%;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    height: 100vh;
    box-sizing: border-box;
    overflow: hidden;
}

.header {
  padding: 1rem;
  border-bottom: 1px solid #555;
  display: flex;
  justify-content: space-between;
}

/* Auth */
.auth {
  margin: auto;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
}

.auth-container {
    max-width: 400px;
    width: 100%;
    background: var(--kcse-surface);
    color: var(--kcse-text);
}

.auth h2 {
    margin-bottom: 2rem;
    color: var(--kcse-text);
}

.auth input {
    display: block;
    margin: 0.5rem auto;
    padding: 0.7rem;
    width: 100%;
    max-width: 300px;
    border-radius: 6px;
    border: 1px solid var(--kcse-border);
    background: var(--kcse-surface-soft);
    color: var(--kcse-text);
}

.auth button {
    padding: 0.7rem 1rem;
    background: var(--kcse-accent);
    border: none;
    color: #fff;
    border-radius: 6px;
  cursor: pointer;
  margin: 0.5rem auto;
  display: block;
  width: 100%;
  max-width: 300px;
}

.auth-msg {
    color: #ff6b6b;
    margin: 0.5rem 0;
    min-height: 20px;
}

.error {
    color: #ff4d6d;
}

/* Chat */
.chat {
    display: flex;
    flex-direction: column;
    height: 100%;
    flex: 1 1 auto;
    overflow: hidden;
}

.message {
    display: flex;
    animation: fadeIn 0.3s ease;
    width: 100%;
    justify-content: flex-start;
}

.message.user {
  justify-content: flex-end;
  padding: 0%;
}

.bubble {
    max-width: min(100%, 820px);
    padding: 0.3rem 0.7rem;
    border-radius: 0.75rem;
    line-height: 1.5;
    white-space: pre-wrap;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.bubble h1,
.bubble h2,
.bubble h3 {
    font-weight: 600;
    margin: 1rem 0 0.5rem;
}

.bubble p {
    margin: 0.5rem 0;
}

.bubble ul {
    margin: 0.5rem 0;
    padding-left: 1.2rem;
}

.bubble li {
    margin-bottom: 0.4rem;
}

.user .bubble {
    background: #0057ff;
    color: #fff;
    box-shadow: 0 2px 8px 0 rgba(0,0,0,0.10);
    margin-left: auto;
}

.bot .bubble {
    background: #232323;
    color: #e3e3e3;
    margin-right: auto;
}

/* Input */
.chat-input button {
    padding: 0.8rem 1.2rem;
    border: 1px solid var(--border-color);
    background: #0057ff;
    color: white;
    border-radius: 2rem;
    cursor: pointer;
    box-shadow: 0 2px 8px 0 rgba(0,0,0,0.10);
}

.chat-input {
    position: sticky;
    bottom: 0;
    background: var(--kcse-bg);
    z-index: 10;
    width: 100%;
    padding-bottom: 5rem;
}

/* Utility */
.hidden {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
}

/* Profile at bottom */
.chat-page .profile-container {
        margin-top: auto;
        position: relative;
        padding: 1rem 0 0;
        max-width: none;
        width: 100%;
}

.profile-page .profile-container {
        max-width: 900px;
        margin: 40px auto;
        padding: 20px;
}

.profile-btn {
  width: 100%;
  padding: 0.7rem;
  background: transparent;
  border: 1px solid #555;
  color: white;
  border-radius: 6px;
  cursor: pointer;
}

.password-toggle {
  background-color: #fff;
  border-color: var(--border-color);
  color: var(--text-secondary);
}

.password-toggle:hover,
.password-toggle:focus,
.password-toggle:active,
.password-toggle.active,
.password-toggle.show {
  background-color: #fff;
  border-color: var(--border-color);
  color: var(--text-primary);
}

.password-toggle:focus,
.password-toggle:active {
  box-shadow: none;
}

/* Popup menu */
.profile-menu {
    position: absolute;
    bottom: 50px;
    left: 0;
    width: 100%;
    background: linear-gradient(180deg, #171c1a 0%, #111513 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    display: none;
}
.profile-menu.show {
    display: block;
}

.profile-menu div {
  padding: 0.75rem 1rem;
  cursor: pointer;
  color: #d1d5db;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.profile-menu div:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

/* signin page */
body {
    background: #0b2347;
    min-height: 100vh;
}

.container {
    max-width: 600px;
}

.card {
    border: none;
    border-radius: 14px;
    background: #2a2b32;
    padding: 2rem 1.8rem;
}

.card.shadow {
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.45) !important;
}

.card-title {
    font-weight: 600;
    font-size: 1.6rem;
    margin-bottom: 1.5rem;
    color: #fff;
}

.form-control {
    background: #40414f;
    border: 1px solid #555;
    color: #fff;
    border-radius: 10px;
    padding: 0.75rem 0.85rem;
    font-size: 1rem;
}

.form-control::placeholder {
    color: #9ca3af;
}

.form-control:focus {
    background: #40414f;
    color: #fff;
    border-color: #10a37f;
    box-shadow: 0 0 0 0.15rem rgba(16, 163, 127, 0.25);
}

.btn-success {
    background: #10a37f;
    border: none;
    border-radius: 10px;
    padding: 0.75rem;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-success:hover {
    background: #0d8c6d;
    transform: translateY(-1px);
}

#signin-msg {
    font-size: 0.9rem;
}

a {
    color: #10a37f;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.mb-3 {
    margin-bottom: 1rem !important;
}

.card {
    animation: fadeIn 0.4s ease;
}

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

.card-body span {
    color: #d1d5db;
    font-size: 0.95rem;
}

.card-body a {
    color: #10a37f;
    font-weight: 500;
}

/* sign-up page */
.container {
    max-width: 900px;
}

.card {
    border-radius: 12px;
    padding: 2rem;
    background: #1e1e2f;
    color: #fff;
}

.card .card-title {
    color: #10a37f;
}

.form-control, .form-select {
    width: 100%;
    background: #2c2c3d;
    border: 1px solid #555;
    color: #fff;
    border-radius: 10px;
    padding: 0.6rem;
    font-size: 0.95rem;
}

.form-control:focus, .form-select:focus {
    border-color: #10a37f;
    box-shadow: 0 0 0 0.15rem rgba(16, 163, 127, 0.25);
    outline: none;
}

#add-subject {
    width: 100%;
    border-radius: 8px;
    font-size: 0.9rem;
}

.btn-primary {
    background-color: #10a37f;
    border: none;
    font-weight: 500;
    padding: 0.6rem;
    font-size: 1rem;
}

.btn-primary:hover {
    background-color: #0d8166;
}

#signup-msg {
    color: #ff4d6d;
    font-weight: 500;
}

@media (max-width: 576px) {
    .card {
        padding: 1rem;
    }
    .col-7, .col-5 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    .subject-row {
        margin-bottom: 0.75rem;
    }
}

/* Landing Page */
html, body {
    max-width: none;
    width: 100vw;
    overflow-x: hidden !important;
    margin: 0;
    padding: 0;
}
.landing-body {
    background: var(--page-bg);
    overflow-x: hidden;
    width: 100%;
}
.landing-body::-webkit-scrollbar {
    display: none;
}
.landing-body {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.landing-hero-section {
    background: var(--website-gradient);
    color: #fff;
}
.landing-hero-section h1, .landing-hero-section p {
    color: #fff;
}
.landing-hero-title {
    color: #fff;
    font-weight: 700;
    margin-bottom: 1.5rem;
    font-size: 2.5rem;
}
.landing-hero-subtitle {
    color: #fff;
    font-size: 1.2rem;
    line-height: 1.7;
    max-width: 800px;
    margin: 0 auto;
}
.landing-btn-primary:hover, .landing-btn-primary:focus {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}
.landing-btn-outline-primary {
    color: var(--secondary-color);
    border-color: var(--secondary-color);
    background-color: transparent;
    border-width: 2px;
    font-weight: 500;
}
.landing-btn-primary, .landing-btn-outline-primary {
    text-decoration: none;
    padding: 0.5rem 1.2rem;
    font-size: 1.1rem;
    line-height: 1.5;
    border-radius: 0.375rem;
    height: auto;
    min-height: 44px;
    white-space: nowrap;
    display: inline-block;
    min-width: 90px;
}
.landing-btn-primary:hover, .landing-btn-primary:focus {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    text-decoration: none;
}
.landing-btn-outline-primary:hover, .landing-btn-outline-primary:focus {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: #fff;
    text-decoration: none;
}
.landing-navbar-brand {
    color: var(--secondary-color) !important;
    text-decoration: none;
}
.landing-navbar-brand:hover {
    text-decoration: none;
}
.landing-nav-link {
    color: var(--text-secondary) !important;
    transition: color 0.2s;
    text-decoration: none;
}
.landing-nav-link:hover {
    color: var(--secondary-color) !important;
    text-decoration: none;
}
.landing-navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    padding-right: 0;
}
.landing-navbar .container {
    padding-right: 0;
    margin-right: 0;
    max-width: 100%;
}
.landing-navbar .navbar-nav {
    margin-right: 0;
    padding-right: 0;
}
.landing-navbar .navbar-nav li:last-child {
    margin-right: 0 !important;
    padding-right: 0 !important;
}
.landing-navbar .navbar-nav li:last-child a {
    margin-right: 0 !important;
    padding-right: 0 !important;
}
.landing-navbar .collapse {
    padding-right: 0;
    margin-right: 15px;
}
.landing-btn-outline-light {
    color: #fff;
    border-color: #fff;
}
.landing-btn-outline-light:hover, .landing-btn-outline-light:focus {
    background: #fff;
    color: var(--primary-color);
}
.landing-section-title {
    color: #06b6d4;
    font-weight: 700;
    margin-bottom: 1.5rem;
    font-size: 2.2rem;
    text-align: center;
}
.landing-section-subtitle {
    color: #64748b;
    font-size: 1.1rem;
    line-height: 1.7;
    text-align: center;
    max-width: 800px;
    margin: 0 auto 2rem auto;
}
.landing-card {
    border: 2px solid var(--primary-color);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s;
}
.landing-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 102, 204, 0.25);
}
.landing-card-title {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1.2rem;
}
.landing-bg-light {
    background-color: var(--light-color) !important;
}
.landing-footer-bg-dark {
    background: var(--website-gradient);
}
.landing-footer-text-white:hover {
    color: #ffe082 !important;
}

/* Admin Panel */
.admin-app {
    display: flex;
    min-height: 100vh;
    background: var(--page-bg);
}
.admin-sidebar {
    width: 280px;
    background: var(--dark-color);
    color: white;
    display: flex;
    flex-direction: column;
}
.admin-brand {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}
.admin-brand h4 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--primary-color);
}
.admin-brand small {
    color: #9ca3af;
}
.admin-nav {
    flex: 1;
    padding: 1rem 0;
}
.nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.nav-list li {
    margin-bottom: 0.5rem;
}
.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: #e5e7eb;
    text-decoration: none;
    transition: all 0.2s;
}
.nav-link:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}
.nav-link.active {
    background: var(--primary-color);
    color: white;
}
.nav-link i {
    margin-right: 0.75rem;
    width: 16px;
}
.admin-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.admin-header {
    background: none;
    padding: 1.2rem 2.5rem 1.2rem 2rem;
    border-bottom: none;
    box-shadow: none;
}
.admin-header h1 {
    margin: 0;
    color: var(--kcse-text);
    font-size: 2.8rem;
    font-weight: 700;
}
.admin-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.admin-info span {
    color: var(--kcse-text);
    font-size: 1.25rem;
    font-weight: 500;
}
.content-section {
    display: none;
    padding: 2rem;
}
.content-section.active {
    display: block;
}
.stat-card {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}
.stat-icon.bg-primary { background: var(--primary-color); }
.stat-icon.bg-success { background: var(--success-color); }
.stat-icon.bg-info { background: #17a2b8; }
.stat-icon.bg-warning { background: var(--warning-color); }
.stat-info h3 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary) !important;
}
.stat-info p {
    margin: 0;
    color: var(--text-secondary) !important;
}
.card {
    background: white !important;
    color: var(--text-primary) !important;
}
.card-header {
    background: var(--light-color) !important;
    color: var(--text-primary) !important;
    border-bottom: 1px solid var(--border-color) !important;
}
.card-header h5 {
    color: var(--text-primary) !important;
    margin: 0;
}
.card-body {
    color: var(--text-primary) !important;
}
.activity-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}
.activity-item:last-child {
    border-bottom: none;
}
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}
.analytics-panel {
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1rem;
    background: #fff;
}
.analytics-panel h6 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}
.analytics-row {
    display: grid;
    grid-template-columns: minmax(120px, 1.4fr) minmax(140px, 2fr) auto;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 0.75rem;
}
.analytics-row:last-child {
    margin-bottom: 0;
}
.analytics-label,
.analytics-value {
    font-size: 0.9rem;
    color: var(--text-primary);
}
.analytics-label {
    white-space: nowrap;
    text-overflow: ellipsis;
}
.analytics-bar-track {
    height: 10px;
    border-radius: 999px;
    background: #e5e7eb;
}
.analytics-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary-color), #5aa9ff);
}
.admin-table {
    background: white;
    border-radius: 0.75rem;
    overflow: hidden;
}
.table {
    color: var(--text-primary) !important;
}
.table th {
    background: var(--light-color);
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    color: var(--text-primary) !important;
}
.table td {
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}
.table a {
    color: var(--primary-color) !important;
}
.table .badge {
    color: white !important;
}
@media (max-width: 768px) {
    .admin-sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s;
    }
    .admin-sidebar.show {
        left: 0;
    }
    .admin-main {
        margin-left: 0;
    }
    .content-section {
        padding: 1rem;
    }
    .analytics-grid {
        grid-template-columns: 1fr;
    }
    .analytics-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
}

/* Landing page general */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--page-bg);
    color: #333;
    line-height: 1.6;
}
.navbar-brand {
    font-size: 1.5rem;
}
.hero-section {
    background: linear-gradient(135deg, #0d6efd, #198754);
    color: #fff;
    padding-top: 80px;
    padding-bottom: 80px;
}
.hero-section h1 {
    font-size: 2.5rem;
}
.hero-section p {
    font-size: 1.2rem;
}
.card {
    border-radius: 0.6rem;
}
.card-title {
    color: #0d6efd;
}
.card-text {
    font-size: 0.95rem;
}
footer {
    font-size: 0.9rem;
}
footer a {
    text-decoration: none;
}
footer a:hover {
    text-decoration: underline;
}
.site-footer {
    background: var(--dark-color);
    color: #e0e0e0;
    padding: 1rem 0 0.5rem 0;
    border-top: 4px solid var(--secondary-color);
    font-size: 0.9rem;
}
.site-footer .footer-brand {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.5rem;
}
.site-footer .footer-desc {
    font-size: 0.98em;
    color: #fff;
}
.site-footer .footer-col h6 {
    color: var(--secondary-color);
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    letter-spacing: 0.03em;
}
.site-footer .footer-col ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.site-footer .footer-col ul li {
    margin-bottom: 0.5rem;
}
.site-footer .footer-col ul li a {
    color: #e0e0e0;
    text-decoration: none;
    transition: color 0.2s;
}
.site-footer .footer-col ul li a:hover {
    color: var(--secondary-color);
}
.site-footer .footer-contact a {
    color: #fff;
    text-decoration: none;
}
.site-footer .footer-contact a:hover {
    color: var(--secondary-color);
    text-decoration: none;
}
.site-footer .footer-social a {
    color: #e0e0e0;
    margin-right: 0.7rem;
    font-size: 1.3rem;
    transition: color 0.2s;
}
.site-footer .footer-social a:last-child {
    margin-right: 0;
}
.site-footer .footer-social a:hover {
    color: var(--secondary-color);
}
.site-footer .footer-bottom {
    border-top: 1px solid #23263a;
    margin-top: 1rem;
    padding-top: 0.5rem;
    font-size: 0.85em;
    color: #b0b0b0;
    text-align: center;
}
@media (max-width: 767px) {
    .site-footer .row {
        flex-direction: column;
        gap: 2rem;
    }
    .site-footer .footer-col {
        margin-bottom: 1.5rem;
    }
}

/* Profile Page */
.profile-page {
    background: #0f0f0f;
}
.profile-container {
    max-width: 900px;
    margin: 40px auto;
    padding: 20px;
    background: var(--kcse-surface);
    color: var(--kcse-text);
}
.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}
.profile-title {
    font-size: 1.8rem;
    font-weight: 600;
    margin: 0;
    color: var(--kcse-text);
}
.back-btn {
    text-decoration: none;
    color: #d1d5db;
    font-weight: 500;
    font-size: 0.95rem;
}
.back-btn:hover {
    text-decoration: underline;
}
.profile-content {
    background: var(--kcse-surface-soft);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--kcse-shadow-soft);
    border: 1px solid var(--kcse-border);
}
.profile-section {
    margin-bottom: 30px;
}
.section-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--kcse-text);
}
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}
.info-item {
    background: var(--kcse-surface);
    padding: 15px 18px;
    border-radius: 10px;
    border: 1px solid var(--kcse-border);
}
.info-label {
    display: block;
    font-size: 0.8rem;
    color: var(--kcse-muted);
    margin-bottom: 5px;
}
.info-value {
    font-size: 1rem;
    font-weight: 500;
    color: var(--kcse-text);
}
.subjects-section {
    margin-top: 20px;
}
.subsection-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: #f5f5f5;
}
.subjects-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.subject-tag {
    background: rgba(16, 163, 127, 0.15);
    color: #10a37f;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid rgba(16, 163, 127, 0.3);
}
.no-data {
    color: #8ea198;
    font-size: 0.9rem;
}

/* Navbar - Profile page */
.profile-page .navbar {
    background: linear-gradient(180deg, #171c1a 0%, #111513 100%) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding-right: 0;
}
.profile-page .navbar .container {
    padding-right: 0;
    margin-right: 0;
    max-width: 100%;
}
.profile-page .navbar-brand {
    color: #f5f5f5 !important;
    text-decoration: none;
    font-size: 1.5rem;
}
.profile-page .nav-link {
    color: #d1d5db !important;
    transition: color 0.2s ease;
    text-decoration: none;
    font-weight: 500;
}
.profile-page .profile-nav-btn {
    color: #d1d5db !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    background: transparent !important;
    transition: all 0.2s ease;
    border-radius: 6px;
    padding: 6px 14px;
}
.profile-page .profile-nav-btn:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    color: #ffffff !important;
}

/* Landing navbar */
.landing-navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    padding-right: 0;
}
.landing-navbar-brand {
    font-size: 1.3rem;
    color: #f5f5f5 !important;
    text-decoration: none;
}
.landing-navbar-brand:hover {
    text-decoration: none;
}
.landing-nav-link {
    color: #d1d5db !important;
    transition: color 0.2s ease;
    text-decoration: none;
    font-weight: 500;
}
.landing-nav-link:hover {
    color: #ffffff !important;
    text-decoration: none;
}
.landing-btn-primary {
    border-radius: 6px;
    padding: 6px 14px;
}

/* Footer */
.site-footer {
    background: #111827;
    color: #d1d5db;
    padding: 40px 0 20px;
}
.footer-brand {
    font-size: 1.3rem;
    font-weight: 600;
    color: #fff;
}
.footer-desc {
    font-size: 0.9rem;
    margin-top: 10px;
}
.footer-col h6 {
    color: #fff;
    margin-bottom: 10px;
}
.footer-col ul {
    list-style: none;
    padding: 0;
}
.footer-col ul li {
    margin-bottom: 6px;
}
.footer-col ul li a {
    text-decoration: none;
    color: #9ca3af;
}
.footer-col ul li a:hover {
    color: #fff;
}
.footer-contact a {
    color: #9ca3af;
    text-decoration: none;
}
.footer-contact a:hover {
    color: #fff;
}
.footer-bottom {
    text-align: center;
    font-size: 0.85rem;
    color: #9ca3af;
    margin-top: 20px;
}

@media (max-width: 768px) {
    .profile-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .profile-content {
        padding: 20px;
    }
    .hero-section h1 {
        font-size: 2rem;
    }
    .hero-section p {
        font-size: 1rem;
    }
}

/* Chat UI */
.chat-page {
    background: #0f0f0f;
    color: #f5f5f5;
}

/* ===== CHAT PAGE LAYOUT — single source of truth ===== */
.app-layout {
    display: flex;
    flex-direction: row;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

.chat-page .sidebar {
    width: 260px;
    min-width: 200px;
    max-width: 260px;
    background: linear-gradient(180deg, #171c1a 0%, #111513 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 2px 0 16px 0 rgba(0,0,0,0.12);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    flex-shrink: 0;
    padding-left: 1.0rem;
}

.chat-layout {
    flex: 1 1 0%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-list {
    overflow-x: hidden !important;
    width: 100%;
}

.chat-item {
    max-width: 100%;
    box-sizing: border-box;
}

.sidebar-top {
    display: grid;
    gap: 0.9rem;
    padding: 1rem 0 0 0;
}

.sidebar-content {
    flex: 1 1 0%;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    padding: 0 2.5rem 0 2.2rem;
}

.sidebar-nav {
    margin-bottom: 1rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #d1d5db;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    border-radius: 0.5rem;
    margin-bottom: 0.25rem;
}
.nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}
.nav-item i {
    font-size: 16px;
    color: #8ea198;
    transition: color 0.2s ease;
}
.nav-item:hover i {
    color: #ffffff;
}
.sidebar-nav-section {
    margin-bottom: 1rem;
}
.nav-section-title {
    color: #8ea198;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.5rem 1rem;
    font-weight: 600;
}

.sidebar-content::-webkit-scrollbar { width: 6px; }
.sidebar-content::-webkit-scrollbar-track { background: transparent; }
.sidebar-content::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 3px; }
.sidebar-content::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.3); }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.15rem 0.2rem 0.2rem;
    color: #f5f7f4;
}
.sidebar-brand strong {
    display: block;
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
    font-size: 0.95rem;
    letter-spacing: 0.005em;
    margin-bottom: 0.1rem;
}
.sidebar-brand small {
    color: #8fa198;
    font-size: 0.8rem;
    margin-top: 0;
}
.brand-mark {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #0f1714;
    background: linear-gradient(135deg, #9ee8c9 0%, #10a37f 100%);
    box-shadow: 0 12px 24px rgba(16, 163, 127, 0.25);
}

.chat-page .new-chat {
    border: none;
    padding: 0.35rem 0.1rem;
    border-radius: 0.5rem;
    background: transparent;
    color: #d1d5db;
    font-weight: 400;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.chat-page .new-chat:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.search-wrap {
    position: relative;
}
.chat-page .search {
    width: 100%;
    padding: 0.35rem 0 0.35rem 2.2rem;
    border-radius: 0.5rem;
    border: none;
    background: transparent;
    color: #d1d5db;
    font-size: 0.875rem;
    transition: background 0.2s ease;
}
.chat-page .search::placeholder { color: #8ea198; font-size: 0.875rem; }
.chat-page .search:hover,
.chat-page .search:focus { outline: none; background: rgba(255, 255, 255, 0.08); color: #ffffff; }
.search-wrap::before {
    content: "\F52A";
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-family: "bootstrap-icons";
    font-size: 16px;
    color: #8ea198;
    pointer-events: none;
    transition: color 0.2s ease;
}
.search-wrap:hover::before { color: #ffffff; }

.sidebar-section-title .bi-chevron-down {
    font-size: 0.75rem;
    color: #d1d5db;
    transition: color 0.2s ease, transform 0.2s ease;
}
.sidebar-section-title .bi-chevron-down.rotated { transform: rotate(180deg); }

.chat-page .chat-list { padding-right: 0; margin-top: 0.02rem; }

.chat-page .chat-item {
    padding: 0.35rem 0.2rem;
    border-radius: 0.5rem;
    color: #d1d5db;
    background: transparent;
    transition: background 0.2s ease, color 0.2s ease;
}
.chat-page .chat-item:hover,
.chat-page .chat-item.active {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.chat-page .profile-btn {
    width: 100%;
    padding: 0.75rem 0.5rem;
    background: transparent;
    border: none;
    color: #d1d5db;
    border-radius: 0.5rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease;
}
.chat-page .profile-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}
.chat-page .profile-menu {
    bottom: 58px;
    background: #1f2622;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

/* Chat main area */
.chat-page .main,
.chat-layout {
    flex: 1 1 0%;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #0f0f0f;
    box-sizing: border-box;
    height: 100vh;
    overflow: hidden;
}

.chat-page .header {
    padding: 1rem 2rem 0.35rem;
    border-bottom: none;
}
.header-copy h1 {
    margin: 0;
    font-size: 1.05rem;
    color: #f5f5f5;
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}
.header-copy p {
    margin: 0.22rem 0 0;
    color: #9ca3af;
    font-size: 0.85rem;
}

.empty-state {
    max-width: 760px;
    margin: 15vh auto 0;
    padding: 0 1.5rem 2rem;
    text-align: center;
}
.empty-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    background: rgba(16, 163, 127, 0.12);
    color: #15785f;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 1rem;
}
.empty-state h2 {
    font-size: 2rem;
    margin-bottom: 0.85rem;
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
    color: #d1d5db;
    font-weight: 600;
}
.empty-state p {
    max-width: 650px;
    margin: 0 auto 1.6rem;
    color: #9ca3af;
    font-size: 1rem;
}
.starter-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
}
.starter-chip {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: transparent;
    color: #d1d5db;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}
.starter-chip:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.chat-page .message {
    max-width: 800px;
    width: 100%;
    margin: 0 auto 0.1rem;
    padding: 0 0.1rem;
}
.chat-page .message.user { justify-content: flex-end; }
.chat-page .message + .message { margin-top: 0.1rem; }

.search-container {
    width: 100%;
    max-width: 750px;
    padding: 0 16px;
    margin: 0 auto;
}
.search-bar {
    display: flex;
    align-items: center;
    background-color: #2f2f2f;
    border-radius: 9999px;
    padding: 10px 12px;
    gap: 8px;
    transition: box-shadow 0.2s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}
.search-bar:focus-within { box-shadow: 0 0 0 1.5px #555; }
.search-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: #ececec;
    font-size: 15px;
    caret-color: #ececec;
    line-height: 1.1;
}
.search-input::placeholder { color: #8e8ea0; }
.plus-symbol {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: #9ca3af;
    font-size: 1.4rem;
    line-height: 1;
    font-weight: 400;
    border-radius: 999px;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.plus-symbol:hover { background: #3a3a3a; color: #d1d5db; }
.btn-voice {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: #9ca3af !important;
    cursor: pointer;
    flex-shrink: 0;
}
.chat-input .btn-voice {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
}
.btn-voice:hover { background: #3a3a3a !important; border-radius: 999px; }
.btn-voice svg {
    width: 18px;
    height: 18px;
    stroke: currentColor !important;
    stroke-width: 2.4;
    fill: none;
}

/* Chat bubbles */
.chat-page .bubble {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    line-height: 1.7 !important;
    font-size: 15px !important;
    max-width: 750px !important;
}
.chat-page .bot .bubble {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}
.chat-page .user .bubble {
    background: #2d2d2d !important;
    color: #ececf1 !important;
    padding: 0.15rem 0.4rem !important;
    border-radius: 1rem !important;
    max-width: 70% !important;
}
.chat-page .bubble h1,
.chat-page .bubble h2,
.chat-page .bubble h3 { font-weight: 600; margin: 1rem 0 0.5rem; }
.chat-page .bubble p { margin: 0.5rem 0; }
.chat-page .bubble ul { margin: 0.5rem 0; padding-left: 1.2rem; }
.chat-page .bubble li { margin-bottom: 0.4rem; }

/* Chat window scrollbar */
.chat-page .chat-window {
    padding: 2rem 0 5rem 0 !important;
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    width: 100% !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    min-height: 0;
    align-items: stretch !important;
    box-sizing: border-box;
}
.chat-page .chat-window::-webkit-scrollbar { width: 6px; }
.chat-page .chat-window::-webkit-scrollbar-track { background: transparent; }
.chat-page .chat-window::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 3px; }
.chat-page .chat-window::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.3); }

.chat-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.01em;
    margin-bottom: 0.15rem;
}

/* ChatGPT-style header */
.chat-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 56px;
    background: #181818;
    border-bottom: 1px solid #222;
    display: flex;
    align-items: center;
    z-index: 1002;
    padding: 0 2rem;
    font-size: 1.1rem;
    font-weight: 500;
    color: #fff;
}

/* Enable scrolling for landing and profile pages */
.landing-body, .profile-page {
    overflow-y: auto !important;
    height: auto !important;
    min-height: 100vh;
}

/* Responsive */
@media (max-width: 960px) {
    .chat-page .sidebar {
        width: 250px;
        min-width: 180px;
        max-width: 250px;
    }
    .starter-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .app-layout {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }
    .chat-page .sidebar {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        height: auto;
    }
    .chat-layout {
        height: calc(100vh - 56px);
    }
    .chat-page .header { padding: 1rem 1rem 0.5rem; }
    .empty-state { margin-top: 3rem; padding: 0 1rem 1.5rem; }
    .empty-state h2 { font-size: 1.6rem; }
    .chat-page .message { padding: 0 1rem; }
    .search-container { max-width: 100%; padding: 0; }
}