/* EduManage Pro - Custom Styles
   A clean, modern UI with Tailwind-inspired tokens. */

:root {
    --primary-50:  #eef2ff;
    --primary-100: #e0e7ff;
    --primary-500: #6366f1;
    --primary-600: #4f46e5;
    --primary-700: #4338ca;
    --primary-900: #312e81;

    --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;

    --emerald-500: #10b981;
    --emerald-600: #059669;
    --amber-500:   #f59e0b;
    --red-500:     #ef4444;
    --red-600:     #dc2626;
    --blue-500:    #3b82f6;
    --violet-500:  #8b5cf6;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    color: var(--slate-700);
    background: var(--slate-50);
}

.app-shell { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
    width: 256px;
    background: white;
    border-right: 1px solid var(--slate-100);
    display: flex; flex-direction: column;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}
.sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 40; display: none; }

.sidebar-header {
    height: 64px; padding: 0 1.25rem;
    border-bottom: 1px solid var(--slate-100);
    display: flex; align-items: center; gap: 0.625rem; flex-shrink: 0;
}
.sidebar-logo {
    width: 32px; height: 32px; border-radius: 0.5rem; background: var(--primary-600);
    display: flex; align-items: center; justify-content: center; color: white; font-weight: 700;
}
.sidebar-title { font-weight: 700; font-size: 14px; color: var(--slate-900); line-height: 1.1; }
.sidebar-subtitle { font-size: 10px; color: var(--slate-400); text-transform: uppercase; letter-spacing: 0.05em; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 1rem 0.75rem; }
.sidebar-nav::-webkit-scrollbar { width: 0; }

.nav-group { margin-bottom: 1rem; }
.nav-group-label {
    font-size: 10px; font-weight: 600; color: var(--slate-400); text-transform: uppercase;
    letter-spacing: 0.05em; padding: 0 0.75rem; margin-bottom: 0.25rem;
}
.nav-item {
    display: flex; align-items: center; gap: 0.625rem;
    padding: 0.5rem 0.75rem; border-radius: 0.5rem; text-decoration: none;
    color: var(--slate-600); font-size: 13px; font-weight: 500; margin-bottom: 2px;
    transition: all 0.15s;
}
.nav-item:hover { background: var(--slate-50); color: var(--slate-900); }
.nav-item.active { background: var(--primary-50); color: var(--primary-700); font-weight: 600; }
.nav-item svg, .nav-item i { width: 17px; height: 17px; flex-shrink: 0; }

.sidebar-user { padding: 0.75rem; border-top: 1px solid var(--slate-100); }
.user-card { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0.75rem; border-radius: 0.5rem; }
.user-card:hover { background: var(--slate-50); }
.avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--primary-100); color: var(--primary-700);
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; flex-shrink: 0;
}
.avatar-lg { width: 56px; height: 56px; font-size: 22px; border-radius: 1rem; }

.main-area { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

.topbar {
    height: 64px; background: white; border-bottom: 1px solid var(--slate-100);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1.5rem; flex-shrink: 0;
}
.topbar-search { position: relative; }
.topbar-search input {
    padding: 0.5rem 1rem 0.5rem 2.25rem;
    border: 1px solid var(--slate-200); background: var(--slate-50);
    border-radius: 0.5rem; width: 240px; font-size: 13px;
}
.topbar-search input:focus { outline: none; border-color: var(--primary-500); background: white; }
.icon-btn {
    width: 36px; height: 36px; border-radius: 0.5rem;
    border: none; background: transparent; color: var(--slate-500);
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; position: relative;
}
.icon-btn:hover { background: var(--slate-50); color: var(--slate-900); }
.icon-btn .badge-dot {
    position: absolute; top: 6px; right: 6px;
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--red-500); border: 2px solid white;
}

.page-content { flex: 1; overflow-y: auto; padding: 1.5rem; }
.page-header { margin-bottom: 1.5rem; }
.page-title { font-size: 1.5rem; font-weight: 700; color: var(--slate-900); margin: 0; }
.page-subtitle { font-size: 13px; color: var(--slate-500); margin-top: 4px; }

.card {
    background: white; border: 1px solid var(--slate-100);
    border-radius: 0.75rem; overflow: hidden;
}
.card-body { padding: 1.25rem; }
.card-header {
    padding: 1rem 1.25rem; border-bottom: 1px solid var(--slate-100);
    display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 14px; font-weight: 600; color: var(--slate-900); margin: 0; }

