:root {
    --primary-color: #BFDBFE;
    --primary-dark: #60A5FA;
    --primary-text: #1E3A8A;
    --bg-color: #F8FAFC;
    --chat-bg: #FFFFFF;
    --user-bubble: #BFDBFE;
    --bot-bubble: #F1F5F9;
    --text-main: #334155;
    --text-muted: #64748B;
    --border-color: #E2E8F0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --sidebar-width: 250px;
    --sidebar-bg: #1E293B;
    --sidebar-hover: #334155;
    --sidebar-active: #3B82F6;
    --sidebar-text: #F8FAFC;
}

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

body {
    font-family: 'Nunito', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow: hidden;
}

/* Layout */
.app-layout {
    display: flex;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
}

/* =====================================
   SIDEBAR
   ===================================== */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 50;
}

.sidebar-header {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header .avatar-container {
    width: 40px;
    height: 40px;
}
.sidebar-header .header-avatar {
    width: 100%; height: 100%; border-radius: 50%; background-color: var(--primary-color); padding: 2px;
}

.sidebar-header h2 {
    font-size: 1.2rem;
    font-weight: 800;
}

.sidebar-nav {
    padding: 16px 0;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    color: #94A3B8;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.nav-item:hover {
    background-color: var(--sidebar-hover);
    color: var(--sidebar-text);
}

.nav-item.active {
    background-color: var(--sidebar-active);
    color: #ffffff;
    border-right: 4px solid #ffffff;
}

/* =====================================
   MAIN CONTENT & LAYOUTS
   ===================================== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background-color: var(--bg-color);
}

.mobile-header {
    display: none; /* Only visible on mobile */
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background-color: #ffffff;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    z-index: 10;
}
.mobile-header h2 {
    font-size: 1.2rem; color: var(--primary-text); font-weight: 800; margin: 0;
}

.desktop-only { display: block; }

.page-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.icon-btn {
    background: none; border: none; color: var(--text-muted); font-size: 1.25rem; cursor: pointer;
    transition: color 0.2s, background-color 0.2s; padding: 8px 12px; border-radius: 12px;
}
.icon-btn:hover { color: var(--primary-dark); background-color: var(--bot-bubble); }

/* Dashboard Styles */
.dashboard-container {
    max-width: 900px;
    margin: 0 auto;
}
.welcome-banner {
    background: linear-gradient(135deg, var(--primary-dark), #3B82F6);
    color: #ffffff;
    padding: 40px;
    border-radius: 20px;
    margin-bottom: 30px;
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.3);
}
.welcome-banner h1 { font-size: 1.8rem; margin-bottom: 12px; font-weight: 800; }
.welcome-banner p { font-size: 1rem; margin-bottom: 24px; opacity: 0.9; }
.action-buttons { display: flex; gap: 16px; flex-wrap: wrap; }
.primary-btn, .secondary-btn {
    padding: 12px 24px; border-radius: 12px; text-decoration: none; font-weight: 700; transition: transform 0.2s; display: inline-flex; align-items: center; gap: 8px;
}
.primary-btn { background-color: #ffffff; color: #3B82F6; }
.primary-btn:hover { transform: translateY(-2px); }
.secondary-btn { background-color: rgba(255,255,255,0.2); color: #ffffff; backdrop-filter: blur(5px); }
.secondary-btn:hover { background-color: rgba(255,255,255,0.3); transform: translateY(-2px); }

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}
.stat-card {
    background-color: #ffffff; padding: 24px; border-radius: 16px; box-shadow: var(--shadow-sm); border: 1px solid var(--border-color); display: flex; align-items: center; gap: 20px;
}
.stat-card i { font-size: 2.5rem; color: var(--primary-color); }
.stat-info h3 { font-size: 2rem; color: var(--primary-text); font-weight: 800; line-height: 1; margin-bottom: 4px; }
.stat-info p { color: var(--text-muted); font-size: 0.9rem; font-weight: 600; }


/* Chat App Specific Styles */
.chat-app {
    margin: 0 auto;
    width: 100%;
    max-width: 800px;
    background-color: var(--chat-bg);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-md);
    position: relative;
}

@media (min-width: 768px) {
    .chat-app { border-radius: 24px; overflow: hidden; height: 95vh; margin-top: 2.5vh; }
}

