/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

.dashboard-grid-2-col {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.chart-placeholder {
    height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-light);
    border-radius: 1rem;
    border: 2px dashed var(--border-color);
}
.chart-placeholder p {
    font-weight: 500;
    color: var(--text-light);
}

.list-group {
    list-style: none;
    padding: 0;
    margin: 0;
}
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}
.list-item:last-child {
    border-bottom: none;
}
.list-item span {
    font-weight: 500;
}
.rating-badge {
    background-color: var(--admin-color);
    color: var(--white-color);
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
}

.next-class-info h3 {
    font-size: 1.5rem;
    margin: 0.5rem 0;
}
.next-class-info p {
    font-size: 1.1rem;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.next-class-card {
    background-color: var(--dark-color);
    color: var(--white-color);
}
.next-class-card .next-class-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
}
.next-class-card h3 {
    color: var(--white-color);
}
.next-class-card p {
    color: #d1d5db;
}

.action-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}
.action-item p {
    font-size: 1.1rem;
    font-weight: 500;
}

.btn-secondary {
    background-color: var(--border-color);
    color: var(--text-dark);
}
.btn-secondary:hover {
    background-color: #d1d5db;
}

@media (max-width: 1200px) {
    .dashboard-grid-2-col {
        grid-template-columns: 1fr;
    }
}

/*
================================================================================
  1. ROOT VARIABLES & GLOBAL STYLES
================================================================================
*/
:root {
    --brand-color: #af573b;
    --brand-color-light: #fde8e1;
    --dark-color: #1f2937;
    --bg-light: #f9fafb;
    --border-color: #e5e7eb;
    --text-dark: #374151;
    --text-light: #6b7280;
    --white-color: #fff;
    --danger-color: #ef4444;
    --success-color: #10b981;

    --font-family-base: 'Inter', sans-serif;
    --header-height: 70px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family-base);
    background-color: var(--bg-light);
    color: var(--text-dark);
    font-size: 16px;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: var(--brand-color);
}