.stat-card {
    background: white; border: 1px solid var(--slate-100);
    border-radius: 0.75rem; padding: 1.25rem;
}
.stat-card .stat-label {
    font-size: 11px; color: var(--slate-400);
    text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600;
}
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; color: var(--slate-900); margin-top: 4px; }
.stat-card .stat-icon {
    width: 40px; height: 40px; border-radius: 0.5rem;
    display: inline-flex; align-items: center; justify-content: center;
    margin-bottom: 0.75rem;
}

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.375rem;
    padding: 0.5rem 0.875rem; border-radius: 0.5rem;
    font-size: 13px; font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer; text-decoration: none;
    transition: all 0.15s; line-height: 1.2;
}
.btn-primary { background: var(--primary-600); color: white; }
.btn-primary:hover { background: var(--primary-700); color: white; }
.btn-secondary { background: white; border-color: var(--slate-200); color: var(--slate-700); }
.btn-secondary:hover { background: var(--slate-50); color: var(--slate-900); }
.btn-danger { background: var(--red-600); color: white; }
.btn-danger:hover { background: var(--red-500); color: white; }
.btn-success { background: var(--emerald-600); color: white; }
.btn-success:hover { background: var(--emerald-500); color: white; }
.btn-ghost { background: transparent; color: var(--slate-600); }
.btn-ghost:hover { background: var(--slate-100); color: var(--slate-900); }
.btn-sm { padding: 0.375rem 0.625rem; font-size: 12px; }
.btn-lg { padding: 0.75rem 1.25rem; font-size: 14px; }

.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--slate-700); margin-bottom: 0.375rem; }
.form-control {
    width: 100%; padding: 0.5rem 0.75rem;
    border: 1px solid var(--slate-200); border-radius: 0.5rem;
    background: white; font-size: 13px; color: var(--slate-900);
    transition: all 0.15s;
}
.form-control:focus { outline: none; border-color: var(--primary-500); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1); }
.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%2364748b'%3E%3Cpath d='M8 11.5a.75.75 0 0 1-.53-.22L3.97 7.78a.75.75 0 1 1 1.06-1.06L8 9.69l2.97-2.97a.75.75 0 1 1 1.06 1.06l-3.5 3.5a.75.75 0 0 1-.53.22z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 0.5rem center; background-size: 16px; padding-right: 2rem;
}

.data-table { width: 100%; border-collapse: collapse; }
.data-table thead { background: var(--slate-50); }
.data-table th {
    text-align: left; padding: 0.75rem 1rem;
    font-size: 11px; font-weight: 600; color: var(--slate-500);
    text-transform: uppercase; letter-spacing: 0.05em;
    border-bottom: 1px solid var(--slate-100);
}
.data-table td {
    padding: 0.875rem 1rem; border-bottom: 1px solid var(--slate-100);
    font-size: 13px; color: var(--slate-700); vertical-align: middle;
}
.data-table tbody tr:hover { background: var(--slate-50); }
.data-table tbody tr:last-child td { border-bottom: none; }

