/* ============================================
   MONITORING SANTRI DIGITAL
   Modern Green Islamic Theme
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Amiri:wght@400;700&display=swap');

:root {
    --green-50: #f0fdf4;
    --green-100: #dcfce7;
    --green-200: #bbf7d0;
    --green-300: #86efac;
    --green-400: #4ade80;
    --green-500: #22c55e;
    --green-600: #16a34a;
    --green-700: #15803d;
    --green-800: #166534;
    --green-900: #14532d;
    --green-950: #052e16;
    
    --amber-400: #fbbf24;
    --amber-500: #f59e0b;
    --amber-600: #d97706;
    
    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;
    
    --primary: var(--green-600);
    --primary-dark: var(--green-800);
    --primary-light: var(--green-100);
    --accent: var(--amber-500);
    --bg: #fafdf7;
    --card-bg: #ffffff;
    --text: var(--slate-800);
    --text-light: var(--slate-500);
    --border: var(--slate-200);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    --font-main: 'Plus Jakarta Sans', -apple-system, sans-serif;
    --font-arabic: 'Amiri', serif;
}

/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-main);
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; height: auto; }

/* === ISLAMIC PATTERN OVERLAY === */
.islamic-pattern {
    position: relative;
    overflow: hidden;
}
.islamic-pattern::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.06'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
    pointer-events: none;
    z-index: 0;
}

/* === NAVBAR === */
.navbar {
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(22,163,74,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0 24px;
    transition: var(--transition);
}
.navbar.scrolled {
    box-shadow: var(--shadow-md);
}
.navbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}
.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--green-800);
}
.navbar-brand img {
    height: 40px;
    width: 40px;
    object-fit: contain;
}
.navbar-brand .brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--green-500), var(--green-700));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}
.navbar-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
}
.navbar-nav a {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--slate-600);
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition);
}
.navbar-nav a:hover, .navbar-nav a.active {
    color: var(--green-700);
    background: var(--green-50);
}
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--slate-700);
    font-size: 24px;
}

/* === HERO SECTION === */
.hero {
    background: linear-gradient(135deg, var(--green-800) 0%, var(--green-600) 50%, var(--green-500) 100%);
    color: white;
    padding: 100px 24px 80px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute;
    top: -50%; right: -30%;
    width: 700px;
    height: 700px;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    border-radius: 50%;
}
.hero::after {
    content: '';
    position: absolute;
    bottom: -30%; left: -20%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(245,158,11,0.12) 0%, transparent 70%);
    border-radius: 50%;
}
.hero-content {
    max-width: 750px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    padding: 6px 18px;
    border-radius: 50px;
    font-size: 0.82rem;
    font-weight: 500;
    margin-bottom: 28px;
    backdrop-filter: blur(10px);
    animation: fadeInDown 0.8s ease;
}
.hero h1 {
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 20px;
    animation: fadeInUp 0.8s ease 0.2s both;
}
.hero p {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 580px;
    margin: 0 auto 36px;
    line-height: 1.8;
    animation: fadeInUp 0.8s ease 0.4s both;
}
.hero-quote {
    font-family: var(--font-arabic);
    font-size: 1rem;
    opacity: 0.7;
    font-style: italic;
    margin-top: 40px;
    animation: fadeInUp 0.8s ease 0.8s both;
}

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.95rem;
    font-family: var(--font-main);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.5;
}
.btn-primary {
    background: white;
    color: var(--green-700);
    box-shadow: 0 4px 14px rgba(0,0,0,0.1);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    color: var(--green-800);
}
.btn-green {
    background: linear-gradient(135deg, var(--green-500), var(--green-600));
    color: white;
    box-shadow: 0 4px 14px rgba(22,163,74,0.3);
}
.btn-green:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(22,163,74,0.4);
    color: white;
}
.btn-outline {
    background: transparent;
    border: 2px solid var(--green-300);
    color: var(--green-700);
}
.btn-outline:hover {
    background: var(--green-50);
    border-color: var(--green-500);
}
.btn-amber {
    background: linear-gradient(135deg, var(--amber-400), var(--amber-500));
    color: var(--green-900);
    font-weight: 700;
}
.btn-amber:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245,158,11,0.35);
}
.btn-sm { padding: 8px 18px; font-size: 0.85rem; }
.btn-lg { padding: 16px 36px; font-size: 1.05rem; }
.btn-block { width: 100%; justify-content: center; }
.btn-group { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* === CONTAINER === */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}
.container-sm { max-width: 800px; margin: 0 auto; padding: 0 24px; }
.container-lg { max-width: 1400px; margin: 0 auto; padding: 0 24px; }

