/* ══════════════════════════════════════════════════════════════════
   EduManager — Custom Component Stylesheet
   Designed to complement Tailwind CSS utility classes.
   Color palette: Primary #0a58ca | Accent #7c3aed | Success #16a34a
                  Warning #ea580c | Danger #dc2626 | Secondary #64748b
   ══════════════════════════════════════════════════════════════════ */

/* ── Base typography ── */
body {
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: #1e293b;
}

/* ══════════════════════════════════
   SCROLLBAR
   ══════════════════════════════════ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
* {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

/* ══════════════════════════════════
   CARD
   ══════════════════════════════════ */
.card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 1px 3px 0 rgba(0,0,0,0.06), 0 1px 2px -1px rgba(0,0,0,0.04);
    padding: 24px;
    border: 1px solid #f1f5f9;
    transition: box-shadow 0.2s ease;
}
.card:hover {
    box-shadow: 0 4px 12px 0 rgba(0,0,0,0.08), 0 2px 6px -2px rgba(0,0,0,0.05);
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid #f1f5f9;
}
.card-title {
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}
.card-subtitle {
    font-size: 12px;
    color: #94a3b8;
    margin: 3px 0 0;
}

/* ══════════════════════════════════
   BUTTONS
   ══════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.4;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.18s ease;
    white-space: nowrap;
    -webkit-user-select: none;
    user-select: none;
}
.btn:focus-visible {
    outline: 3px solid rgba(10,88,202,0.35);
    outline-offset: 2px;
}
.btn:disabled,
.btn.disabled {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

/* Sizes */
.btn-sm {
    padding: 6px 13px;
    font-size: 12px;
    border-radius: 8px;
    gap: 5px;
}
.btn-lg {
    padding: 12px 26px;
    font-size: 15px;
    border-radius: 12px;
    gap: 9px;
}
.btn-xs {
    padding: 4px 9px;
    font-size: 11px;
    border-radius: 6px;
    gap: 4px;
}