.desktop-header {
    background-color: #ffffff; padding: 16px 24px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); z-index: 10; box-shadow: var(--shadow-sm);
}
.header-info { display: flex; align-items: center; gap: 12px; }
.avatar-container { position: relative; width: 48px; height: 48px; }
.header-avatar { width: 100%; height: 100%; border-radius: 50%; background-color: var(--primary-color); padding: 4px; }
.online-indicator { position: absolute; bottom: 2px; right: 2px; width: 12px; height: 12px; background-color: #22C55E; border-radius: 50%; border: 2px solid #ffffff; }
.header-text h1 { font-size: 1.25rem; font-weight: 800; color: var(--primary-text); }
.header-text p { font-size: 0.875rem; color: var(--text-muted); font-weight: 600; }

.chat-container {
    flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 20px; scroll-behavior: smooth; background-color: var(--chat-bg);
}
.chat-container::-webkit-scrollbar { width: 6px; }
.chat-container::-webkit-scrollbar-track { background: transparent; }
.chat-container::-webkit-scrollbar-thumb { background-color: var(--border-color); border-radius: 10px; }

.message-wrapper { display: flex; flex-direction: column; max-width: 85%; animation: fadeIn 0.3s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.message-wrapper.bot { align-self: flex-start; }
.message-wrapper.user { align-self: flex-end; align-items: flex-end; }
.message-sender { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 4px; margin-left: 8px; margin-right: 8px; font-weight: 700; }
.message-bubble { padding: 12px 16px; border-radius: 20px; font-size: 0.95rem; line-height: 1.5; position: relative; word-wrap: break-word; }
.bot .message-bubble { background-color: var(--bot-bubble); color: var(--text-main); border-bottom-left-radius: 4px; box-shadow: var(--shadow-sm); }
.user .message-bubble { background-color: var(--user-bubble); color: var(--primary-text); border-bottom-right-radius: 4px; font-weight: 600; }
.bot .message-bubble p { margin-bottom: 8px; }
.bot .message-bubble p:last-child { margin-bottom: 0; }
.bot .message-bubble ul, .bot .message-bubble ol { margin-left: 20px; margin-bottom: 8px; }
.bot .message-bubble strong { font-weight: 800; color: var(--primary-text); }
.bot .message-bubble code { background-color: #E2E8F0; padding: 2px 4px; border-radius: 4px; font-family: monospace; font-size: 0.85em; }
.bot .message-bubble pre { background-color: #1E293B; color: #F8FAFC; padding: 12px; border-radius: 8px; overflow-x: auto; margin-bottom: 8px; }
.bot .message-bubble pre code { background-color: transparent; color: inherit; padding: 0; }

.typing-indicator { display: flex; gap: 4px; padding: 16px 20px; background-color: var(--bot-bubble); border-radius: 20px; border-bottom-left-radius: 4px; align-self: flex-start; width: fit-content; display: none; }
.typing-dot { width: 8px; height: 8px; background-color: var(--text-muted); border-radius: 50%; animation: typing 1.4s infinite ease-in-out both; }
.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes typing { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }

.input-container { background-color: #ffffff; padding: 16px; border-top: 1px solid var(--border-color); display: flex; flex-direction: column; gap: 12px; }
.shortcuts-container { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; -ms-overflow-style: none; scrollbar-width: none; }
.shortcuts-container::-webkit-scrollbar { display: none; }
.shortcut-btn { white-space: nowrap; padding: 8px 16px; background-color: var(--bot-bubble); border: 1px solid var(--border-color); border-radius: 20px; font-size: 0.85rem; color: var(--primary-text); cursor: pointer; font-weight: 700; font-family: 'Nunito', sans-serif; transition: background-color 0.2s, transform 0.1s; }
.shortcut-btn:hover { background-color: var(--primary-color); transform: translateY(-2px); }
.chat-form { display: flex; gap: 12px; background-color: var(--bg-color); padding: 8px; border-radius: 24px; border: 1px solid var(--border-color); align-items: center; }
.chat-form:focus-within { border-color: var(--primary-dark); box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2); }
#message-input { flex: 1; border: none; background: transparent; padding: 8px 16px; font-size: 0.95rem; font-family: 'Nunito', sans-serif; color: var(--text-main); outline: none; }
#message-input::placeholder { color: #94A3B8; }
.send-btn { background-color: var(--primary-color); color: var(--primary-text); border: none; width: 40px; height: 40px; border-radius: 50%; display: flex; justify-content: center; align-items: center; cursor: pointer; transition: background-color 0.2s, transform 0.2s; font-size: 1.2rem; }
.send-btn:hover { background-color: var(--primary-dark); color: white; transform: scale(1.05); }
.send-btn:disabled { background-color: #E2E8F0; color: #94A3B8; cursor: not-allowed; transform: none; }
.watermark { text-align: center; font-size: 0.7rem; color: var(--text-muted); font-weight: 600; }

/* Schedule Page Specific Styles */
.schedule-page {
    max-width: 900px;
    margin: 0 auto;
}
.panel-header h2 { font-size: 1.6rem; color: var(--primary-text); font-weight: 800; display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.panel-header p { color: var(--text-muted); margin-bottom: 24px; }
.panel-content { background-color: transparent; }

.day-group { margin-bottom: 24px; }
.day-title { font-size: 1.1rem; font-weight: 800; color: var(--primary-text); margin-bottom: 12px; padding-bottom: 8px; border-bottom: 2px solid var(--primary-color); }
.schedule-card { background-color: #ffffff; border: 1px solid var(--border-color); border-radius: 12px; padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow-sm); border-left: 4px solid var(--primary-dark); }
.sch-subject { font-weight: 800; color: var(--text-main); font-size: 1.1rem; margin-bottom: 4px; }
.sch-time { font-size: 0.9rem; color: #059669; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.sch-notes { margin-top: 8px; font-size: 0.9rem; color: var(--text-muted); }
.sch-meta { margin-top: 12px; font-size: 0.75rem; color: #94A3B8; display: flex; justify-content: space-between; }
.empty-schedules { text-align: center; padding: 60px 20px; color: var(--text-muted); background-color: #ffffff; border-radius: 16px; border: 1px dashed var(--border-color); }
.empty-schedules i { font-size: 4rem; color: var(--border-color); margin-bottom: 16px; }


/* =====================================
   RESPONSIVE
   ===================================== */
@media (max-width: 768px) {
    .mobile-header { display: flex; }
    .desktop-header { display: none; }
    .chat-app { height: calc(100vh - 60px); height: calc(100dvh - 60px); border-radius: 0; box-shadow: none; margin-top: 0; }
    .page-container { padding: 16px; }
    .desktop-only { display: none; }
    
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 15px rgba(0,0,0,0.5);
    }
}
