/* ================================================================= */
/* THE STUDY HOME - ADMIN CSS                                        */
/* ================================================================= */
:root {
    --primary: #268C98; --primary-dark: #1e707a; --dark: #0f172a; --light-bg: #f1f5f9;
    --white: #ffffff; --text-main: #334155; --text-light: #64748b; --danger: #ef4444;
    --success: #10b981; --warning: #f59e0b; --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; }
body { background: var(--light-bg); display: flex; min-height: 100vh; color: var(--text-main); }
.sidebar { width: 260px; background: var(--dark); color: var(--white); display: flex; flex-direction: column; padding: 25px; position: fixed; height: 100%; overflow-y: auto; z-index: 100; transition: transform 0.3s ease; }
.brand { display: flex; align-items: center; gap: 15px; padding-bottom: 25px; border-bottom: 1px solid rgba(255,255,255,0.1); margin-bottom: 25px; }
.brand img { width: 45px; border-radius: 8px; border: 2px solid var(--primary); }
.brand h3 { font-family: 'Poppins', sans-serif; font-size: 18px; font-weight: 700; letter-spacing: 0.5px; }
.side-menu { list-style: none; flex-grow: 1; }
.menu-header { font-size: 11px; color: #94a3b8; margin: 25px 0 10px; letter-spacing: 1.2px; text-transform: uppercase; font-weight: 700; }
.side-menu li { margin-bottom: 8px; }
.side-menu a { text-decoration: none; color: #cbd5e1; display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-radius: 10px; transition: all 0.2s ease; font-size: 14px; font-weight: 500; cursor: pointer; }
.side-menu a:hover, .side-menu li.active a { background: var(--primary); color: var(--white); transform: translateX(5px); box-shadow: 0 4px 12px rgba(38, 140, 152, 0.4); }
.logout-btn { color: #f87171 !important; margin-top: auto; }
.logout-btn:hover { background: rgba(239, 68, 68, 0.1) !important; color: #ef4444 !important; box-shadow: none !important; transform: none !important; }
.main-content { margin-left: 260px; flex-grow: 1; padding: 30px 40px; width: calc(100% - 260px); transition: margin 0.3s ease, width 0.3s ease; }
.top-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 35px; }
.top-header h2 { color: var(--dark); font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 24px; }
.content-section { display: none; animation: fadeIn 0.4s ease-out; }
.content-section.active-section { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* CARDS & GRIDS */
.card-box { background: var(--white); padding: 25px; border-radius: 16px; box-shadow: var(--shadow); margin-bottom: 25px; border: 1px solid var(--border); }
h3.box-title { font-family: 'Poppins', sans-serif; font-size: 16px; color: var(--dark); text-transform: uppercase; font-weight: 700; margin-bottom: 20px; padding-bottom: 10px; border-bottom: 2px solid var(--light-bg); }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 30px; }
.stat-card { background: var(--white); padding: 25px; border-radius: 16px; box-shadow: var(--shadow); transition: transform 0.2s; border: 1px solid var(--border); }
.stat-card:hover { transform: translateY(-5px); }
.stat-card div:first-child { font-size: 11px; color: var(--text-light); text-transform: uppercase; font-weight: 800; letter-spacing: 0.5px; }
.stat-val { font-family: 'Poppins', sans-serif; font-size: 28px; margin-top: 5px; color: var(--dark); font-weight: 700; }

.stat-sub { margin-top: 15px; font-size: 11.5px; color: var(--text-light); display: flex; gap: 10px; align-items: center; justify-content: flex-start; padding-top: 12px; border-top: 1px dashed var(--border); font-weight: 500; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }

.charts-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 30px; }
.chart-box { background: white; padding: 25px; border-radius: 16px; border: 1px solid var(--border); height: 400px; display: flex; flex-direction: column; }
.chart-box canvas { width: 100% !important; flex-grow: 1; max-height: calc(100% - 40px); }

/* FORMS & BUTTONS */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 20px; }
.full-width { grid-column: 1 / -1; }
.form-group label, label { display: block; font-size: 11px; font-weight: 700; margin-bottom: 6px; color: var(--text-light); text-transform: uppercase; }
.form-group input, .form-group select, input, select, textarea { width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; color: var(--text-main); background: var(--white); transition: 0.2s; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(38, 140, 152, 0.1); }
.btn-primary { background: var(--dark); color: var(--white); border: none; padding: 12px 25px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; transition: 0.2s; display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; }
.btn-primary:hover { background: #1e293b; transform: translateY(-1px); }
.btn-success { background: var(--success); color: white; border: none; padding: 12px 25px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: bold; width: 100%; margin-top: 15px; transition: 0.2s; }
.btn-success:hover { background: #0ea5e9; }

/* TABLES & BADGES */
.data-table { width: 100%; border-collapse: collapse; min-width: 100%; }
.data-table thead { background: #f8fafc; }
.data-table th { padding: 15px; text-align: left; font-size: 11px; font-weight: 700; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border); }
.data-table td { padding: 12px 15px; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-main); vertical-align: middle; }
.data-table tr:hover { background: #fdfdfd; }
.table-img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); }
.status-badge { padding: 4px 10px; border-radius: 20px; font-size: 10px; font-weight: 700; text-transform: uppercase; display: inline-block; }
.status-active { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.status-inactive { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* MODALS */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.6); z-index: 1000; justify-content: center; align-items: center; backdrop-filter: blur(4px); }
.modal-content { background: var(--white); width: 850px; max-width: 95%; border-radius: 16px; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1); overflow: hidden; animation: slideUp 0.3s ease-out; max-height: 90vh; display: flex; flex-direction: column; }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header { background: var(--dark); color: var(--white); padding: 18px 25px; display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-family: 'Poppins', sans-serif; font-size: 16px; margin: 0; }
.modal-body { padding: 30px; overflow-y: auto; }
.modal-footer { padding: 20px; background: #f8fafc; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.btn-save { background: var(--primary); color: white; border: none; padding: 10px 25px; border-radius: 8px; font-weight: 600; cursor: pointer; }
.btn-save:hover { background: var(--primary-dark); }
.btn-cancel { background: white; border: 1px solid var(--border); color: #64748b; padding: 10px 20px; border-radius: 8px; font-weight: 600; cursor: pointer; }
.profile-img-edit { width: 100px; height: 100px; border-radius: 10px; object-fit: cover; border: 2px solid var(--border); display: block; margin-bottom: 0px; }
.mark-input { width: 60px; padding: 6px; text-align: center; font-weight: 600; border: 1px solid var(--border); border-radius: 4px; font-size: 14px; }
.mark-input:focus { border-color: var(--primary); outline: none; }


/* ================================================================= */
/* --- NEW: MOBILE RESPONSIVE FIXES ---                              */
/* ================================================================= */

/* Hidden by default on desktop */
.menu-toggle-btn { display: none; background: none; border: none; font-size: 24px; color: var(--dark); cursor: pointer; padding: 5px; }
.mobile-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 90; backdrop-filter: blur(2px); }

@media (max-width: 1024px) {
    .charts-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    /* 1. Sidebar Management */
    .sidebar { transform: translateX(-100%); box-shadow: 4px 0 15px rgba(0,0,0,0.2); }
    .sidebar.mobile-open { transform: translateX(0); }
    .mobile-overlay.mobile-open { display: block; }
    
    .main-content { margin-left: 0; width: 100%; padding: 20px 15px; }
    .menu-toggle-btn { display: block; }
    
    /* 2. Hide extra header text to save space */
    .admin-role-text { display: none !important; }
    .top-header h2 { font-size: 20px; }
    
    /* 3. Stack Grids */
    .stats-grid { grid-template-columns: 1fr; gap: 15px; }
    
    /* 4. Fix Flexboxes (Headers inside cards) */
    .card-box > div[style*="justify-content:space-between"] {
        flex-direction: column; align-items: flex-start !important; gap: 15px;
    }
    .card-box > div[style*="justify-content:space-between"] > div {
        width: 100%; flex-wrap: wrap; justify-content: flex-start; gap: 10px;
    }
    
    /* 5. Inputs and Buttons Full Width */
    input[type="text"], .btn-primary { width: 100% !important; }
    
    /* 6. Fix Modals */
    .modal-content { width: 95%; max-height: 90vh; }
    .modal-body { padding: 15px; }
    .modal-footer { flex-direction: column-reverse; gap: 10px; text-align: center; }
    .modal-footer button { width: 100%; margin: 0; }
}