.badge {
    display: inline-flex; align-items: center; gap: 0.25rem;
    padding: 0.125rem 0.5rem; border-radius: 9999px;
    font-size: 11px; font-weight: 500; line-height: 1.4;
}
.badge-emerald { background: #d1fae5; color: var(--emerald-600); }
.badge-amber   { background: #fef3c7; color: #b45309; }
.badge-red     { background: #fee2e2; color: var(--red-600); }
.badge-blue    { background: #dbeafe; color: #1d4ed8; }
.badge-violet  { background: #ede9fe; color: var(--violet-500); }
.badge-slate   { background: var(--slate-100); color: var(--slate-600); }

.status-active     { background: #d1fae5; color: var(--emerald-600); }
.status-inactive   { background: var(--slate-100); color: var(--slate-500); }
.status-pending    { background: #fef3c7; color: #b45309; }
.status-in_progress { background: #dbeafe; color: #1d4ed8; }
.status-clarification{ background: #ede9fe; color: var(--violet-500); }
.status-approved   { background: #d1fae5; color: var(--emerald-600); }
.status-rejected   { background: #fee2e2; color: var(--red-600); }
.status-generated  { background: #ddd6fe; color: #6d28d9; }
.status-downloaded { background: #c7d2fe; color: #4338ca; }
.status-passed_out { background: #c7d2fe; color: #4338ca; }
.status-resolved   { background: #d1fae5; color: var(--emerald-600); }
.status-open       { background: #fef3c7; color: #b45309; }
.status-under_review{ background: #dbeafe; color: #1d4ed8; }
.status-closed     { background: var(--slate-100); color: var(--slate-500); }
.status-suspended  { background: #fee2e2; color: var(--red-600); }
.status-transferred { background: #c7d2fe; color: #4338ca; }

.alert { padding: 0.75rem 1rem; border-radius: 0.5rem; font-size: 13px; margin-bottom: 1rem; display: flex; gap: 0.5rem; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

.modal-backdrop {
    position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5); z-index: 100;
    display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal-content {
    background: white; border-radius: 1rem; width: 100%;
    max-width: 600px; max-height: 90vh; overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
}
.modal-header {
    padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--slate-100);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 1.125rem; font-weight: 600; color: var(--slate-900); margin: 0; }
.modal-body { padding: 1.5rem; }
.modal-footer {
    padding: 1rem 1.5rem; border-top: 1px solid var(--slate-100);
    display: flex; justify-content: flex-end; gap: 0.5rem;
}
.modal-lg { max-width: 800px; }

.pagination {
    display: flex; align-items: center; gap: 0.25rem;
    padding: 1rem; border-top: 1px solid var(--slate-100);
    justify-content: space-between;
}
.pagination .page-info { font-size: 13px; color: var(--slate-500); }
.pagination .page-links { display: flex; gap: 0.25rem; }
.pagination a, .pagination span {
    padding: 0.375rem 0.625rem; border-radius: 0.375rem;
    font-size: 13px; color: var(--slate-700); text-decoration: none;
    border: 1px solid transparent;
}
.pagination a:hover { background: var(--slate-100); }
.pagination .active { background: var(--primary-600); color: white; font-weight: 500; }
.pagination .disabled { color: var(--slate-300); pointer-events: none; }

.filter-bar { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.filter-bar .form-control { width: auto; min-width: 140px; }

.auth-shell { min-height: 100vh; display: flex; background: linear-gradient(135deg, #312e81 0%, #1e293b 100%); }
.auth-pane-left {
    flex: 1; padding: 3rem; color: white;
    display: flex; flex-direction: column; justify-content: space-between;
    position: relative; overflow: hidden;
}
.auth-pane-right { width: 480px; background: white; padding: 3rem; display: flex; align-items: center; justify-content: center; }
.auth-form { width: 100%; max-width: 360px; }
.auth-form h2 { font-size: 1.875rem; font-weight: 700; color: var(--slate-900); margin-bottom: 0.5rem; }
.auth-form p.lead { font-size: 13px; color: var(--slate-500); margin-bottom: 2rem; }

.text-muted { color: var(--slate-400); }
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flex-grow { flex: 1; }
.mb-0 { margin-bottom: 0; }
.mt-0 { margin-top: 0; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.d-flex { display: flex; }
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.justify-center { justify-content: center; }
.w-100 { width: 100%; }

.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--slate-400); }
.empty-state svg { margin: 0 auto 1rem; opacity: 0.4; }
.empty-state h3 { font-size: 1rem; color: var(--slate-700); margin: 0 0 0.5rem; }
.empty-state p { font-size: 13px; margin: 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }

@media (max-width: 768px) {
    .sidebar { position: fixed; inset-y: 0; left: 0; z-index: 50; transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.open { display: block; }
    .topbar-search { display: none; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .auth-pane-left { display: none; }
    .auth-pane-right { width: 100%; }
}

.cert-page {
    width: 800px; margin: 2rem auto; padding: 3rem;
    background: white; border: 8px double var(--primary-600); text-align: center;
}
.cert-page h1 { font-size: 2.5rem; color: var(--primary-700); margin: 0 0 1rem; letter-spacing: 0.1em; }
.cert-page .cert-name { font-size: 1.75rem; font-weight: 600; color: var(--slate-900); margin: 1.5rem 0; }
.cert-page .cert-body { font-size: 1rem; color: var(--slate-600); line-height: 1.6; }

.notif-item {
    display: flex; gap: 0.75rem; padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--slate-100); align-items: flex-start;
}
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: var(--primary-50); }
.notif-icon {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--slate-100);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; font-size: 14px;
}
.notif-meta { font-size: 11px; color: var(--slate-400); margin-top: 2px; }
.notif-title { font-size: 13px; font-weight: 500; color: var(--slate-900); }
.notif-msg { font-size: 12px; color: var(--slate-600); }
