/* --- Import Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Noto+Nastaliq+Urdu:wght@400;700&family=Poppins:wght@300;400;600;700&display=swap');

/* --- CSS Variables for Modern Theme --- */
:root {
    --bg-color: #1a1a2e;
    --main-accent-color: #e94560;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border-color: rgba(255, 255, 255, 0.2);
    --text-primary: #f0f0f0;
    --text-secondary: #a0a0b0;
    --sidebar-width: 280px;
    --border-radius: 15px;
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);

    /* Color scheme for cards and widgets */
    --color-students: #3498db;
    --color-teachers: #9b59b6;
    --color-attendance: #2ecc71;
    --color-income: #f1c40f;
    --color-fees: #1abc9c;
    --color-exam: #e67e22;
    --color-notice: #e74c3c;
    --color-reports: #34495e;
}

/* --- General Body Styles --- */
body {
    font-family: 'Poppins', 'Noto Nastaliq Urdu', sans-serif;
    margin: 0;
    background-color: var(--bg-color);
    color: var(--text-primary);
    background-image: linear-gradient(135deg, #1a1a2e 0%, #16213e 74%);
    overflow: hidden;
}

/* --- Dashboard Layout --- */
.dashboard-container { display: flex; height: 100vh; }

/* --- Sidebar Styles --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-right: 1px solid var(--glass-border-color);
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
}

.sidebar-header {
    padding: 25px;
    text-align: center;
    font-size: 2.2rem;
    font-weight: 700;
    border-bottom: 1px solid var(--glass-border-color);
    color: var(--main-accent-color);
}
.sidebar-header h2 i { margin-left: 12px; }

.sidebar-nav { flex-grow: 1; overflow-y: auto; }
.sidebar-nav ul { list-style: none; padding: 0; margin: 20px 0; }

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 16px 30px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 1.05rem;
    transition: all 0.3s ease;
    position: relative;
}

.sidebar-nav a i {
    margin-left: 18px;
    font-size: 1.25rem;
    width: 25px;
    text-align: center;
    transition: color 0.3s ease;
}

.sidebar-nav a:hover {
    background: rgba(233, 69, 96, 0.1);
    color: var(--text-primary);
}
.sidebar-nav a:hover i { color: var(--main-accent-color); }

.sidebar-nav li.active a {
    color: var(--text-primary);
    font-weight: 600;
    background: linear-gradient(90deg, rgba(233, 69, 96, 0.2), transparent);
}
.sidebar-nav li.active a::before {
    content: '';
    position: absolute;
    right: 0; top: 0; height: 100%; width: 4px;
    background-color: var(--main-accent-color);
}
.sidebar-nav li.active a i { color: var(--main-accent-color); }

/* --- Main Content --- */
.main-content { flex-grow: 1; display: flex; flex-direction: column; overflow: hidden; }

/* --- Header --- */
.header {
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
}

.header-title h1 { margin: 0; font-size: 1.8rem; font-weight: 700; }
.header-title p { margin: 5px 0 0; color: var(--text-secondary); }

.header-user { display: flex; align-items: center; gap: 20px; }
.header-icon-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border-color);
    color: var(--text-secondary);
    font-size: 1.1rem;
    width: 45px; height: 45px;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}
.header-icon-btn:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }
.notification-badge {
    position: absolute; top: -5px; right: -5px;
    background: var(--main-accent-color); color: #fff;
    border-radius: 50%; width: 20px; height: 20px;
    font-size: 0.7rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.user-avatar { border-radius: 50%; width: 50px; height: 50px; border: 2px solid var(--main-accent-color); }

/* --- Content Area --- */
.content-area { padding: 0 40px 40px 40px; flex-grow: 1; overflow-y: auto; }
.content-area::-webkit-scrollbar { width: 8px; }
.content-area::-webkit-scrollbar-track { background: transparent; }
.content-area::-webkit-scrollbar-thumb { background: var(--glass-border-color); border-radius: 10px; }

/* --- Stats Cards --- */
.stats-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 25px; }
.card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border-color);
    border-left: 5px solid;
    border-radius: var(--border-radius);
    padding: 25px;
    display: flex; align-items: center; gap: 20px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, background 0.3s ease;
}
.card:hover { transform: translateY(-8px); background: rgba(255,255,255,0.1); }