/*
================================================================================
  2. LOGIN PAGE STYLES
================================================================================
*/
.login-page-body {
    background-color: var(--dark-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
}

.login-container {
    width: 100%;
    max-width: 480px;
}

.login-box {
    background: var(--white-color);
    padding: 3rem;
    border-radius: 1.5rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.login-box .logo {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-box .logo img {
    height: 50px;
    margin-bottom: 1rem;
}

.login-title {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.login-intro {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 2.5rem;
    font-size: 1.1rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 600;
    font-size: 1rem;
}

.input-group {
    position: relative;
}

.input-group i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 1.25rem;
}

.form-control {
    width: 100%;
    padding: 0.9rem 1rem 0.9rem 3rem;
    border-radius: 0.75rem;
    border: 1px solid #ced4da;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--brand-color);
    box-shadow: 0 0 0 3px var(--brand-color-light);
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    text-decoration: none;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    border: none;
    font-size: 1.1rem;
    width: 100%;
    transition: background-color 0.2s;
}

.btn-primary {
    background-color: var(--brand-color);
    color: white;
}
.btn-primary:hover {
    background-color: #9a4c32;
}

.alert {
    padding: 1rem;
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.alert-danger {
    background-color: #fee2e2;
    color: #b91c1c;
    font-weight: 500;
}
.alert i {
    font-size: 1.5rem;
}

.forgot-password {
    text-align: center;
    margin-top: 1.5rem;
}

.forgot-password a {
    color: var(--text-light);
    font-size: 0.9rem;
    font-weight: 500;
}

/*
================================================================================
  3. MAIN APPLICATION LAYOUT & NAVIGATION
================================================================================
*/

.top-nav {
    position: sticky;
    top: 0;
    width: 100%;
    height: var(--header-height);
    background-color: var(--dark-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-left {
    display: flex;
    align-items: center;
}
.logo-container {
    display: flex;
    align-items: center;
}
.logo-container img {
    height: 35px;
    width: auto;
}

.nav-menu {
    display: flex;
    align-items: center;
    margin-left: 2.5rem;
}

.nav-menu a {
    color: var(--white-color);
    padding: 0.5rem 1rem;
    margin: 0 0.5rem;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: background-color 0.2s;
    font-size: 1rem;
}

.nav-menu a.active,
.nav-menu a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.nav-right {
    display: flex;
    align-items: center;
}

.profile-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.profile-name {
    color: var(--white-color);
    font-weight: 500;
}

.logout-btn {
    color: var(--white-color);
    font-size: 1.5rem;
    transition: color 0.2s;
}
.logout-btn:hover {
    color: var(--brand-color);
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--white-color);
    font-size: 2rem;
    cursor: pointer;
}

.mobile-nav-menu {
    display: none;
    background: var(--dark-color);
    padding: 1rem;
}
.mobile-nav-menu a {
    display: block;
    color: var(--white-color);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
}
.mobile-nav-menu a.active {
    background-color: var(--brand-color);
}
.mobile-nav-menu.active {
    display: block;
}

.main-container {
    width: 100%;
}

.content-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2.5rem;
}

.page-header {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--dark-color);
}

/*
================================================================================
  4. UI COMPONENTS (CARDS, BUTTONS, FORMS, TABLES)
================================================================================
*/

/* --- Cards --- */
.card {
    background-color: var(--white-color);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    margin-bottom: 2rem;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.card-body {
    padding: 1.5rem;
}

/* --- Dashboard Stat Cards --- */
.stat-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background-color: var(--white-color);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
}

.stat-icon {
    font-size: 2.5rem;
    padding: 1rem;
    border-radius: 50%;
    margin-right: 1.5rem;
}
.stat-icon.admin { background-color: #fffbeb; color: var(--admin-color); }
.stat-icon.teacher { background-color: #eff6ff; color: var(--teacher-color); }
.stat-icon.student { background-color: #f0fdf4; color: var(--student-color); }

.stat-info .stat-value {
    font-size: 2.25rem;
    font-weight: 700;
}
.stat-info .stat-label {
    font-size: 1rem;
    color: var(--text-light);
}

/* --- Tables --- */
.table-wrapper {
    overflow-x: auto;
}
.styled-table {
    width: 100%;
    border-collapse: collapse;
}
.styled-table th, .styled-table td {
    padding: 1rem 1.25rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
.styled-table thead th {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-light);
}
.styled-table tbody tr:hover {
    background-color: var(--bg-light);
}
.styled-table td {
    font-size: 1rem;
}

/*
================================================================================
  5. MOBILE RESPONSIVENESS
================================================================================
*/
@media (max-width: 900px) {
    .nav-menu, .profile-name {
        display: none;
    }
    .mobile-menu-toggle {
        display: block;
    }
    .content-wrapper {
        padding: 1.5rem;
    }
    .page-header {
        font-size: 2rem;
    }
}

@media (max-width: 600px) {
    body {
        padding: 0;
    }
    .login-page-body {
        padding: 1rem;
    }
    .login-box {
        padding: 2rem;
    }
    .top-nav {
        padding: 0 1rem;
    }
    .content-wrapper {
        padding: 1rem;
    }
    .stat-card-grid {
        grid-template-columns: 1fr;
    }
}

/*
================================================================================
  6. MODAL STYLES
================================================================================
*/
.modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: #fff;
    margin: 10% auto;
    border-radius: 1rem;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    animation: slideIn 0.3s;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}
.close-btn {
    color: var(--text-light);
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
}
.close-btn:hover {
    color: var(--text-dark);
}

.modal-body {
    padding: 1.5rem;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideIn {
  from { transform: translateY(-50px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/*
================================================================================
  7. ACTION BUTTONS & MISC
================================================================================
*/
.btn-action {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.2s;
}
.btn-edit { color: var(--teacher-color); }
.btn-delete { color: var(--danger-color); }

.btn-action:hover {
    background-color: var(--border-color);
}

/*
================================================================================
  8. KANBAN BOARD STYLES
================================================================================
*/
.kanban-board {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    padding: 1rem 0;
    min-height: 500px;
}

.kanban-column {
    flex: 1;
    min-width: 300px;
    background-color: var(--bg-light);
    border-radius: 1rem;
}

.kanban-column-header {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid;
}

.kanban-column-header h3 {
    font-size: 1.25rem;
    margin: 0;
}

.kanban-column-header span {
    background-color: var(--border-color);
    color: var(--text-dark);
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
}

.kanban-cards {
    padding: 1.5rem;
    min-height: 400px; /* To allow dropping cards */
}

.kanban-card {
    background-color: var(--white-color);
    padding: 1rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    margin-bottom: 1rem;
    cursor: grab;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.kanban-card:active {
    cursor: grabbing;
    background-color: #fdf2e9;
}

.kanban-card .card-title {
    font-size: 1.1rem;
    font-weight: 600;
}
.kanban-card .card-subtitle {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

textarea.form-control {
    min-height: 80px;
    padding-top: 0.75rem;
}

/*
================================================================================
  10. CALENDAR STYLES
================================================================================
*/
.calendar-container {
    background-color: var(--white-color);
    border-radius: 1rem;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}
.calendar-header {
    text-align: center;
    margin-bottom: 1.5rem;
}
.calendar-header h2 {
    font-size: 1.75rem;
    margin: 0;
}
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}
.day-name {
    font-weight: 600;
    text-align: center;
    color: var(--text-light);
    padding-bottom: 0.5rem;
}
.day {
    min-height: 120px;
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.5rem;
}
.day.empty {
    background-color: transparent;
    border: none;
}
.day-number {
    font-weight: 500;
}
/*
================================================================================
  11. CALENDAR EVENT STYLES
================================================================================
*/
.events {
    margin-top: 0.5rem;
}
.event {
    display: block;
    background-color: var(--brand-color-light);
    color: var(--brand-color);
    padding: 0.5rem;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    text-decoration: none;
    transition: background-color 0.2s;
}
.event:hover {
    background-color: #fbd3c7;
}
.event-time {
    font-size: 0.8rem;
    font-weight: 500;
    display: block;
}
.event-title {
    font-size: 0.9rem;
    font-weight: 600;
    display: block;
}

/*
================================================================================
  12. ATTENDANCE PAGE STYLES
================================================================================
*/
.attendance-list {
    margin-top: 1rem;
}
.attendance-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    margin-bottom: 1rem;
}
.student-name {
    font-size: 1.1rem;
    font-weight: 500;
}
.attendance-toggle {
    display: flex;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
}
.attendance-toggle label {
    display: inline-block;
}
.attendance-toggle input[type="radio"] {
    display: none; /* Hide the actual radio button */
}
.attendance-toggle .toggle-button {
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
    background-color: var(--bg-light);
    color: var(--text-light);
}

/* Style for when a button is selected */
.attendance-toggle input[type="radio"]:checked + .toggle-button.present {
    background-color: var(--success-color);
    color: white;
}
.attendance-toggle input[type="radio"]:checked + .toggle-button.absent {
    background-color: var(--danger-color);
    color: white;
}

/*
================================================================================
  13. RATING FORM STYLES
================================================================================
*/
.rating-group {
    text-align: center;
    margin-bottom: 2rem;
}
.star-rating {
    display: inline-flex;
    flex-direction: row-reverse; /* This makes the hover effect work correctly */
    font-size: 3.5rem; /* Larger stars for easier clicking */
    color: var(--border-color);
}
.star-rating input {
    display: none; /* Hide the actual radio buttons */
}
.star-rating label {
    cursor: pointer;
    transition: color 0.2s;
    padding: 0 0.25rem;
}

/* This makes the selected star and all stars to its right change color */
.star-rating input:checked ~ label,
/* This handles the hover effect for a better user experience */
.star-rating label:hover,
.star-rating label:hover ~ label {
    color: var(--admin-color); /* Uses the gold/yellow admin color for selected stars */
}

textarea.form-control {
    min-height: 120px;
    padding: 1rem;
    font-size: 1rem;
}


/*
================================================================================
  11. WALLET & COURSE STYLES
================================================================================
*/
.wallet-balance-card {
    background: var(--dark-color);
    color: var(--white-color);
    padding: 2.5rem;
    border-radius: 1.5rem;
    text-align: center;
    margin-bottom: 2.5rem;
}
.wallet-label {
    font-size: 1.25rem;
    font-weight: 500;
    color: #d1d5db;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.wallet-value {
    font-size: 4rem;
    font-weight: 700;
    margin-top: 0.5rem;
    line-height: 1;
}

.top-up-section {
    margin-top: 2rem;
}
.top-up-section h3 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}
.top-up-section p {
    color: var(--text-light);
    margin-bottom: 1.5rem;
    max-width: 600px;
}

.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
}
.course-card {
    background: var(--white-color);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s, transform 0.2s;
}
.course-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.07);
}

.course-card h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 0.75rem;
}
.course-card p {
    color: var(--text-light);
    flex-grow: 1;
    margin-bottom: 1.5rem;
}
.course-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1.5rem 0;
    font-weight: 500;
    font-size: 1rem;
}
.course-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.course-cost {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brand-color);
}

/*
================================================================================
  14. CHAT SYSTEM STYLES
================================================================================
*/
.chat-container {
    display: flex;
    height: calc(100vh - 140px); /* Adjust based on header height */
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    overflow: hidden;
}

/* Sidebar */
.chat-sidebar {
    width: 300px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}
.chat-sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-light);
}
.contact-list {
    flex: 1;
    overflow-y: auto;
}
.contact-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-dark);
    transition: background 0.2s;
}
.contact-item:hover, .contact-item.active {
    background: var(--bg-light);
}
.contact-item .avatar {
    width: 40px;
    height: 40px;
    margin-right: 10px;
}
.contact-item .avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}
.contact-info .name {
    font-weight: 600;
    display: block;
}
.contact-info .last-message {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* Chat Area */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f5f7fb;
}
.chat-header {
    padding: 0.75rem 1.5rem;
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
}
.chat-header .avatar {
    width: 35px;
    height: 35px;
    margin-right: 10px;
}
.chat-header .avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
}
.back-button {
    display: none; /* Hidden on desktop */
    margin-right: 10px;
    font-size: 1.5rem;
    color: var(--text-dark);
}

