@font-face {
    font-family: IranSans;
    src: url(../font/IRANSans.ttf);
}
:root {
    --primary: #4361ee;
    --primary-light: #eef2ff;
    --primary-dark: #3a56d4;
    --secondary: #06d6a0;
    --secondary-light: #e6fcf5;
    --accent: #ff6b6b;
    --accent-light: #fff0f0;
    --warning: #ffd166;
    --warning-light: #fff9e6;
    --info: #4cc9f0;
    --info-light: #e6f7ff;
    --dark: #2d3748;
    --dark-light: #4a5568;
    --light: #f8fafc;
    --gray: #e2e8f0;
    --gray-light: #f1f5f9;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: IranSans;
    resize: none;
}
body {
    background: var(--light);
    color: var(--dark);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}
body.loading {
    overflow: hidden;
}
#loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--light);
    opacity: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.6s ease, visibility 0.6s ease;
    z-index: 999999;
}
#loader.hidden {
    opacity: 0;
    visibility: hidden;
}
.spinner {
    width: 42px;
    height: 42px;
    border: 4px solid transparent;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.hide-student .student {
    display: none !important;
}
.hide-teacher .teacher {
    display: none !important;
}
.hide-admin .admin {
    display: none !important;
}
/* Sidebar */
.sidebar {
    position: fixed;
    right: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
    transition: var(--transition-slow);
    transform: translateX(0);
}
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.sidebar-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s;
}
.sidebar-toggle-btn:hover {
    color: var(--primary-color);
}
body.sidebar-closed .sidebar {
    width: 80px;
}
body.sidebar-closed .main-content {
    margin-right: 80px;
}
body.sidebar-closed .sidebar .logo-text,
body.sidebar-closed .sidebar .nav-text {
    display: none;
    opacity: 0;
}
body.sidebar-closed .nav-menu .nav-link {
    justify-content: center;
}
body.sidebar-closed .sidebar-toggle-btn i {
    transform: rotate(180deg);
}
.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.logo-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}
.logo-text {
    font-weight: 800;
    font-size: 1.25rem;
}
.nav-menu {
    list-style: none;
    flex: 1;
}
.nav-item {
    margin-bottom: 0.5rem;
    cursor: pointer;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.nav-link::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: white;
    transform: scaleY(0);
    transition: var(--transition);
}
.nav-link:hover, .nav-link.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}
.nav-link.active::before {
    transform: scaleY(1);
}
.nav-icon {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}
.nav-text {
    font-size: .9rem;
    font-weight: 800;
}
/* Main Content */
.main-content {
    margin-right: 260px;
    padding: 1.5rem;
    transition: var(--transition-slow);
}
.main-content.expanded {
    margin-right: 0;
}
/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 1rem 0;
}
.page-title h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark);
}
.page-title p {
    color: var(--dark-light);
    font-size: 0.9rem;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: .8rem;
}
.date-display {
    background: white;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
}
.date-icon {
    color: var(--primary);
}
.notification-bell {
    position: relative;
    background: white;
    width: 45px;
    height: 45px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: var(--transition);
}
.notification-bell:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}
.notification-badge {
    position: absolute;
    top: -5px;
    left: -5px;
    background: var(--accent);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
}
.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}
.user-profile:hover{
    background-color: white;
    box-shadow: var(--shadow);
}
.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}
.user-name {
    font-weight: 600;
    font-size: 1rem;
}
.user-role {
    font-size: 0.8rem;
    color: var(--text-light);
}
.user-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #6a8cff);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1rem;
    box-shadow: 0 5px 15px rgba(74, 108, 247, 0.3);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.user-avatar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(-100%);
    transition: transform 0.6s;
}
.user-avatar:hover::before {
    transform: translateX(100%);
}
.user-avatar:hover {
    transform: scale(1.1);
}
.profile-dropdown {
    position: absolute;
    top: 66px;
    left: 0;
    width: 100%;
    background: white;
    backdrop-filter: var(--blur);
    border-radius: 16px;
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
    z-index: 10;
    border: 1px solid var(--border);
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-top: none;
}
.user-profile:hover .profile-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.profile-dropdown a {
    display: flex;
    align-items: center;
    padding: 1rem;
    color: var(--dark);
    text-decoration: none;
    transition: var(--transition);
    font-size: .8rem;
}
.profile-dropdown a i {
    margin-left: .5rem;
}
.profile-dropdown a:hover {
    background: var(--primary-light);
    color: var(--dark);
}
/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom:1.5rem;
}
.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 4px;
    background: var(--primary);
    transform: scaleX(0);
    transition: var(--transition);
}
.stat-card:hover::before {
    transform: scaleX(1);
}
.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}
.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}
.stat-icon.blue {
    background: linear-gradient(135deg, var(--primary), #5a75f5);
}
.stat-icon.green {
    background: linear-gradient(135deg, var(--secondary), #1bd7a4);
}
.stat-icon.orange {
    background: linear-gradient(135deg, var(--warning), #ffb347);
}
.stat-icon.purple {
    background: linear-gradient(135deg, #8b5cf6, #a78bfa);
}
.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0;
}
.stat-label {
    color: var(--dark-light);
    font-size: 0.9rem;
}
/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
/* Card Styles */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
}
.card:hover {
    box-shadow: var(--shadow-lg);
}
.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark);
}
.card-actions {
    display: flex;
    gap: 0.5rem;
}
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}
.btn-primary {
    font-weight: 800;
    background: var(--primary);
    color: white;
}
.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--dark-light);
}
.btn-outline:hover {
    background: var(--gray-light);
    color: var(--dark);
    transform: translateY(-2px);
}
.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    justify-content: center;
}
.card-body {
    padding: 1.5rem;
}
/* Classes List */
.classes-list {
    list-style: none;
    max-height: 360px;
    overflow-y: auto;
}
.class-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}
.class-item:last-child {
    border-bottom: none;
}
.class-item:hover {
    background: var(--gray-light);
}
.class-color {
    width: 12px;
    height: 32px;
    border-radius: 6px;
    margin-left: 1rem;
}
.class-info {
    flex: 1;
}
.class-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}
.class-details {
    display: flex;
    gap: 1rem;
    color: var(--dark-light);
}
.class-detail {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.class-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
/* Announcements */
.announcements-list {
    list-style: none;
    max-height: 360px;
    overflow-y: auto;
}
.announcement-item {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}
.announcement-item:last-child {
    border-bottom: none;
}
.announcement-item:hover {
    background: var(--gray-light);
}
.announcement-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.announcement-text {
    display: flex;
    justify-content: space-between;
    align-items: start;
}
.announcement-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.announcement-date {
    font-size: 0.8rem;
    color: var(--dark-light);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.announcement-content {
    color: var(--dark-light);
    font-size: 0.9rem;
    line-height: 1.5;
    padding-left: 15%;
}
/* Charts */
.chart-container {
    position: relative;
    height: 280px;
    margin-top: 1rem;
}
/* Calendar */
.calendar {
    padding: 1rem;
}
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.calendar-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.calendar-title {
    font-weight: 600;
}
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}
.calendar-day {
    text-align: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--dark-light);
    padding: 0.5rem;
    cursor: default;
    border-radius: var(--radius-sm);
}
.calendar-date {
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 5px;
    border-radius: 4px; 
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
    position: relative;
    font-size: 14px;
}
.calendar-date:not(.empty):hover {
    background-color: var(--gray-light);
    transform: scale(1.05); 
}
.calendar-date.empty {
    cursor: default;
    background-color: transparent;
}
.calendar-date.current-day {
    font-weight: bold;
    border: 2px solid var(--info);
}
.calendar-date.selected {
    background-color: var(--primary);
    color: white;
    font-weight: 700;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}
