/* assets/css/admin.css */
:root {
    --primary: #007aff;
    --primary-light: #e5f1ff;
    --primary-dark: #005bb5;
    --secondary: #34c759;
    --bg-color: #f2f2f7;
    --text-color: #1c1c1e;
    --text-muted: #8e8e93;
    --danger: #ff3b30;
    --success: #34c759;
    --warning: #ffcc00;
    --info: #5ac8fa;
    --border: #e5e5ea;
    --card-bg: #ffffff;
    --sidebar-bg: #ffffff;
    --sidebar-w: 280px;
    --topbar-h: 60px;
    --bottom-nav-h: 65px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Noto Sans Arabic', sans-serif; background: var(--bg-color); color: var(--text-color); direction: rtl; line-height: 1.5; }
button, input, optgroup, select, textarea { font-family: inherit; }
a { text-decoration: none; color: inherit; transition: all 0.2s ease; }
ul { list-style: none; }

/* Utilities */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.p-0 { padding: 0 !important; }
.p-3 { padding: 1rem !important; }
.p-4 { padding: 1.5rem !important; }
.bg-primary { background-color: var(--primary); }
.bg-success { background-color: var(--success); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 20px; border: none; border-radius: 12px; cursor: pointer; font-size: 16px; font-weight: 600; text-align: center; transition: all 0.2s; font-family: inherit; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:active { transform: scale(0.98); background: var(--primary-dark); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:active { transform: scale(0.98); background: #d32f2f; }
.btn-success { background: var(--success); color: white; }
.btn-info { background: var(--info); color: white; }
.btn-warning { background: var(--warning); color: #1c1c1e; }
.btn-outline-primary { border: 1.5px solid var(--primary); color: var(--primary); background: transparent; }
.btn-outline-primary:active { background: var(--primary-light); transform: scale(0.98); }
.btn-sm { padding: 8px 14px; font-size: 14px; border-radius: 8px; }
.btn-block { display: block; width: 100%; }
.btn-icon { background: transparent; border: none; font-size: 18px; cursor: pointer; color: var(--text-muted); padding: 10px; border-radius: 8px; transition: all 0.2s; display: inline-flex; align-items: center; justify-content: center; }
.btn-icon:hover { background: #f2f2f7; color: var(--primary); }
.btn-icon.text-danger:hover { background: #fee2e2; color: var(--danger); }

/* Badges */
.badge { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: #e0f8e9; color: #248a3d; }
.badge-danger { background: #fee2e2; color: var(--danger); }
.badge-warning { background: #fff5cc; color: #ccaa00; }
.badge-info { background: #e0f4ff; color: #007bb5; }
.badge-secondary { background: #f2f2f7; color: var(--text-muted); }

/* Forms */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 500; margin-bottom: 8px; font-size: 15px; color: var(--text-color); }
.form-control { width: 100%; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; font-family: inherit; font-size: 16px; background: #f9f9fb; transition: all 0.2s; color: var(--text-color); }
.form-control:focus { outline: none; background: white; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-light); }
.input-icon { position: relative; }
.input-icon i { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.input-icon input { padding-right: 45px; }
select.form-control { appearance: none; background-image: url('data:image/svg+xml;utf8,<svg fill="none" stroke="%238e8e93" stroke-width="2" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" d="M19 9l-7 7-7-7"></path></svg>'); background-repeat: no-repeat; background-position: left 16px center; background-size: 16px; }

/* Alerts */
.alert { padding: 16px; border-radius: 12px; margin-bottom: 20px; font-weight: 500; display: flex; align-items: center; gap: 12px; border-right: 4px solid; }
.alert-danger { background: #fee2e2; color: #b91c1c; border-color: var(--danger); }
.alert-success { background: #e0f8e9; color: #166534; border-color: var(--success); }

/* Admin Layout (Mobile First) */
.admin-topbar { background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(10px); height: var(--topbar-h); display: flex; justify-content: space-between; align-items: center; padding: 0 20px; border-bottom: 1px solid var(--border); position: fixed; top: 0; right: 0; left: 0; z-index: 100; }
.topbar-right, .topbar-left, .topbar-center { display: flex; align-items: center; gap: 15px; }
.academy-name { font-weight: 600; font-size: 18px; color: var(--text-color); letter-spacing: -0.5px; }
.page-title-top { font-size: 17px; font-weight: 600; margin: 0; }
.user-info { display: flex; align-items: center; gap: 10px; }
.user-name { font-weight: 500; font-size: 15px; }
.hidden-mobile { display: none; }
.mobile-only { display: block; }

.admin-wrapper { padding-top: var(--topbar-h); min-height: 100vh; display: flex; }

/* Sidebar */
.sidebar { width: var(--sidebar-w); background: var(--sidebar-bg); border-left: 1px solid var(--border); position: fixed; right: 0; top: 0; bottom: 0; z-index: 110; transform: translateX(100%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); display: flex; flex-direction: column; }
.sidebar.active { transform: translateX(0); box-shadow: -5px 0 25px rgba(0,0,0,0.1); }
.sidebar-header { height: var(--topbar-h); display: flex; justify-content: space-between; align-items: center; padding: 0 20px; border-bottom: 1px solid var(--border); }
.sidebar-header .logo-area { display: flex; align-items: center; gap: 12px; font-weight: 600; color: var(--text-color); font-size: 18px; }
.sidebar-scroll { flex: 1; overflow-y: auto; padding: 20px 0; }
.nav-heading { padding: 10px 20px 5px 20px; font-size: 13px; text-transform: uppercase; color: var(--text-muted); font-weight: 600; letter-spacing: 0.5px; }
.nav-links li a { display: flex; align-items: center; gap: 15px; padding: 12px 20px; color: var(--text-color); font-weight: 500; font-size: 16px; margin: 4px 12px; border-radius: 10px; }
.nav-links li a:hover, .nav-links li a.active { background: var(--primary-light); color: var(--primary); }
.nav-links li a i { font-size: 18px; width: 22px; text-align: center; color: var(--primary); opacity: 0.8; }
.nav-links li a.active i { opacity: 1; }

/* Main Content */
.main-content { flex: 1; padding: 20px; width: 100%; transition: margin-right 0.3s ease; padding-bottom: calc(var(--bottom-nav-h) + 30px); }
.content-header { margin-bottom: 24px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.page-title { font-size: 28px; color: var(--text-color); font-weight: 700; letter-spacing: -0.5px; }
.section-title { font-size: 20px; color: var(--text-color); border-bottom: 1.5px solid var(--border); padding-bottom: 10px; margin-bottom: 20px; display: inline-block; font-weight: 600; letter-spacing: -0.3px; }

/* Tables & Grid */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; font-size: 15px; }
.table th, .table td { padding: 14px 16px; border-bottom: 1px solid var(--border); text-align: right; vertical-align: middle; }
.table th { background-color: var(--bg-color); font-weight: 600; color: var(--text-muted); white-space: nowrap; font-size: 14px; text-transform: uppercase; letter-spacing: 0.5px; }
.table tbody tr { transition: background 0.2s; }
.table tbody tr:hover { background-color: #f9f9fb; }

.grid-2 { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 768px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* Dashboard Cards */
.dashboard-cards { display: grid; grid-template-columns: 1fr; gap: 20px; }
.card { background: var(--card-bg); border-radius: 16px; padding: 24px; display: flex; align-items: center; gap: 20px; box-shadow: 0 4px 20px rgba(0,0,0,0.03); border: 1px solid rgba(0,0,0,0.04); transition: transform 0.2s, box-shadow 0.2s; }
.card:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0,0,0,0.06); }
.card-icon { width: 60px; height: 60px; border-radius: 14px; display: flex; justify-content: center; align-items: center; font-size: 26px; color: white; flex-shrink: 0; }
.card-data h3 { font-size: 28px; font-weight: 700; margin-bottom: 4px; color: var(--text-color); line-height: 1.1; letter-spacing: -0.5px; }
.card-data p { color: var(--text-muted); font-size: 15px; margin: 0; font-weight: 500; }

.card-primary .card-icon { background: var(--primary); }
.card-success .card-icon { background: var(--success); }
.card-warning .card-icon { background: var(--warning); color: #1c1c1e; }
.card-danger .card-icon { background: var(--danger); }
.card-info .card-icon { background: var(--info); }

/* Panels */
.dashboard-sections { display: grid; grid-template-columns: 1fr; gap: 20px; }
.panel { background: var(--card-bg); border-radius: 16px; box-shadow: 0 4px 20px rgba(0,0,0,0.03); border: 1px solid rgba(0,0,0,0.04); overflow: hidden; margin-bottom: 20px; }
.panel-header { background: var(--card-bg); padding: 18px 24px; font-weight: 600; border-bottom: 1px solid var(--border); color: var(--text-color); display: flex; align-items: center; gap: 12px; font-size: 17px; letter-spacing: -0.3px; }
.panel-header i { color: var(--primary); opacity: 0.8; }
.panel-body { padding: 24px; }

/* Progress Bars */
.progress-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; }
.progress-bar-bg { background: var(--border); border-radius: 10px; height: 10px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 10px; transition: width 0.5s ease; background: var(--primary); }

/* Timeline */
.activity-timeline { list-style: none; padding: 0; margin: 0; }
.activity-timeline li { display: flex; gap: 16px; padding: 16px 24px; border-bottom: 1px solid var(--border); transition: background 0.2s; }
.activity-timeline li:last-child { border-bottom: none; }
.timeline-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--primary-light); color: var(--primary); display: flex; justify-content: center; align-items: center; font-size: 16px; flex-shrink: 0; }
.timeline-content { flex: 1; }
.timeline-time { display: block; color: var(--text-muted); font-size: 13px; margin-bottom: 4px; font-weight: 500; }
.timeline-text { font-size: 15px; color: var(--text-color); line-height: 1.4; }

/* Quick Actions Grid */
.quick-actions-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.quick-actions-grid .btn { justify-content: flex-start; padding: 14px 20px; font-size: 15px; background: #f9f9fb; border: 1px solid var(--border); color: var(--text-color); }
.quick-actions-grid .btn i { color: var(--primary); font-size: 18px; margin-left: 5px; }

/* Bottom Navigation (Mobile Only) */
.mobile-bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; height: var(--bottom-nav-h); background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(10px); border-top: 1px solid var(--border); display: flex; justify-content: space-around; align-items: center; z-index: 105; padding-bottom: env(safe-area-inset-bottom); }
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--text-muted); font-size: 11px; font-weight: 500; text-decoration: none; flex: 1; padding: 8px 0; }
.nav-item i { font-size: 22px; margin-bottom: 2px; }
.nav-item.active { color: var(--primary); }

/* Responsive Tables for Mobile */
@media (max-width: 767px) {
    .table-responsive { border: none; }
    .table thead { display: none; }
    .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
    .table tr { margin-bottom: 16px; background: var(--card-bg); border: 1px solid var(--border); border-radius: 16px; padding: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.02); }
    .table td { text-align: right; padding: 10px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; font-size: 15px; }
    .table td:last-child { border-bottom: none; justify-content: center; gap: 10px; padding-top: 15px; }
    .table td::before { content: attr(data-label); font-weight: 600; color: var(--text-muted); font-size: 13px; text-transform: uppercase; float: right; padding-left: 15px; }
    
    .content-header .btn { width: 100%; justify-content: center; margin-bottom: 10px; }
    .btn-icon { padding: 12px; font-size: 20px; background: #f2f2f7; margin: 0 4px; }
}

/* Layout Breakpoints */
@media (min-width: 768px) {
    .hidden-mobile { display: flex; }
    .mobile-only { display: none !important; }
    
    .sidebar { transform: translateX(0); }
    .main-content { margin-right: var(--sidebar-w); padding: 32px; padding-bottom: 32px; }
    #sidebarToggle, #sidebarClose { display: none; }
    
    .dashboard-cards { grid-template-columns: repeat(2, 1fr); gap: 24px; }
    .dashboard-sections { grid-template-columns: repeat(2, 1fr); gap: 24px; }
    .quick-actions-grid { grid-template-columns: repeat(2, 1fr); }
    
    .panel.grid-col-2 { grid-column: span 2; }
}

@media (min-width: 1024px) {
    .dashboard-cards { grid-template-columns: repeat(4, 1fr); }
}