/* === SECTIONS === */
.section {
    padding: 80px 24px;
}
.section-header {
    text-align: center;
    max-width: 600px;
    margin: 0 auto 50px;
}
.section-header .label {
    display: inline-block;
    color: var(--green-600);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 12px;
}
.section-header h2 {
    font-size: clamp(1.6rem, 3.5vw, 2.2rem);
    font-weight: 800;
    color: var(--green-900);
    margin-bottom: 16px;
    line-height: 1.3;
}
.section-header p {
    color: var(--slate-500);
    font-size: 1rem;
    line-height: 1.7;
}

/* === CARDS === */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: var(--transition);
}
.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}
.card-body { padding: 28px; }
.card-header {
    padding: 20px 28px;
    border-bottom: 1px solid var(--border);
    background: var(--slate-50);
}
.card-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--green-800);
}

/* Feature Cards */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}
.feature-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 32px;
    border: 1px solid var(--border);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.feature-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--green-400), var(--green-600));
    transform: scaleX(0);
    transition: var(--transition);
}
.feature-card:hover::after {
    transform: scaleX(1);
}
.feature-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-6px);
}
.feature-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    margin-bottom: 20px;
}
.feature-icon.green { background: var(--green-100); color: var(--green-600); }
.feature-icon.amber { background: #fef3c7; color: var(--amber-600); }
.feature-icon.blue { background: #dbeafe; color: #2563eb; }
.feature-icon.purple { background: #ede9fe; color: #7c3aed; }
.feature-icon.rose { background: #ffe4e6; color: #e11d48; }
.feature-icon.teal { background: #ccfbf1; color: #0d9488; }

.feature-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--green-900);
    margin-bottom: 10px;
}
.feature-card p {
    color: var(--slate-500);
    font-size: 0.9rem;
    line-height: 1.7;
}

/* === STATS === */
.stats-bar {
    background: var(--green-900);
    color: white;
    padding: 40px 24px;
}
.stats-grid {
    max-width: 1000px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 30px;
    text-align: center;
}
.stat-item h3 {
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--green-300);
    line-height: 1;
}
.stat-item p {
    font-size: 0.85rem;
    opacity: 0.7;
    margin-top: 6px;
}

/* === FORMS === */
.form-group {
    margin-bottom: 20px;
}
.form-label {
    display: block;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--slate-700);
    margin-bottom: 6px;
}
.form-control {
    width: 100%;
    padding: 11px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-main);
    font-size: 0.95rem;
    color: var(--text);
    background: white;
    transition: var(--transition);
    outline: none;
}
.form-control:focus {
    border-color: var(--green-400);
    box-shadow: 0 0 0 3px rgba(34,197,94,0.15);
}
textarea.form-control {
    min-height: 100px;
    resize: vertical;
}
select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}
.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: var(--green-600);
}
.form-hint {
    font-size: 0.8rem;
    color: var(--slate-400);
    margin-top: 4px;
}
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

/* Sholat Selector */
.sholat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}
.sholat-item {
    background: var(--green-50);
    border: 2px solid var(--green-200);
    border-radius: var(--radius-sm);
    padding: 14px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}
.sholat-item:hover {
    border-color: var(--green-400);
}
.sholat-item.active {
    background: var(--green-100);
    border-color: var(--green-500);
}
.sholat-item .icon { font-size: 24px; margin-bottom: 6px; }
.sholat-item .name { font-weight: 600; font-size: 0.85rem; color: var(--green-800); }
.sholat-item select {
    margin-top: 8px;
    width: 100%;
    padding: 4px 8px;
    border: 1px solid var(--green-300);
    border-radius: 6px;
    font-size: 0.8rem;
    background: white;
}