/* Primary */
.btn-primary {
    background: linear-gradient(135deg, #0a58ca, #0d6efd);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(10,88,202,0.28);
}
.btn-primary:hover {
    background: linear-gradient(135deg, #084298, #0a58ca);
    box-shadow: 0 4px 12px rgba(10,88,202,0.35);
    transform: translateY(-1px);
    color: #ffffff;
}
.btn-primary:active { transform: translateY(0); }

/* Secondary */
.btn-secondary {
    background: #f1f5f9;
    color: #475569;
    box-shadow: none;
}
.btn-secondary:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* Outline Primary */
.btn-outline-primary {
    background: transparent;
    color: #0a58ca;
    border: 1.5px solid #0a58ca;
}
.btn-outline-primary:hover {
    background: #eff6ff;
    color: #084298;
}

/* Danger */
.btn-danger {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(220,38,38,0.25);
}
.btn-danger:hover {
    background: linear-gradient(135deg, #b91c1c, #dc2626);
    transform: translateY(-1px);
    color: #ffffff;
}

/* Success */
.btn-success {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(22,163,74,0.25);
}
.btn-success:hover {
    background: linear-gradient(135deg, #15803d, #16a34a);
    transform: translateY(-1px);
    color: #ffffff;
}

/* Warning */
.btn-warning {
    background: linear-gradient(135deg, #ea580c, #f97316);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(234,88,12,0.25);
}
.btn-warning:hover {
    background: linear-gradient(135deg, #c2410c, #ea580c);
    transform: translateY(-1px);
    color: #ffffff;
}

/* Accent */
.btn-accent {
    background: linear-gradient(135deg, #7c3aed, #8b5cf6);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(124,58,237,0.25);
}
.btn-accent:hover {
    background: linear-gradient(135deg, #6d28d9, #7c3aed);
    transform: translateY(-1px);
    color: #ffffff;
}

/* Icon-only button */
.btn-icon {
    padding: 8px;
    border-radius: 10px;
    width: 36px;
    height: 36px;
}
.btn-icon.btn-sm { width: 30px; height: 30px; padding: 6px; border-radius: 8px; }

/* ══════════════════════════════════
   BADGES
   ══════════════════════════════════ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
}
.badge-success   { background: #dcfce7; color: #15803d; }
.badge-danger    { background: #fee2e2; color: #b91c1c; }
.badge-warning   { background: #fef3c7; color: #b45309; }
.badge-info      { background: #dbeafe; color: #1d4ed8; }
.badge-secondary { background: #f1f5f9; color: #475569; }
.badge-primary   { background: #dbeafe; color: #0a58ca; }
.badge-accent    { background: #ede9fe; color: #6d28d9; }

/* Dot variant */
.badge-dot::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

/* ══════════════════════════════════
   ALERTS
   ══════════════════════════════════ */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 13.5px;
    line-height: 1.5;
    border: 1px solid transparent;
}
.alert-success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #15803d;
}
.alert-danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}
.alert-warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #b45309;
}
.alert-info {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}
.alert-icon {
    flex-shrink: 0;
    margin-top: 1px;
    font-size: 15px;
}

/* ══════════════════════════════════
   FORM CONTROLS
   ══════════════════════════════════ */
.form-label {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}
.form-label .required::after {
    content: ' *';
    color: #dc2626;
}

.form-control {
    width: 100%;
    padding: 9px 14px;
    font-size: 13.5px;
    color: #1e293b;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
    font-family: inherit;
    line-height: 1.5;
}
.form-control::placeholder { color: #94a3b8; }
.form-control:hover         { border-color: #cbd5e1; }
.form-control:focus         {
    border-color: #0a58ca;
    box-shadow: 0 0 0 3px rgba(10,88,202,0.14);
}
.form-control:disabled,
.form-control[readonly] {
    background: #f8fafc;
    color: #64748b;
    cursor: not-allowed;
}
.form-control.is-invalid {
    border-color: #dc2626;
    box-shadow: none;
}
.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(220,38,38,0.14);
}
.form-control.is-valid {
    border-color: #16a34a;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 15px;
    padding-right: 36px;
}

.form-group   { margin-bottom: 18px; }
.invalid-feedback {
    font-size: 12px;
    color: #dc2626;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Input with icon */
.input-icon-wrap { position: relative; }
.input-icon-wrap .input-icon-left {
    position: absolute; left: 12px; top: 50%;
    transform: translateY(-50%);
    color: #94a3b8; font-size: 13px; pointer-events: none;
}
.input-icon-wrap .form-control.has-icon-left { padding-left: 38px; }
.input-icon-wrap .input-icon-right {
    position: absolute; right: 12px; top: 50%;
    transform: translateY(-50%);
    color: #94a3b8; font-size: 13px;
}
.input-icon-wrap .form-control.has-icon-right { padding-right: 38px; }

/* Textarea */
textarea.form-control {
    resize: vertical;
    min-height: 90px;
}

/* ══════════════════════════════════
   TABLE
   ══════════════════════════════════ */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    border-radius: 16px;
    border: 1px solid #f1f5f9;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
table.table-auto {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
table.table-auto thead tr {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}
table.table-auto thead th {
    padding: 11px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}
table.table-auto tbody tr {
    border-bottom: 1px solid #f8fafc;
    transition: background 0.15s;
}
table.table-auto tbody tr:last-child { border-bottom: none; }
table.table-auto tbody tr:hover { background: #f8fafc; }
table.table-auto tbody td {
    padding: 11px 16px;
    color: #334155;
    vertical-align: middle;
}
table.table-auto tfoot tr {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}
table.table-auto tfoot td {
    padding: 10px 16px;
    font-size: 12.5px;
    color: #64748b;
}

/* Striped variant */
table.table-striped tbody tr:nth-child(even) { background: #fafbfc; }
table.table-striped tbody tr:nth-child(even):hover { background: #f1f5f9; }

/* ══════════════════════════════════
   PAGINATION
   ══════════════════════════════════ */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0; padding: 0;
}
.pagination-item a,
.pagination-item button,
.pagination-item span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
}
.pagination-item a:hover,
.pagination-item button:hover {
    background: #eff6ff;
    border-color: #0a58ca;
    color: #0a58ca;
}
.pagination-item.active a,
.pagination-item.active span {
    background: linear-gradient(135deg, #0a58ca, #0d6efd);
    border-color: #0a58ca;
    color: #fff;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(10,88,202,0.28);
}
.pagination-item.disabled a,
.pagination-item.disabled span {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}
.pagination-item.ellipsis span {
    border: none; background: transparent; cursor: default;
}

/* ══════════════════════════════════
   SIDEBAR NAV ITEMS
   (see admin.php for primary styles;
    these are supplemental overrides)
   ══════════════════════════════════ */
.nav-item {
    position: relative;
}
/* Tooltip for collapsed sidebar */
.sidebar-collapsed .nav-item[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: #1e293b;
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 8px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.sidebar-collapsed .nav-item[data-tooltip]:hover::after {
    opacity: 1;
}

/* ══════════════════════════════════
   STAT CARD (utility)
   ══════════════════════════════════ */
.stat-card {
    background: #fff;
    border-radius: 16px;
    padding: 22px;
    border: 1px solid #f1f5f9;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: box-shadow 0.2s, transform 0.2s;
}
.stat-card:hover {
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}
.stat-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-bottom: 14px;
}
.stat-card-value {
    font-size: 26px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1;
}
.stat-card-label {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
    margin-top: 5px;
}

/* ══════════════════════════════════
   PAGE HEADER
   ══════════════════════════════════ */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.page-title {
    font-size: 20px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
}
.page-subtitle {
    font-size: 13px;
    color: #64748b;
    margin-top: 4px;
}

/* ══════════════════════════════════
   MODAL (basic structure)
   ══════════════════════════════════ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.5);
    backdrop-filter: blur(2px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.modal {
    background: #fff;
    border-radius: 20px;
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    animation: slideUp 0.25s ease-out;
}
.modal-header {
    padding: 22px 24px 18px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-title {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
}
.modal-body    { padding: 24px; }
.modal-footer  {
    padding: 16px 24px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

/* ══════════════════════════════════
   SECTION / DIVIDER
   ══════════════════════════════════ */
.section-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, #e2e8f0 20%, #e2e8f0 80%, transparent);
    margin: 24px 0;
}
.section-heading {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: #94a3b8;
    margin-bottom: 12px;
}

/* ══════════════════════════════════
   LOADING SPINNER
   ══════════════════════════════════ */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
    width: 20px; height: 20px;
    border: 2.5px solid rgba(10,88,202,0.2);
    border-top-color: #0a58ca;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}
.spinner-sm { width: 14px; height: 14px; border-width: 2px; }
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }

/* ══════════════════════════════════
   EMPTY STATE
   ══════════════════════════════════ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}
.empty-state-icon {
    width: 56px; height: 56px;
    border-radius: 16px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #94a3b8;
    margin-bottom: 14px;
}
.empty-state-title   { font-size: 15px; font-weight: 700; color: #475569; margin-bottom: 6px; }
.empty-state-message { font-size: 13px; color: #94a3b8; max-width: 300px; }

/* ══════════════════════════════════
   AVATAR
   ══════════════════════════════════ */
.avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: #fff;
    background: linear-gradient(135deg, #0a58ca, #0d6efd);
    flex-shrink: 0;
    line-height: 1;
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 48px; height: 48px; font-size: 18px; }
.avatar-xl { width: 64px; height: 64px; font-size: 24px; border-radius: 16px; }

/* ══════════════════════════════════
   TOOLTIP (CSS-only)
   ══════════════════════════════════ */
[data-tip] { position: relative; cursor: default; }
[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 7px);
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: #fff;
    font-size: 11.5px;
    font-weight: 500;
    padding: 5px 9px;
    border-radius: 7px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.18s ease;
    z-index: 200;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
[data-tip]:hover::after { opacity: 1; }

/* ══════════════════════════════════
   PRINT UTILITIES
   ══════════════════════════════════ */
@media print {
    #sidebar, header, footer, .no-print { display: none !important; }
    body { margin: 0; }
    main { margin: 0 !important; padding: 20px !important; }
    .card { box-shadow: none; border: 1px solid #e2e8f0; }
}

/* ══════════════════════════════════
   RESPONSIVE HELPERS
   ══════════════════════════════════ */
@media (max-width: 640px) {
    .page-header { flex-direction: column; }
    .card { padding: 16px; border-radius: 12px; }
    .btn-lg { padding: 10px 20px; font-size: 14px; }
}

/* ══════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════ */
@keyframes fadeIn  { from { opacity: 0; }                                 to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); }   to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn   { from { opacity: 0; transform: scale(0.94); }       to { opacity: 1; transform: scale(1); } }

.animate-fade-in    { animation: fadeIn    0.4s ease-out both; }
.animate-slide-up   { animation: slideUp   0.35s ease-out both; }
.animate-slide-down { animation: slideDown 0.3s ease-out both; }
.animate-scale-in   { animation: scaleIn   0.25s ease-out both; }
