/* Ijazah Madrasah - Design System | Soft Green Minimalist */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #4CAF7D; --primary-dark: #2E7D55; --primary-light: #E8F5EE;
    --primary-subtle: #F0FAF4; --primary-gradient: linear-gradient(135deg, #4CAF7D, #2E9B6A);
    --n900: #1A1F2E; --n700: #374151; --n600: #6B7280; --n400: #9CA3AF;
    --n300: #D1D5DB; --n200: #E5E7EB; --n100: #F3F4F6; --white: #FFFFFF;
    --blue: #3B82F6; --amber: #F59E0B; --red: #EF4444;
    --blue-l: #EFF6FF; --amber-l: #FFFBEB; --red-l: #FEF2F2;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08);
    --radius: 8px; --radius-lg: 12px; --radius-xl: 16px;
    --sidebar-w: 260px; --transition: 200ms ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body { font-family: 'Inter', sans-serif; color: var(--n700); background: var(--n100); line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
h1 { font-size: 1.75rem; font-weight: 700; color: var(--n900); }
h2 { font-size: 1.375rem; font-weight: 600; color: var(--n900); }
h3 { font-size: 1.125rem; font-weight: 600; color: var(--n900); }

/* Sidebar */
.sidebar {
    width: var(--sidebar-w); background: var(--white); border-right: 1px solid var(--n200);
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
    display: flex; flex-direction: column; overflow-y: auto; transition: transform 0.3s ease;
}
.sidebar-brand {
    padding: 20px 24px; border-bottom: 1px solid var(--n200);
    display: flex; align-items: center; gap: 12px;
}
.sidebar-brand-icon {
    width: 40px; height: 40px; background: var(--primary-gradient); border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center; font-size: 1.25rem; color: var(--white);
}
.sidebar-brand h1 { font-size: 1rem; line-height: 1.2; }
.sidebar-brand span { font-size: 0.714rem; color: var(--n600); font-weight: 400; }
.sidebar-nav { flex: 1; padding: 16px 0; }
.sidebar-section { padding: 0 24px; margin-bottom: 8px; margin-top: 16px; }
.sidebar-section-label { font-size: 0.714rem; font-weight: 600; color: var(--n400); text-transform: uppercase; letter-spacing: 0.05em; }
.sidebar-link {
    display: flex; align-items: center; gap: 12px; padding: 10px 24px;
    color: var(--n600); font-size: 0.929rem; font-weight: 500;
    transition: all var(--transition); border-left: 3px solid transparent; cursor: pointer;
}
.sidebar-link:hover { background: var(--primary-subtle); color: var(--primary-dark); }
.sidebar-link.active { background: var(--primary-light); color: var(--primary-dark); border-left-color: var(--primary); font-weight: 600; }
.sidebar-link i { font-size: 1.15rem; width: 20px; text-align: center; }
.sidebar-footer { padding: 16px 24px; border-top: 1px solid var(--n200); }
.sidebar-user { display: flex; align-items: center; gap: 12px; }
.sidebar-user-avatar {
    width: 36px; height: 36px; background: var(--primary-gradient); border-radius: 50%;
    display: flex; align-items: center; justify-content: center; color: var(--white); font-weight: 600; font-size: 0.857rem;
}
.sidebar-user-info strong { display: block; font-size: 0.857rem; color: var(--n900); }
.sidebar-user-info span { font-size: 0.714rem; color: var(--n600); }

/* Main Content */
.main-content { margin-left: var(--sidebar-w); flex: 1; min-height: 100vh; }
.topbar {
    height: 64px; background: var(--white); border-bottom: 1px solid var(--n200);
    display: flex; align-items: center; justify-content: space-between; padding: 0 32px;
    position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 0.929rem; color: var(--n600); }
.topbar-breadcrumb .current { color: var(--n900); font-weight: 600; }
.topbar-breadcrumb .separator { color: var(--n300); }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-ta { background: var(--primary-light); color: var(--primary-dark); padding: 6px 14px; border-radius: 20px; font-size: 0.857rem; font-weight: 600; }
.hamburger-btn { display: none; background: none; border: none; font-size: 1.5rem; color: var(--n700); cursor: pointer; }
.content-wrapper { padding: 32px; }

/* Cards */
.card { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); border: 1px solid var(--n200); transition: box-shadow var(--transition); }
.card:hover { box-shadow: var(--shadow-md); }
.card-header { padding: 20px 24px; border-bottom: 1px solid var(--n200); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.card-header h2 { font-size: 1.125rem; }
.card-body { padding: 24px; }

/* Stat Cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 28px; }
.stat-card { background: var(--white); border-radius: var(--radius-lg); padding: 24px; border: 1px solid var(--n200); display: flex; align-items: center; gap: 16px; transition: all var(--transition); }
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon { width: 48px; height: 48px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 1.35rem; }
.stat-icon.green { background: var(--primary-light); color: var(--primary); }
.stat-icon.blue { background: var(--blue-l); color: var(--blue); }
.stat-icon.amber { background: var(--amber-l); color: var(--amber); }
.stat-icon.red { background: var(--red-l); color: var(--red); }
.stat-info h3 { font-size: 1.5rem; font-weight: 700; }
.stat-info p { font-size: 0.857rem; color: var(--n600); margin-top: 2px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px; border: none; border-radius: var(--radius); font-family: inherit; font-size: 0.929rem; font-weight: 600; cursor: pointer; transition: all var(--transition); text-decoration: none; line-height: 1; white-space: nowrap; }
.btn i { font-size: 1.05rem; }
.btn-primary { background: var(--primary-gradient); color: var(--white); box-shadow: 0 2px 4px rgba(76,175,125,0.3); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 8px rgba(76,175,125,0.4); color: var(--white); }
.btn-secondary { background: var(--white); color: var(--primary); border: 1.5px solid var(--primary); }
.btn-secondary:hover { background: var(--primary-subtle); }
.btn-danger { background: var(--red); color: var(--white); }
.btn-danger:hover { background: #DC2626; color: var(--white); }
.btn-sm { padding: 6px 14px; font-size: 0.857rem; }
.btn-icon { padding: 8px; border-radius: 6px; background: transparent; border: none; color: var(--n600); cursor: pointer; transition: all var(--transition); }
.btn-icon:hover { background: var(--n100); color: var(--primary); }
.btn-icon.danger:hover { color: var(--red); background: var(--red-l); }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* Forms */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 0.857rem; font-weight: 600; color: var(--n700); margin-bottom: 6px; }
.form-control { width: 100%; padding: 10px 14px; border: 1.5px solid var(--n300); border-radius: var(--radius); font-family: inherit; font-size: 0.929rem; color: var(--n900); background: var(--white); transition: all var(--transition); outline: none; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(76,175,125,0.15); }
.form-control::placeholder { color: var(--n400); }
select.form-control { cursor: pointer; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.input-wrapper { position: relative; }
.input-wrapper i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--n400); }
.input-wrapper .form-control { padding-left: 42px; }