/* Card specific colors */
.card.students { border-color: var(--color-students); }
.card.students .card-icon { color: var(--color-students); }
.card.teachers { border-color: var(--color-teachers); }
.card.teachers .card-icon { color: var(--color-teachers); }
.card.attendance { border-color: var(--color-attendance); }
.card.attendance .card-icon { color: var(--color-attendance); }
.card.income { border-color: var(--color-income); }
.card.income .card-icon { color: var(--color-income); }

.card-icon { font-size: 2.5rem; }
.card-info { flex-grow: 1; text-align: right; }
.card-info h3 { margin: 0; font-size: 1rem; color: var(--text-secondary); font-weight: 400; }
.card-info p { margin: 5px 0 0; font-size: 2rem; font-weight: 700; color: var(--text-primary); }

/* --- Widgets Grid --- */
.widgets-grid {
    margin-top: 30px; display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto auto auto;
    gap: 25px;
}
.widget {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border-color);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow);
    display: flex; flex-direction: column;
}
.large-widget { grid-column: 1 / span 2; grid-row: 1 / span 2; }
.medium-widget { grid-column: 3; grid-row: span 1; }
.long-widget { grid-column: 1 / span 3; grid-row: 3; }

.widget-title { margin: 0 0 20px; font-size: 1.2rem; font-weight: 600; padding-bottom: 15px; border-bottom: 1px solid var(--glass-border-color);}

/* --- Quick Actions Widget --- */
.quick-actions {
    display: grid; grid-template-columns: 1fr 1fr; gap: 15px; flex-grow: 1;
}
.action-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-decoration: none; padding: 15px; border-radius: 10px;
    background: rgba(0,0,0,0.2);
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.action-btn:hover { transform: translateY(-5px); }
.action-btn i { font-size: 1.8rem; margin-bottom: 10px; }
.action-btn span { font-weight: 600; font-size: 0.9rem; }

/* Action button colors */
.action-btn.student { color: var(--color-students); }
.action-btn.student:hover { background: var(--color-students); color: #fff;}
.action-btn.fees { color: var(--color-fees); }
.action-btn.fees:hover { background: var(--color-fees); color: #fff; }
.action-btn.teacher { color: var(--color-teachers); }
.action-btn.teacher:hover { background: var(--color-teachers); color: #fff; }
.action-btn.exam { color: var(--color-exam); }
.action-btn.exam:hover { background: var(--color-exam); color: #fff; }
.action-btn.notice { color: var(--color-notice); }
.action-btn.notice:hover { background: var(--color-notice); color: #fff; }
.action-btn.reports { color: var(--color-reports); }
.action-btn.reports:hover { background: var(--color-reports); color: #fff; }


/* --- Absent List Widget --- */
.absent-list { list-style: none; padding: 0; margin: 0; flex-grow: 1; display: flex; flex-direction: column; gap: 15px;}
.absent-list li {
    display: flex; align-items: center; gap: 15px;
    background: rgba(0,0,0,0.15); padding: 12px; border-radius: 10px;
}
.absent-list .student-photo { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.absent-list span { flex-grow: 1; font-size: 0.95rem; }
.absent-list strong { color: var(--text-primary); }
.btn-sm-notify {
    background: var(--main-accent-color); color: #fff; border: none; padding: 6px 12px;
    border-radius: 8px; cursor: pointer; font-size: 0.8rem; transition: background 0.3s;
}
.btn-sm-notify:hover { background: #d6304b; }
.btn-sm-notify.disabled { background: var(--text-secondary); cursor: not-allowed; }

/* --- Notice Board Widget --- */
.notice-board-list { list-style: none; padding: 0; margin: 0; }
.notice-board-list li {
    display: flex; align-items: baseline; gap: 15px; padding: 12px 0;
    border-bottom: 1px solid var(--glass-border-color);
}
.notice-board-list li:last-child { border: none; }
.notice-date {
    background: var(--main-accent-color); color: #fff; padding: 5px 10px;
    border-radius: 8px; font-size: 0.8rem; font-weight: 600; white-space: nowrap;
}
.notice-board-list p { margin: 0; color: var(--text-secondary); font-size: 0.95rem; }

/* --- Chart JS --- */
#performanceChart { max-height: 100%; }