/* Toggle Switch */
.toggle-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.toggle-btn {
    padding: 8px 18px;
    border: 2px solid var(--border);
    border-radius: 50px;
    background: white;
    font-family: var(--font-main);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--slate-600);
    cursor: pointer;
    transition: var(--transition);
}
.toggle-btn:hover { border-color: var(--green-300); }
.toggle-btn.active {
    background: var(--green-600);
    color: white;
    border-color: var(--green-600);
}

/* Rating */
.rating-group {
    display: flex;
    gap: 6px;
}
.rating-star {
    width: 36px;
    height: 36px;
    border: 2px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition);
    background: white;
}
.rating-star:hover, .rating-star.active {
    background: var(--amber-400);
    border-color: var(--amber-500);
    color: white;
}

/* === SIGNATURE CANVAS === */
.signature-wrapper {
    border: 2px dashed var(--green-300);
    border-radius: var(--radius);
    background: white;
    padding: 4px;
    position: relative;
    touch-action: none; /* Prevent scroll while drawing */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}
.signature-canvas {
    width: 100%;
    height: 200px;
    cursor: crosshair;
    display: block;
    border-radius: 8px;
    touch-action: none; /* Critical: prevents browser scroll during signature drawing */
}
.signature-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

/* === MONITORING PAGE: Student Header === */
.student-header-card {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.report-date-label {
    text-align: right;
    white-space: nowrap;
}

/* === MONITORING PAGE: Akhlak Row === */
.akhlak-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding: 10px 14px;
    background: var(--slate-50);
    border-radius: var(--radius-sm);
    flex-wrap: wrap;
}
.akhlak-icon { font-size: 1.4rem; flex-shrink: 0; }
.akhlak-label { font-weight: 600; flex: 1; color: var(--green-800); min-width: 100px; }

/* === MONITORING PAGE: Form Navigation buttons === */
.form-nav-buttons {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 24px;
}

/* === MONITORING PAGE: Mobile tabs === */
.mobile-tabs {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.mobile-tabs::-webkit-scrollbar { display: none; }

/* === MONITORING PAGE: Center card (period select, search) === */
.monitor-center-card {
    text-align: center;
    padding: 40px;
}

/* === MONITORING PAGE: Period select item === */
.period-select-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: white;
    border: 2px solid var(--green-200);
    border-radius: var(--radius);
    text-decoration: none;
    transition: var(--transition);
}
.period-select-item:hover, .period-select-item:active {
    border-color: var(--green-500);
    background: var(--green-50);
    color: inherit;
}

/* === TABLES === */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.9rem;
}
th {
    background: var(--green-50);
    font-weight: 600;
    color: var(--green-800);
    border-bottom: 2px solid var(--green-200);
    white-space: nowrap;
}
td { border-bottom: 1px solid var(--border); }
tr:hover td { background: var(--slate-50); }

