/* app/assets/css/app.css
   ------------------------------------------------------------------
   Hand-written component classes.

   IMPORTANT: this project uses the Tailwind CDN build
   (cdn.tailwindcss.com), which only scans the HTML DOM for utility
   classes and injects matching styles on the fly — it does NOT
   process @apply directives in external stylesheets (that requires
   a PostCSS build step this project intentionally doesn't have).
   So every class below is written as plain, explicit CSS that
   mirrors the intended Tailwind utilities, rather than using
   @apply, which would silently do nothing under the CDN build.
   ------------------------------------------------------------------ */

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    background-color: #5e130d;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #ffffff;
    border: none;
    cursor: pointer;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary:hover { background-color: #450c08; }
.btn-primary:focus { outline: none; box-shadow: 0 0 0 2px #fff, 0 0 0 4px #c1463a; }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    background-color: #e2e8f0;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #1e293b;
    border: none;
    cursor: pointer;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}
.btn-secondary:hover { background-color: #cbd5e1; }
.btn-secondary:focus { outline: none; box-shadow: 0 0 0 2px #fff, 0 0 0 4px #94a3b8; }

.form-input {
    display: block;
    width: 100%;
    border-radius: 0.5rem;
    border: 1px solid #cbd5e1;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-input:focus { border-color: #5e130d; box-shadow: 0 0 0 3px #f5cdc8; }
.form-input:disabled { background-color: #f8fafc; color: #94a3b8; }

.card {
    background-color: #ffffff;
    border-radius: 0.75rem;
    box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
    border: 1px solid #e2e8f0;
    padding: 1.5rem;
}

/* Inline field-level validation messages, shown/hidden by JS */
.field-error {
    font-size: 0.75rem;
    color: #dc2626;
    margin-top: 0.25rem;
    min-height: 1rem;
}

/* Status badges used across dashboard, login logs, and user tables */
.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    padding: 0.125rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
}
.badge-success { background-color: #dcfce7; color: #166534; }
.badge-danger  { background-color: #fee2e2; color: #991b1b; }
.badge-warning { background-color: #fef3c7; color: #92400e; }
.badge-slate   { background-color: #f1f5f9; color: #475569; }

/* ------------------------------------------------------------------
   Dashboard: entrance animation + stat card hover interaction.
   Plain @keyframes/@media work fine under the Tailwind CDN build
   (only @apply is unsupported there) — see the note at the top of
   this file.
   ------------------------------------------------------------------ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.animate-fade-in-up {
    animation: fadeInUp 0.45s ease both;
}

/* Staggered entrance for a grid of up to 12 cards, driven by a
   data-index attribute on each card rather than :nth-child, so the
   stagger still works if cards are conditionally omitted. */
.animate-fade-in-up[data-index="0"]  { animation-delay: 0ms;  }
.animate-fade-in-up[data-index="1"]  { animation-delay: 40ms; }
.animate-fade-in-up[data-index="2"]  { animation-delay: 80ms; }
.animate-fade-in-up[data-index="3"]  { animation-delay: 120ms; }
.animate-fade-in-up[data-index="4"]  { animation-delay: 160ms; }
.animate-fade-in-up[data-index="5"]  { animation-delay: 200ms; }
.animate-fade-in-up[data-index="6"]  { animation-delay: 240ms; }
.animate-fade-in-up[data-index="7"]  { animation-delay: 280ms; }
.animate-fade-in-up[data-index="8"]  { animation-delay: 320ms; }
.animate-fade-in-up[data-index="9"]  { animation-delay: 360ms; }
.animate-fade-in-up[data-index="10"] { animation-delay: 400ms; }
.animate-fade-in-up[data-index="11"] { animation-delay: 440ms; }

.stat-card {
    background-color: #ffffff;
    border-radius: 0.875rem;
    border: 1px solid #e2e8f0;
    padding: 1.25rem;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px -8px rgba(15, 23, 42, 0.12);
    border-color: #d9736a;
}

.stat-icon-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.75rem;
    flex-shrink: 0;
    transition: transform 0.18s ease;
}
.stat-card:hover .stat-icon-circle {
    transform: scale(1.08) rotate(-3deg);
}

.quick-action-btn {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    background-color: #ffffff;
    padding: 0.75rem 1rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #334155;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
    white-space: nowrap;
}
.quick-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px -6px rgba(15, 23, 42, 0.12);
    border-color: #d9736a;
    background-color: #fbebe9;
}
.quick-action-btn[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.activity-item {
    position: relative;
    padding-left: 1.5rem;
}
.activity-item::before {
    content: '';
    position: absolute;
    left: 0.25rem;
    top: 0.4rem;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 9999px;
    background-color: #5e130d;
}
.activity-item::after {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0.9rem;
    bottom: -0.9rem;
    width: 1px;
    background-color: #e2e8f0;
}
.activity-item:last-child::after { display: none; }

/* line-clamp utility (Tailwind's line-clamp plugin isn't part of the
   CDN core build) */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Status filter tabs (admissions list, etc.) */
.status-tab {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #64748b;
    background-color: #f1f5f9;
    border: 1px solid transparent;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.status-tab:hover {
    background-color: #e2e8f0;
}
.status-tab.active {
    background-color: #fbebe9;
    color: #5e130d;
    border-color: #e8a099;
}

/* Generic modal, used by the Academic Management module's per-entity
   create/edit dialogs (years, terms, departments, programmes, etc.).
   Defaults to display:none in OUR OWN stylesheet — deliberately not
   relying on Tailwind's .hidden utility class to hide it. A prior
   version of this rule only set display:flex conditionally and left
   the base state at the browser default (display:block for a div),
   which meant a modal stayed visibly on-screen whenever the Tailwind
   CDN script failed to load — confirmed via screenshot testing. */
.modal {
    position: fixed;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.5);
    z-index: 50;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    display: none;
}
.modal:not(.hidden) {
    display: flex;
}
.modal-box {
    background-color: #ffffff;
    border-radius: 0.75rem;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 28rem;
    padding: 1.5rem;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 1rem;
}
.modal-error {
    border-radius: 0.5rem;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
}
.modal-actions {
    display: flex;
    gap: 0.75rem;
    padding-top: 0.5rem;
}
.form-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: #334155;
    margin-bottom: 0.25rem;
}
.tab-panel.hidden { display: none; }

/* Small toggle-button group used by the Staff Attendance marking page */
.status-choice-btn {
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 500;
    border: 1px solid #e2e8f0;
    background-color: #ffffff;
    color: #64748b;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.status-choice-btn:hover {
    background-color: #f1f5f9;
}
.status-choice-btn.active {
    background-color: #5e130d;
    color: #ffffff;
    border-color: #5e130d;
}