.calendar-date.current-day.selected {
    background-color: var(--primary) !important;
    border: 2px solid var(--primary);
}
.calendar-date.selected:hover{
    background-color: var(--primary);
    transform: none;
}
/* Student */
.student-card:hover{
    background-color: var(--gray-light);
}
.avatar-wrapper{
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 1rem;
}
.profile-avatar {
    width: 50px; 
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--gray);
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
    cursor: pointer;
}
.profile-avatar-large {
    width: 100px;
    height: 100px;
}
.avatar-upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.edit-icon {
    position: absolute;
    bottom: 7.5px;
    left: calc(50% - 50px);
    background-color: var(--primary);
    color: white;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 11px;
    border: 2px solid var(--gray);
}
/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}
.modal-content {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 500px;
    overflow: hidden;
    transform: scale(0.9);
    opacity: 0;
    animation: modalAppear 0.3s forwards;
}
.modal-content.modal-m{
    max-width: 560px;
    min-height: 0;
}
.modal-content.modal-lg {
    max-width: 700px;
}
.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--primary);
    color: white;
}
.modal-title {
    font-size: 1.2rem;
    font-weight: 600;
}
.modal-footer{
    width: 100%;
    display: flex; 
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
}
.close-modal {
    background: none;
    border: none;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.close-modal:hover {
    background: rgba(255, 255, 255, 0.2);
}
.modal-body {
    padding: 1.5rem;
}
.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark);
}
.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: var(--transition);
    background: var(--light);
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}
.filter-controls{
    padding: 1rem;
    padding-bottom: 0;
    display: flex;
    gap: .5rem;
}
.filter-controls .form-control{
    width: 20%;
    padding: .8rem;
    font-size: 0.8rem;

}
.filter-controls select.form-control{
    width: 8%;
}
.detail-form-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: 1fr 1fr;
    padding: 16px 0;
}
.detail-form-grid .form-group {
    margin-bottom: 0;
}
.btn-danger {
    background: var(--accent);
    color: white;
}
.btn-danger:hover {
    background: #ff5252;
}
/* Chat Styles */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 224px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    overflow: hidden;
    background-color: var(--light);
}
.chat-messages {
    background-color: var(--gray-light);
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.chat-input-area {
    background-color: var(--light);
    padding: 15px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    align-items: center;
}
.chat-input {
    background-color: var(--gray-light);
    flex: 1;
    padding: 1rem .75rem;
    border: 1px solid #ddd;
    border-radius: 25px;
    outline: none;
    transition: 0.3s;
}
.chat-input:focus {
    border-color: var(--primary);
}
.btn-send {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: 0.3s;
}
.btn-send:hover {
    transform: scale(1.1);
}
.message-bubble {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 15px;
    position: relative;
    font-size: 0.95rem;
    line-height: 1.5;
}
.message-left {
    align-self: flex-start;
    background-color: var(--light);
    border-bottom-left-radius: 2px;
}
.message-right {
    align-self: flex-end;
    background-color: var(--light);
    color: var(--dark);
    border-bottom-right-radius: 2px;
}
.message-info {
    font-size: 0.75rem;
    color: #888;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.message-time {
    font-size: 0.7rem;
    color: #aaa;
    margin-top: 5px;
    text-align: left;
    display: block;
}
.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    margin-left: .5rem;
}
.grade-actions{
    display: flex; 
    gap: 4px;
    align-items:center;
}
.small{
    font-size: 0.8rem; 
    color: var(--dark-light);
}
.student-card{
    display: flex; 
    align-items: center; 
    padding: 1rem; 
    border-bottom: 1px solid var(--border); 
    transition: var(--transition); 
    cursor: pointer;
}
.th, td{
    padding: .75rem;
}
.table-responsive{
    max-height: 50vh;
    overflow-y: auto;
}
.toggle-switch {
    position: relative;
    width: 46px;
    height: 24px;
}
.toggle-switch input { 
    opacity: 0; 
    width: 0; 
    height: 0; 
}
.slider {
    position: absolute; cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--dark);
    transition: .4s; border-radius: 34px;
}
.slider:before {
    position: absolute; content: "";
    height: 18px; width: 18px; left: 3px; bottom: 3px;
    background-color: var(--light); transition: .4s; border-radius: 50%;
}
input:checked + .slider { 
    background-color: var(--primary); 
}
input:checked + .slider:before { 
    transform: translateX(22px); 
}
.setting-row{
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 1rem 0;
}
.chat-widget {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 380px;
    height: 500px;
    background: var(--light);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: all 0.3s ease;
    border: 1px solid rgba(43,134,216,0.1);
    direction: rtl;
}
.chat-widget.minimized {
    height: 60px;
}
.chat-widget.hidden {
    display: none;
}
.chat-header {
    background: linear-gradient(135deg, var(--primary), #3fb0ff);
    color: white;
    padding: 12px 16px;
    border-radius: var(--radius) var(--radius) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}
.chat-title {
    display: flex;
    align-items: center;
    gap: 12px;
}
.ai-avatar {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}
.chat-info {
    display: flex;
    flex-direction: column;
}
.chat-name {
    font-weight: 600;
    font-size: 14px;
}
.chat-status {
    font-size: 11px;
    opacity: 0.9;
}
.chat-actions {
    display: flex;
    gap: 8px;
}
.chat-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: 0.3s ease;
}
.chat-btn:hover {
    background: rgba(255,255,255,0.3);
}
.chat-body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: var(--light);
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.chat-widget.minimized .chat-body {
    display: none;
}
.chat-inner {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.message {
    display: flex;
    gap: 4px;
    max-width: 85%;
    animation: messageSlide 0.3s ease;
}
.bot-message {
    align-self: flex-start;
    flex-direction: row;
}
.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}
.message-avatar {
    background: var(--primary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: white;
    flex-shrink: 0;
}
.message-content {
    background: var(--gray-light);
    padding: 10px 14px;
    border-radius: 18px;
    position: relative;
    max-width: calc(100% - 40px);
}
.message-text {
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
    word-wrap: break-word;
    text-align: right;
    white-space: pre-line;
}
.message-time {
    font-size: 11px;
    opacity: 0.9;
    margin-top: 6px;
    text-align: left;
}
.user-message .message-time {
    text-align: right;
}
.typing-indicator {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg2);
    border-radius: 18px;
    align-self: flex-start;
    max-width: 80px;
}
.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}
.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--dark);
    border-radius: 50%;
    animation: typingAnimation 1.4s infinite ease-in-out;
}
.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
.chat-footer {
    padding: 16px;
    border-top: 1px solid rgba(43,134,216,0.1);
    background: var(--light);
}
.chat-widget.minimized .chat-footer {
    display: none;
}
.chat-input-container {
    display: flex;
    gap: 10px;
    align-items: center;
}
.ai-chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid rgba(43,134,216,0.2);
    border-radius: 24px;
    outline: none;
    font-size: 14px;
    background: var(--bg2);
    color: inherit;
    direction: rtl;
    text-align: right;
}
.ai-chat-input::placeholder {
    color: var(--dark);
    text-align: right;
}
.send-btn {
    background: var(--primary);
    border: none;
    color: white;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s ease;
    flex-shrink: 0;
}
.send-btn:hover {
    background: #2b7eda;
}
.send-btn:disabled {
    background: var(--dark);
    cursor: not-allowed;
}
.chat-toggle-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary), #3fb0ff);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    touch-action: none;
}
.chat-toggle-btn:hover {
    transform: scale(1.1);
}
/* Responsive */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .header-actions {
        width: 100%;
        justify-content: space-between;
    }
    .sidebar-toggle-btn{
        display: none;
    }
    .filter-controls .form-control{
        width: 40%;
        padding: .8rem;
        font-size: 0.8rem;

    }
    .filter-controls select.form-control{
        width: 16%;
    }
    .chat-container {
        height: calc(100vh - 304px);
    }
}
@media (max-width: 425px) {
    .hide{
        display: none;
    }
    .sidebar {
        padding: .75rem 0;
    }
    .sidebar-header {
        margin-bottom: .5rem;
        padding-bottom: .5rem;
    }
    body.sidebar-closed .sidebar {
        width: 40px;
    }
    body.sidebar-closed .main-content {
        margin-right: 40px;
    }
    .logo{
        justify-content: center;
        width: 100%;
    }
    .logo-icon {
        width: 28px;
        height: 28px;
        border-radius: 8px;
        font-size: .75rem;
    }
    .nav-item {
        margin-bottom: 0.75rem;
    }
    .nav-link {
        padding: 0.5rem .75rem;
    }
    .nav-link::before {
        width: 2px;
    }
    .nav-icon {
        font-size: .8rem;
        width: 20px;
    }
    .nav-text {
        font-size: .7rem;
    }
    .main-content {
        padding: 1rem;
    }
    .header {
        padding: 0;
    }
    .page-title{
        display: none;
    }
    .page-title h1 {
        font-size: .9rem;
    }
    .page-title p {
        font-size: 0.7rem;
    }
    .header-actions {
        gap: .5rem;
    }
    .date-display {
        padding: 0.5rem .75rem;
        gap: 0.5rem;
        font-size: .7rem;
    }
    .notification-bell {
        display: none;
    }
    .user-profile {
        gap: .5rem;
        padding: 0.5rem;
    }
    .user-name {
        font-size: .75rem;
        max-width: 80px;
        white-space: nowrap; 
        overflow: hidden;
    }
    .user-role {
        font-size: 0.7rem;
    }
    .user-avatar {
        width: 38px;
        height: 38px;
        font-size: .75rem;
    }
    .profile-dropdown {
        top: 55px;
    }
    .profile-dropdown a {
        padding: .75rem;
        font-size: .7rem;
    }
    .profile-dropdown a i {
        margin-left: .25rem;
    }
    .stats-grid {
        gap: 1rem;
        margin-bottom:1rem;
    }
    .stat-card {
        padding: 1rem;
        gap: .5rem;
    }
    .stat-icon {
        width: 32px;
        height: 32px;
        font-size: .8rem;
    }
    .stat-value {
        font-size: .85rem;
    }
    .stat-label {
        font-size: 0.7rem;
    }
    .card-body {
        padding: 1rem;
    }
    .dashboard-grid {
        gap: 1rem;
    }
    .card-header {
        padding: .75rem 1rem;
    }
    .card-title {
        font-size: .8rem;
    }
    .btn {
        gap: 0.5rem;
        padding: 0.5rem .75rem;
        font-size: 0.5rem;
    }
    .btn-icon {
        width: 26px;
        height: 26px;
    }
    .classes-list {
        max-height: 280px;
    }
    .class-item {
        padding: .5rem;
    }
    .class-color {
        width: 8px;
        height: 26px;
        margin-left: .5rem;
    }
    .class-name {
        font-size: .75rem;
    }
    .class-actions {
        gap: 0.3rem;
    }
    .announcements-list {
        max-height: 280px;
    }
    .announcement-item {
        padding: .5rem;
    }
    .announcement-title {
        font-size: .75rem;
    }
    .announcement-date {
        font-size: 0.6rem;
    }
    .announcement-content {
        font-size: 0.5rem;
        line-height: 1.5;
        padding-left: 5%;
    }
    .chart-container {
        height: 200px;
    }
    .calendar {
        padding: .5rem;
    }
    .calendar-header {
        margin-bottom: 1rem;
    }
    .calendar-title {
        font-size: .75rem;
    }
    .calendar-day {
        font-size: 0.6rem;
        padding: 0.4rem;
        cursor: default;
    }
    .calendar-date {
        height: 28px;
        padding: 4px;
        font-size: .6rem;
    }
    .student-card{
        padding: .5rem;
    }
    .avatar-wrapper{
        margin-left: .5rem;
    }
    .profile-avatar {
        width: 40px; 
        height: 40px;
    }
    .profile-avatar-large {
        width: 75px;
        height: 75px;
    }
    .modal-content {
        width: 100%;
        max-width: 70%;
    }
    .modal-content.modal-m{
        max-width: 80%;
    }
    .modal-content.modal-lg {
        max-width: 90%;
    }
    .modal-header {
        padding: .75rem 1rem;
    }
    .modal-title {
        font-size: .8rem;
    }
    .modal-body {
        padding: 1rem;
    }
    .form-group {
        margin-bottom: .75rem;
    }
    .form-group label {
        margin-bottom: 0.5rem;
        font-size: .8rem;
    }
    .form-control {
        padding: 0.5rem .75rem;
        font-size: 0.6rem;
    }
    .form-actions {
        gap: 0.5rem;
        margin-top: 1rem;
    }
    .filter-controls{
        padding: .75rem;
        gap: .5rem;
    }
    .filter-controls .form-control{
        width: 40%;
        padding: 0.5rem .75rem;
        font-size: 0.6rem;
    }
    .filter-controls select.form-control{
        width: 25%;
    }
    .detail-form-grid {
        gap: .75rem;
        padding: .75rem 0;
    }
    .grade-actions{
        flex-direction: column;
    }
    .title{
        font-size: .8rem;
    }
    .small{
        font-size: .6rem;
    }
    .chat-container {
        height: calc(100vh - 166px);
    }
    .chat-messages {
        padding: 1rem;
        gap: .75rem;
    }
    .chat-input-area {
        padding: .75rem;
        gap: .5rem;
    }
    .chat-input {
        padding: .5rem;
        font-size: .6rem;
    }
    .btn-send {
        width: 32px;
        height: 32px;
        font-size: .8rem;
    }
    .message-bubble {
        padding: .5rem .75rem;
        font-size: 0.7em;
        line-height: 1.5;
    }
    .message-info {
        font-size: 0.6rem;
    }
    .message-time {
        font-size: 0.5rem;
    }
    .chat-avatar {
        width: 25px;
        height: 25px;
    }
    .th, td{
        padding: .5rem;
        font-size: .6rem;
    }
    tr th{
        font-size: .6rem;
    }
    .table-responsive{
        max-height: none;
    }
    .chat-widget {
        bottom: 12px;
        left: 12px;
        width: calc(100vw - 24px);
        height: 70vh;
    }
    .chat-toggle-btn {
        bottom: 12px;
        left: 12px;
        width: 48px;
        height: 48px;
    }
    .chat-toggle-btn svg{
        transform: scale(.8);
    }
    .ai-chat-input {
        padding: 8px 12px;
        font-size: 12px;
    }
    .ai-chat-input::placeholder{
        font-size: 12px;
    }
    .send-btn {
        width: 36px;
        height: 36px;
    }
    .send-btn svg{
        transform: scale(.8);
    }
    .chat-footer {
        padding: 12px;
    }
    .chat-input-container {
        gap: 4px;
    }
}
.fade-in {
    animation: fadeIn 0.5s ease-out;
}
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--primary);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb {
    background: var(--light);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    cursor: pointer;
}
body.dark-mode {
    --light: #0f172a;
    --dark: #f8fafc;
    --dark-light: #cbd5e1;
    --gray-light: #1e293b;
    --border: #334155;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    background-color: var(--light);
}
body.dark-mode .card, 
body.dark-mode .date-display, 
body.dark-mode .notification-bell,
body.dark-mode .form-control,
body.dark-mode .modal-content,
body.dark-mode .stat-card,
body.dark-mode .user-profile:hover,
body.dark-mode .profile-dropdown{
    background: var(--gray-light) !important;
    color: #f8fafc;
    border-color: #334155;
}
body.dark-mode .profile-dropdown a:hover,
body.dark-mode .calendar-date:not(.empty):hover{
    background: var(--light) !important;
}
body.dark-mode .header h1, 
body.dark-mode .card-title,
body.dark-mode .chat-input {
    color: #f8fafc;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes modalAppear {
    to {
        transform: scale(1);
        opacity: 1;
    }
}
@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
@keyframes typingAnimation {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}