/* === BADGE === */
.badge {
    display: inline-flex;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-green { background: var(--green-100); color: var(--green-700); }
.badge-amber { background: #fef3c7; color: var(--amber-600); }
.badge-red { background: #fee2e2; color: #dc2626; }
.badge-blue { background: #dbeafe; color: #2563eb; }

/* === ALERT === */
.alert {
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.alert-success { background: var(--green-50); color: var(--green-800); border: 1px solid var(--green-200); }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* === FOOTER === */
.footer {
    background: var(--green-950);
    color: rgba(255,255,255,0.7);
    padding: 50px 24px 30px;
}
.footer-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}
.footer h4 {
    color: white;
    font-weight: 700;
    margin-bottom: 16px;
    font-size: 1rem;
}
.footer p, .footer a {
    font-size: 0.88rem;
    color: rgba(255,255,255,0.6);
    line-height: 1.8;
}
.footer a:hover { color: var(--green-300); }
.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    padding-top: 24px;
    border-top: 1px solid rgba(255,255,255,0.1);
    text-align: center;
    font-size: 0.82rem;
}

/* === ADMIN LAYOUT === */
.admin-layout {
    display: flex;
    min-height: 100vh;
}
.sidebar {
    width: 270px;
    background: var(--green-900);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    overflow-y: auto;
    transition: var(--transition);
}
.sidebar-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar-header .logo-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--green-400), var(--green-600));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}
.sidebar-header h3 {
    font-size: 0.95rem;
    font-weight: 700;
}
.sidebar-header small {
    font-size: 0.7rem;
    opacity: 0.6;
}
.sidebar-nav {
    padding: 16px 12px;
}
.sidebar-nav .nav-section {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.4);
    padding: 16px 12px 8px;
    font-weight: 600;
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.7);
    font-size: 0.88rem;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 2px;
}
.sidebar-nav a:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}
.sidebar-nav a.active {
    background: var(--green-700);
    color: white;
}
.sidebar-nav a .icon {
    width: 20px;
    text-align: center;
    font-size: 16px;
}
.admin-main {
    margin-left: 270px;
    flex: 1;
    min-height: 100vh;
    background: var(--bg);
}
.admin-topbar {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 16px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 40;
}
.admin-topbar h1 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--green-900);
}
.admin-content {
    padding: 30px;
}

/* Dashboard Cards */
.dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.dash-card {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 18px;
}
.dash-card .icon-box {
    width: 52px;
    height: 52px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.dash-card h4 { font-size: 0.82rem; color: var(--slate-500); font-weight: 500; }
.dash-card .value { font-size: 1.7rem; font-weight: 800; color: var(--green-900); }

/* === PROGRESS === */
.progress-bar {
    height: 10px;
    background: var(--slate-100);
    border-radius: 50px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--green-400), var(--green-600));
    border-radius: 50px;
    transition: width 1s ease;
}

/* === SEARCH BOX === */
.search-box {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
}
.search-box input {
    width: 100%;
    padding: 14px 20px 14px 50px;
    border: 2px solid var(--green-200);
    border-radius: 50px;
    font-size: 1rem;
    font-family: var(--font-main);
    outline: none;
    transition: var(--transition);
    background: white;
}
.search-box input:focus {
    border-color: var(--green-500);
    box-shadow: 0 0 0 4px rgba(34,197,94,0.1);
}
.search-box .search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--green-400);
    font-size: 18px;
}
.search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border);
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 100;
}
.search-results.show { display: block; }
.search-result-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid var(--slate-100);
}
.search-result-item:hover, .search-result-item:active { background: var(--green-50); }
.search-result-item .name { font-weight: 600; color: var(--green-800); word-break: break-word; }
.search-result-item .meta { font-size: 0.8rem; color: var(--slate-400); word-break: break-word; }

/* === STEP INDICATOR === */
.steps {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-bottom: 40px;
}
.step {
    display: flex;
    align-items: center;
    gap: 8px;
}
.step-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    border: 2px solid var(--border);
    color: var(--slate-400);
    background: white;
    transition: var(--transition);
}
.step.active .step-circle {
    background: var(--green-600);
    color: white;
    border-color: var(--green-600);
}
.step.done .step-circle {
    background: var(--green-100);
    color: var(--green-600);
    border-color: var(--green-300);
}
.step-label {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--slate-400);
}
.step.active .step-label { color: var(--green-700); }
.step-line {
    width: 40px;
    height: 2px;
    background: var(--border);
    margin: 0 4px;
}
.step.done + .step-line,
.step.done ~ .step-line { background: var(--green-300); }

/* === SUCCESS PAGE === */
.success-page {
    text-align: center;
    padding: 80px 24px;
}
.success-icon {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--green-100);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 50px;
    margin: 0 auto 24px;
    animation: scaleIn 0.5s ease;
}

