/* School Result Master - Styles */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: #f1f5f9; color: #0f172a; }
a { color: #4f46e5; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Forms */
.form-control { width: 100%; padding: 8px 12px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 14px; background: white; box-sizing: border-box; }
.form-control:focus { outline: none; border-color: #4f46e5; box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }
.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: #475569; margin-bottom: 4px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.col { flex: 1; min-width: 180px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 16px; margin-top: 16px; border-top: 1px solid #e2e8f0; }
.checkbox-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px 0; border-top: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0; margin: 12px 0; }
.checkbox-grid label { display: flex; align-items: center; gap: 6px; font-size: 13px; }

/* Buttons */
.btn { padding: 8px 16px; border: none; border-radius: 6px; font-size: 14px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.btn-primary { background: #4f46e5; color: white; }
.btn-primary:hover { background: #4338ca; }
.btn-secondary { background: #e2e8f0; color: #1e293b; }
.btn-secondary:hover { background: #cbd5e1; }
.btn-danger { background: #e11d48; color: white; }
.btn-danger:hover { background: #be123c; }
.btn-success { background: #059669; color: white; }
.btn-ghost { background: transparent; color: #475569; }
.btn-ghost:hover { background: #f1f5f9; }
.btn-block { display: block; width: 100%; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* Cards */
.card { background: white; border: 1px solid #e2e8f0; border-radius: 8px; margin-bottom: 16px; overflow: hidden; }
.card-header { padding: 12px 16px; border-bottom: 1px solid #e2e8f0; background: #f8fafc; }
.card-header h3 { font-size: 15px; font-weight: 600; color: #1e293b; }
.card-body { padding: 16px; }

/* Badges */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; background: #e2e8f0; color: #1e293b; }
.badge-green { background: #d1fae5; color: #065f46; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-amber { background: #fef3c7; color: #92400e; }

/* Alerts */
.alert { padding: 10px 14px; border-radius: 6px; margin: 12px 0; font-size: 13px; }
.alert-info { background: #dbeafe; border: 1px solid #93c5fd; color: #1e40af; }
.success-msg { color: #065f46; background: #d1fae5; padding: 8px 12px; border-radius: 6px; display: block; margin-top: 8px; font-size: 13px; }
.error-msg { color: #991b1b; background: #fee2e2; padding: 8px 12px; border-radius: 6px; display: block; margin-top: 8px; font-size: 13px; }
.info-msg { color: #1e40af; background: #dbeafe; padding: 8px 12px; border-radius: 6px; display: block; margin-top: 8px; font-size: 13px; }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { background: #f8fafc; padding: 8px 12px; text-align: left; font-size: 12px; font-weight: 600; color: #475569; text-transform: uppercase; border-bottom: 2px solid #e2e8f0; }
.data-table td { padding: 8px 12px; border-bottom: 1px solid #e2e8f0; font-size: 13px; }
.data-table tr:hover { background: #f8fafc; }
.theory-input, .oral-input { width: 80px; text-align: right; padding: 4px 8px; }

/* Modal - REDESIGNED */
.modal { position: fixed !important; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: none; align-items: center; justify-content: center; z-index: 99999; padding: 20px; box-sizing: border-box; }
.modal[style*="display: flex"], .modal[style*="display:flex"], .modal.show { display: flex !important; }
.modal-dialog { background: white; border-radius: 12px; width: 100%; max-width: 900px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.modal-header { padding: 10px 20px; border-bottom: 1px solid #e2e8f0; display: flex; justify-content: space-between; align-items: center; background: #f8fafc; border-radius: 12px 12px 0 0; flex-shrink: 0; }
.modal-header h3 { font-size: 16px; font-weight: 600; margin: 0; }
.modal-header .close { background: none; border: none; font-size: 24px; cursor: pointer; color: #64748b; padding: 0 8px; line-height: 1; }
.modal-header .close:hover { color: #1e293b; }
.modal-body { padding: 12px 20px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.modal-body .row { display: flex; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.modal-body .col { flex: 1; min-width: 150px; }
.modal-body .form-group { margin-bottom: 6px; }
.modal-body .form-control { padding: 5px 8px; font-size: 12px; }
.modal-body label { font-size: 11px; font-weight: 500; color: #475569; margin-bottom: 3px; display: block; }
.modal-body h4 { font-size: 12px; margin: 8px 0 4px 0; color: #1e293b; font-weight: 600; }
.modal-footer { padding: 12px 20px; border-top: 2px solid #4f46e5; background: #f8fafc; display: flex; gap: 10px; justify-content: flex-end; border-radius: 0 0 12px 12px; flex-shrink: 0; box-shadow: 0 -2px 8px rgba(0,0,0,0.08); }
.modal-footer .btn { min-width: 120px; padding: 10px 24px; font-size: 14px; }

/* Keep old .modal-content/.modal-body working for backward compat */
.modal-content { background: white; border-radius: 12px; width: 100%; max-width: 750px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.modal-content .modal-header,
.modal-content .modal-body,
.modal-content .modal-footer { display: block; }
.modal-content .modal-body { padding: 20px; max-height: 70vh; overflow-y: auto; }
.modal-content .modal-footer { padding: 12px 16px; border-top: 1px solid #e2e8f0; background: #f8fafc; display: flex; gap: 8px; justify-content: flex-end; }

/* Login */
.login-container { min-height: 100vh; background: linear-gradient(135deg, #e0e7ff, #f5f3ff); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; }
.login-box { background: white; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); padding: 32px; width: 100%; max-width: 420px; }
.logo-section { text-align: center; margin-bottom: 24px; }
.logo-section h1 { font-size: 22px; color: #1e293b; margin-top: 8px; }
.logo-section .subtitle { font-size: 12px; color: #64748b; }
.tab-section { display: flex; border-bottom: 2px solid #e2e8f0; margin-bottom: 16px; }
.tab-btn { flex: 1; padding: 10px; background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -2px; font-size: 14px; font-weight: 500; color: #64748b; cursor: pointer; }
.tab-btn.active { color: #4f46e5; border-bottom-color: #4f46e5; }
.form-section { display: flex; flex-direction: column; gap: 12px; }
.link-btn { background: none; border: none; color: #4f46e5; cursor: pointer; font-size: 13px; padding: 0; text-align: center; }
.info-text { text-align: center; margin-top: 20px; font-size: 12px; color: #64748b; }
.info-text .small { opacity: 0.7; font-size: 11px; margin-top: 4px; }

/* Header */
.main-header, .admin-header { background: white; border-bottom: 1px solid #e2e8f0; padding: 12px 20px; display: flex; justify-content: space-between; align-items: center; }
.admin-header { background: linear-gradient(135deg, #0f172a, #334155); color: white; }
.admin-header .logo-text { color: white; }
.admin-header .logo-sub { color: rgba(255,255,255,0.7); }
.admin-header .btn-ghost { color: white; }
.admin-header .btn-ghost:hover { background: rgba(255,255,255,0.1); }
.header-left { display: flex; align-items: center; gap: 12px; }
.header-right { display: flex; align-items: center; gap: 12px; }
.logo-icon { width: 36px; height: 36px; background: linear-gradient(135deg, #6366f1, #8b5cf6); color: white; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.logo-text { font-size: 16px; font-weight: 700; color: #1e293b; }
.logo-sub { font-size: 11px; color: #64748b; }
.school-info { text-align: right; }
.school-name { font-size: 13px; font-weight: 600; color: #1e293b; }
.school-udise { font-size: 11px; color: #64748b; }

/* Layout */
.main-layout { display: flex; min-height: calc(100vh - 64px); }
.sidebar { width: 240px; background: white; border-right: 1px solid #e2e8f0; padding: 12px; }
.admin-sidebar { background: #0f172a; }
.admin-sidebar .nav-item { color: rgba(255,255,255,0.8); }
.admin-sidebar .nav-item:hover { background: rgba(255,255,255,0.1); color: white; }
.sidebar .nav-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 6px; color: #1e293b; font-size: 13px; font-weight: 500; }
.sidebar .nav-item:hover { background: #f1f5f9; text-decoration: none; }
.license-card { margin: 12px; padding: 12px; background: linear-gradient(135deg, #6366f1, #8b5cf6); color: white; border-radius: 8px; font-size: 11px; }
.main-content { flex: 1; padding: 20px; max-width: 100%; overflow-x: auto; }
.top-nav { display: flex; background: white; border-bottom: 1px solid #e2e8f0; padding: 0 20px; }
.top-nav .nav-item { padding: 10px 16px; color: #1e293b; font-size: 13px; font-weight: 500; border-bottom: 2px solid transparent; }
.top-nav .nav-item:hover { text-decoration: none; color: #4f46e5; }

/* Welcome banner */
.welcome-banner { background: linear-gradient(135deg, #6366f1, #8b5cf6, #a855f7); color: white; padding: 20px; border-radius: 12px; margin-bottom: 20px; }
.welcome-banner h1 { font-size: 24px; margin: 4px 0; }
.banner-label { font-size: 10px; opacity: 0.8; text-transform: uppercase; letter-spacing: 1px; }
.banner-badge { display: inline-block; background: rgba(255,255,255,0.2); padding: 4px 12px; border-radius: 999px; font-size: 12px; margin-top: 8px; }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.stat-card { padding: 16px; border-radius: 10px; color: white; }
.stat-card.sky { background: linear-gradient(135deg, #0ea5e9, #2563eb); }
.stat-card.rose { background: linear-gradient(135deg, #ec4899, #e11d48); }
.stat-card.amber { background: linear-gradient(135deg, #f59e0b, #ea580c); }
.stat-card.green { background: linear-gradient(135deg, #10b981, #059669); }
.stat-icon { font-size: 24px; }
.stat-value { font-size: 28px; font-weight: 700; margin: 4px 0; }
.stat-label { font-size: 12px; opacity: 0.9; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.action-grid .btn { justify-content: center; }

/* Empty state */
.empty-state { text-align: center; padding: 30px; color: #64748b; font-size: 14px; }

/* Student list */
.class-group { margin-bottom: 16px; border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; }
.class-header { background: #f8fafc; padding: 10px 14px; font-weight: 600; }
.sections-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 12px; }
.section-box { border: 1px solid #e2e8f0; border-radius: 6px; padding: 10px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 13px; font-weight: 500; }
.subject-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border: 1px solid #e2e8f0; border-radius: 6px; margin-bottom: 6px; }
.assignments-list .assignment-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border: 1px solid #e2e8f0; border-radius: 6px; margin-bottom: 6px; font-size: 13px; }
.assignments-scroll { max-height: 180px; overflow-y: auto; padding: 8px 0; border: 1px solid #f1f5f9; border-radius: 6px; background: #fafbfc; margin: 8px 0; }
.assignments-scroll:empty { display: none; }

/* Footer */
footer { background: #f1f5f9; border-top: 1px solid #e2e8f0; padding: 12px; text-align: center; font-size: 12px; color: #64748b; user-select: none; }

/* QR Code Grid */
.qr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.qr-card { border: 1px solid #e2e8f0; border-radius: 8px; padding: 12px; text-align: center; background: #fafafa; }
.qr-card .qr-name { font-size: 13px; color: #1e293b; margin-bottom: 4px; }
.qr-card .qr-udise { font-size: 11px; color: #64748b; margin-bottom: 6px; }
@media (max-width: 600px) { .qr-grid { grid-template-columns: 1fr; } }

/* Print styles */
@media print {
    body { background: white; }
    .main-header, .sidebar, .top-nav, .form-actions, .btn, .card-header, nav, footer, .admin-header { display: none !important; }
    .main-content { padding: 0; }
    .card { border: none; }
}