/* Tables */
.table-container { overflow-x: auto; border-radius: var(--radius-lg); }
table { width: 100%; border-collapse: collapse; }
thead th { background: var(--primary-subtle); padding: 12px 16px; text-align: left; font-size: 0.857rem; font-weight: 600; color: var(--n700); white-space: nowrap; border-bottom: 2px solid var(--n200); position: sticky; top: 0; }
tbody td { padding: 12px 16px; font-size: 0.929rem; border-bottom: 1px solid var(--n200); }
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--primary-subtle); }
tbody tr:nth-child(even) { background: #FAFBFC; }
tbody tr:nth-child(even):hover { background: var(--primary-subtle); }
.table-input { width: 60px; padding: 6px 8px; border: 1.5px solid var(--n300); border-radius: 6px; font-family: inherit; font-size: 0.857rem; text-align: center; outline: none; transition: all var(--transition); }
.table-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(76,175,125,0.15); }
.table-actions { display: flex; gap: 4px; }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 0.714rem; font-weight: 600; }
.badge-green { background: var(--primary-light); color: var(--primary-dark); }
.badge-blue { background: var(--blue-l); color: var(--blue); }
.badge-amber { background: var(--amber-l); color: var(--amber); }

/* Tabs */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--n200); margin-bottom: 24px; }
.tab-btn { padding: 12px 24px; border: none; background: none; font-family: inherit; font-size: 0.929rem; font-weight: 500; color: var(--n600); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all var(--transition); }
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary-dark); border-bottom-color: var(--primary); font-weight: 600; }
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }

/* Modal */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); backdrop-filter: blur(4px); z-index: 1000; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.active { display: flex; }
.modal { background: var(--white); border-radius: var(--radius-xl); width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; animation: slideUp 0.25s ease; box-shadow: var(--shadow-lg); }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--n200); display: flex; align-items: center; justify-content: space-between; }
.modal-close { background: none; border: none; font-size: 1.25rem; color: var(--n400); cursor: pointer; padding: 4px; border-radius: 6px; }
.modal-close:hover { background: var(--n100); color: var(--n900); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--n200); display: flex; justify-content: flex-end; gap: 8px; }

/* Toast */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 14px 20px; border-radius: var(--radius); font-size: 0.929rem; font-weight: 500; color: var(--white); min-width: 280px; animation: slideInRight 0.3s ease; display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow-lg); }
.toast-success { background: var(--primary); }
.toast-error { background: var(--red); }

/* Login Page */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--primary-subtle) 0%, var(--n100) 50%, var(--primary-light) 100%); padding: 20px; }
.login-card { background: var(--white); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); padding: 48px 40px; width: 100%; max-width: 420px; text-align: center; animation: fadeUp 0.5s ease; }
.login-brand { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 8px; }
.login-brand-icon { width: 52px; height: 52px; background: var(--primary-gradient); border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; color: var(--white); }
.login-card h1 { font-size: 1.375rem; margin-bottom: 4px; }
.login-card .subtitle { color: var(--n600); font-size: 0.929rem; margin-bottom: 32px; }
.login-card .form-group { text-align: left; }
.login-card .btn-primary { width: 100%; justify-content: center; padding: 12px; font-size: 1rem; margin-top: 8px; }
.login-error { background: var(--red-l); color: var(--red); padding: 10px 16px; border-radius: var(--radius); font-size: 0.857rem; margin-bottom: 16px; }

/* Alerts */
.alert { padding: 14px 20px; border-radius: var(--radius); font-size: 0.929rem; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }
.alert-success { background: var(--primary-light); color: var(--primary-dark); border: 1px solid #A7D8C0; }
.alert-error { background: var(--red-l); color: var(--red); border: 1px solid #FCA5A5; }

/* Range Slider */
.range-slider { display: flex; align-items: center; gap: 16px; }
.range-slider input[type="range"] { flex: 1; -webkit-appearance: none; height: 6px; background: var(--n200); border-radius: 3px; outline: none; }
.range-slider input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--primary); cursor: pointer; box-shadow: 0 2px 6px rgba(76,175,125,0.4); }
.range-value { font-size: 1.25rem; font-weight: 700; color: var(--primary-dark); min-width: 50px; text-align: center; }

/* Progress */
.progress-bar { width: 100%; height: 8px; background: var(--n200); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary-gradient); border-radius: 4px; transition: width 0.5s ease; }

/* Preview */
.preview-box { background: var(--n100); border: 1px dashed var(--n300); border-radius: var(--radius); padding: 20px; margin-top: 16px; }

/* Empty State */
.empty-state { text-align: center; padding: 48px 24px; color: var(--n600); }
.empty-state i { font-size: 3rem; color: var(--n300); margin-bottom: 16px; display: block; }

/* Page Header */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-header h1 { display: flex; align-items: center; gap: 10px; }
.page-header h1 i { color: var(--primary); }

/* Filter Bar */
.filter-bar { display: flex; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; align-items: center; }
.filter-bar .form-control { width: auto; min-width: 180px; }

/* Animations */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(100px); } to { opacity: 1; transform: translateX(0); } }

/* Responsive */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .hamburger-btn { display: block; }
    .content-wrapper { padding: 20px; }
}
@media (max-width: 768px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
    .login-card { padding: 32px 24px; }
}
@media (max-width: 480px) { .stats-grid { grid-template-columns: 1fr; } }

/* Print */
@media print {
    .sidebar, .topbar, .btn, .filter-bar, .no-print { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .content-wrapper { padding: 0 !important; }
}

.sidebar-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.3); z-index: 99; }
.sidebar-overlay.active { display: block; }