/* === MODAL === */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.modal-overlay.show { display: flex; }
.modal {
    background: white;
    border-radius: var(--radius-lg);
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    animation: scaleIn 0.3s ease;
}
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h3 { font-size: 1.1rem; font-weight: 700; }
.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--slate-400);
    padding: 4px;
}
.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* === TAB === */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
    overflow-x: auto;
}
.tabs.mobile-tabs {
    margin-bottom: 0;
    border: 1px solid var(--border);
    border-bottom: none;
}
.tab {
    padding: 12px 24px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--slate-400);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
}
.tab:hover { color: var(--green-600); }
.tab.active {
    color: var(--green-700);
    border-bottom-color: var(--green-600);
}
.tab-content { display: none !important; }
.tab-content.active { display: block !important; }
/* Neutralise .card interference on tab panels used in monitoring form */
.card.tab-content {
    overflow: visible;
    transition: none;
    transform: none;
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.card.tab-content:hover {
    transform: none;
    box-shadow: var(--shadow);
}

/* === ANIMATIONS === */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}
.fade-in { animation: fadeInUp 0.6s ease both; }
.fade-in-delay-1 { animation-delay: 0.1s; }
.fade-in-delay-2 { animation-delay: 0.2s; }
.fade-in-delay-3 { animation-delay: 0.3s; }

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .navbar-inner {
        height: 56px;
    }
    .navbar-brand {
        font-size: 0.95rem;
        gap: 8px;
    }
    .navbar-brand img, .navbar-brand .brand-icon {
        width: 32px;
        height: 32px;
    }
    .navbar-nav { 
        display: none; 
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 16px;
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-lg);
    }
    .navbar-nav.show { display: flex; }
    .nav-toggle { display: block; }
    
    .hero { padding: 50px 16px 40px; }
    .hero h1 { font-size: 1.6rem; }
    .hero p { font-size: 0.95rem; margin-bottom: 24px; }
    .hero-badge { font-size: 0.75rem; padding: 5px 14px; }
    
    .section { padding: 40px 12px; }
    .container, .container-sm, .container-lg { padding: 0 12px; }
    
    /* Admin layout */
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .admin-main { margin-left: 0; }
    .admin-content { padding: 12px; }
    .admin-topbar { padding: 12px 16px; }
    .admin-topbar h1 { font-size: 1.1rem; }
    
    .steps { flex-wrap: wrap; }
    .step-label { display: none; }
    
    /* Cards */
    .card { border-radius: var(--radius); }
    .card-body { padding: 16px; }
    .card:hover { transform: none; } /* no hover lift on mobile */
    
    /* Feature grid */
    .feature-grid { grid-template-columns: 1fr; gap: 16px; }
    .feature-card { padding: 20px; }
    .feature-card:hover { transform: none; }
    
    /* Dashboard grid */
    .dash-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .dash-card { padding: 16px; gap: 12px; }
    .dash-card .icon-box { width: 42px; height: 42px; font-size: 18px; }
    .dash-card .value { font-size: 1.3rem; }
    
    /* Stats */
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }
    .stat-item h3 { font-size: 1.8rem; }
    
    /* Footer */
    .footer { padding: 30px 16px 20px; }
    .footer-grid { grid-template-columns: 1fr; gap: 24px; }
    
    /* Modal */
    .modal-overlay { padding: 12px; align-items: flex-end; }
    .modal { max-height: 90vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
    
    /* Table */
    th, td { padding: 8px 10px; font-size: 0.8rem; }
    
    /* Admin grid: stack on mobile */
    .admin-grid-2 { grid-template-columns: 1fr !important; gap: 16px; }
    
    /* Settings color grid */
    .form-row[style*="repeat(3"] { grid-template-columns: 1fr !important; }

    /* Buttons on mobile */
    .btn { padding: 10px 20px; font-size: 0.88rem; }
    .btn-lg { padding: 14px 28px; font-size: 0.95rem; }
    .btn-sm { padding: 7px 14px; font-size: 0.8rem; }
    .btn-group { flex-direction: column; align-items: stretch; }
    
    /* Sholat grid: 3 per row on small phones, then 5 on wider */
    .sholat-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .sholat-item { padding: 10px 6px; }
    .sholat-item .icon { font-size: 20px; margin-bottom: 4px; }
    .sholat-item .name { font-size: 0.75rem; }
    .sholat-item select { font-size: 0.72rem; padding: 3px 4px; }
    
    /* Toggle buttons */
    .toggle-group { gap: 6px; }
    .toggle-btn { padding: 7px 14px; font-size: 0.8rem; }
    
    /* Rating stars */
    .rating-star { width: 28px; height: 28px; font-size: 12px; }
    .rating-group { gap: 4px; }
    
    /* Form row: stack on mobile */
    .form-row { grid-template-columns: 1fr; gap: 12px; }
    .form-control { padding: 10px 14px; font-size: 0.9rem; }
    .form-label { font-size: 0.85rem; }
    
    /* Signature */
    .signature-canvas { height: 180px; }
    .signature-wrapper { padding: 2px; }
    
    /* Student header card */
    .student-header-card { flex-direction: column; align-items: flex-start; gap: 8px; }
    .report-date-label { text-align: left; }
    
    /* Akhlak row - stack rating below label on narrow screens */
    .akhlak-row { gap: 8px; padding: 10px 12px; margin-bottom: 8px; }
    .akhlak-icon { font-size: 1.2rem; }
    .akhlak-label { font-size: 0.85rem; min-width: 80px; }
    
    /* Form navigation buttons */
    .form-nav-buttons { 
        flex-direction: column-reverse; 
        gap: 8px; 
    }
    .form-nav-buttons .btn { 
        width: 100%; 
        justify-content: center;
        text-align: center;
    }
    
    /* Center card (period, search) */
    .monitor-center-card { padding: 24px 16px; }
    .monitor-center-card h2 { font-size: 1.2rem; }
    .monitor-center-card p { font-size: 0.88rem; }
    
    /* Tabs: scrollable, compact */
    .tabs { 
        gap: 0; 
        -webkit-overflow-scrolling: touch; 
        scrollbar-width: none;
        padding: 0 8px;
    }
    .tabs::-webkit-scrollbar { display: none; }
    .tab { padding: 10px 14px; font-size: 0.78rem; }
    
    /* Search box */
    .search-box { max-width: 100%; }
    .search-box input { padding: 12px 16px 12px 44px; font-size: 0.95rem; }
    .search-box .search-icon { left: 14px; font-size: 16px; }
    .search-results { max-height: 250px; }
    .search-result-item { padding: 10px 14px; }
    .search-result-item .name { font-size: 0.88rem; }
    
    /* Success page */
    .success-page { padding: 40px 16px; }
    .success-icon { width: 72px; height: 72px; font-size: 36px; }
    
    /* Alert */
    .alert { padding: 12px 14px; font-size: 0.85rem; gap: 8px; }
}

/* Extra small devices */
@media (max-width: 400px) {
    .container, .container-sm, .container-lg { padding: 0 8px; }
    .sholat-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .sholat-item { padding: 8px 4px; }
    .sholat-item .icon { font-size: 18px; }
    .sholat-item .name { font-size: 0.7rem; }
    .dash-grid { grid-template-columns: 1fr; }
    .tab { padding: 8px 10px; font-size: 0.73rem; }
    .rating-star { width: 26px; height: 26px; font-size: 11px; }
    .card-body { padding: 12px; }
    .btn-lg { width: 100%; justify-content: center; }
}

/* === PRINT === */
@media print {
    .navbar, .sidebar, .admin-topbar, .btn, .no-print { display: none !important; }
    body { background: white; }
    .admin-main { margin-left: 0; }
}

/* === LOADING === */
.loader {
    width: 40px;
    height: 40px;
    border: 3px solid var(--green-100);
    border-top: 3px solid var(--green-600);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Admin 2-column grid (responsive) */
.admin-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.skeleton {
    background: linear-gradient(90deg, var(--slate-100) 25%, var(--slate-50) 50%, var(--slate-100) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