.messages-list {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    display: flex;
    margin-bottom: 0.5rem;
}
.message.me {
    justify-content: flex-end;
}
.message.them {
    justify-content: flex-start;
}
.message-content {
    max-width: 70%;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    position: relative;
    font-size: 0.95rem;
}
.message.me .message-content {
    background: var(--brand-color);
    color: #fff;
    border-bottom-right-radius: 0;
}
.message.them .message-content {
    background: #fff;
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 0;
}
.message .time {
    display: block;
    font-size: 0.7rem;
    margin-top: 4px;
    opacity: 0.7;
    text-align: right;
}

.chat-input-area {
    padding: 1rem;
    background: #fff;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.chat-input-area input[type="text"] {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 2rem;
    outline: none;
}
.send-btn, .attachment-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--brand-color);
    cursor: pointer;
    padding: 0.5rem;
    transition: transform 0.2s;
}
.send-btn:hover {
    transform: scale(1.1);
}

.no-chat-selected {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
}
.no-chat-selected i {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: var(--border-color);
}

/* Mobile Responsiveness for Chat */
@media (max-width: 768px) {
    .chat-sidebar {
        width: 100%;
        border-right: none;
    }
    .chat-sidebar.hidden-on-mobile {
        display: none;
    }
    .chat-area.hidden-on-mobile {
        display: none;
    }
    .back-button {
        display: block;
    }
    .chat-container {
        height: calc(100vh - 80px); /* Full height minus header */
        border: none;
        border-radius: 0;
    }
}
