/* ==========================================================================
   Arihant College Portal — Modern SaaS Design System (theme.css)
   Loaded on every page AFTER Tailwind. Provides a cohesive visual uplift
   without needing to rewrite each page's markup.
   ========================================================================== */

:root {
    --ac-bg:        #f6f7fb;
    --ac-surface:   #ffffff;
    --ac-ink:       #0f172a;   /* slate-900 */
    --ac-muted:     #64748b;   /* slate-500 */
    --ac-line:      #e9edf5;
    --ac-primary:   #4f46e5;   /* indigo-600 */
    --ac-primary-2: #7c3aed;   /* violet-600 */
    --ac-primary-d: #4338ca;
    --ac-ring:      rgba(79, 70, 229, 0.12);
    --ac-grad:      linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --ac-grad-soft: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);
    --ac-shadow-sm: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
    --ac-shadow:    0 4px 6px -2px rgba(16,24,40,.05), 0 12px 24px -8px rgba(16,24,40,.10);
    --ac-shadow-lg: 0 24px 48px -12px rgba(16,24,40,.18);
    --ac-radius:    1.25rem;
}

/* ---------- Base ---------------------------------------------------------- */
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    background:
        radial-gradient(1200px 600px at 100% -10%, rgba(124,58,237,.06), transparent 60%),
        radial-gradient(1000px 500px at -10% 0%, rgba(79,70,229,.06), transparent 55%),
        var(--ac-bg) !important;
    color: var(--ac-ink);
    letter-spacing: -0.011em;
}

::selection { background: rgba(79,70,229,.18); }

/* Refined scrollbars */
* { scrollbar-width: thin; scrollbar-color: #c7cede transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #cfd6e6; border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #b3bcd4; background-clip: content-box; }

/* ---------- Typography ---------------------------------------------------- */
h1, h2, h3 { letter-spacing: -0.025em; }
.tabular, .tabular-nums { font-variant-numeric: tabular-nums; }

/* ---------- Global card uplift ------------------------------------------
   Enhances existing white cards (rounded + white bg) that pages already use,
   so every page gets softer borders, layered shadows and a subtle hover.
   ------------------------------------------------------------------------ */
[class*="rounded-xl"].bg-white,
[class*="rounded-2xl"].bg-white,
[class*="rounded-3xl"].bg-white,
[class*="rounded-[2"].bg-white,
[class*="rounded-[3"].bg-white {
    border: 1px solid var(--ac-line);
    box-shadow: var(--ac-shadow-sm);
    transition: box-shadow .25s ease, transform .25s ease, border-color .25s ease;
}

/* Cards that behave as raised panels get a stronger, layered shadow */
.bg-white.shadow-sm,
.bg-white.shadow,
.bg-white.shadow-md,
.bg-white.shadow-lg,
.bg-white.shadow-xl,
.bg-white.shadow-2xl {
    box-shadow: var(--ac-shadow) !important;
}

/* Gentle lift for interactive/hoverable cards */
a[class*="rounded-2xl"].bg-white:hover,
button[class*="rounded-2xl"].bg-white:hover,
.card-hover:hover {
    box-shadow: var(--ac-shadow-lg) !important;
    transform: translateY(-2px);
    border-color: #dfe4f0;
}

/* ---------- Primary buttons uplift --------------------------------------
   Turn the flat indigo buttons pages already use into gradient pills.
   ------------------------------------------------------------------------ */
button.bg-indigo-600, a.bg-indigo-600,
button.bg-indigo-700, a.bg-indigo-700,
.btn-primary {
    background: var(--ac-grad) !important;
    box-shadow: 0 8px 20px -6px rgba(79,70,229,.45), inset 0 1px 0 rgba(255,255,255,.18) !important;
    border: none;
    transition: transform .18s cubic-bezier(.34,1.56,.64,1), box-shadow .2s ease, filter .2s ease;
}
button.bg-indigo-600:hover, a.bg-indigo-600:hover,
button.bg-indigo-700:hover, a.bg-indigo-700:hover,
.btn-primary:hover {
    filter: brightness(1.05) saturate(1.05);
    box-shadow: 0 14px 28px -8px rgba(79,70,229,.55), inset 0 1px 0 rgba(255,255,255,.25) !important;
    transform: translateY(-1px);
}
button.bg-indigo-600:active, a.bg-indigo-600:active,
.btn-primary:active { transform: translateY(0) scale(.985); }

/* ---------- Inputs -------------------------------------------------------- */
input:not([type=checkbox]):not([type=radio]):not([type=range]),
select, textarea {
    transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--ac-primary) !important;
    box-shadow: 0 0 0 4px var(--ac-ring) !important;
}

/* ---------- Reusable components (for pages we touch) --------------------- */
.ac-shell { max-width: 80rem; margin: 0 auto; }

.ac-card {
    background: var(--ac-surface);
    border: 1px solid var(--ac-line);
    border-radius: var(--ac-radius);
    box-shadow: var(--ac-shadow);
}

.ac-stat {
    position: relative;
    background: var(--ac-surface);
    border: 1px solid var(--ac-line);
    border-radius: var(--ac-radius);
    box-shadow: var(--ac-shadow-sm);
    padding: 1.35rem 1.5rem;
    overflow: hidden;
    transition: box-shadow .25s ease, transform .25s ease;
}
.ac-stat:hover { box-shadow: var(--ac-shadow-lg); transform: translateY(-3px); }
.ac-stat::after {
    content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
    background: var(--ac-grad); opacity: .9;
}
.ac-stat__label { font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ac-muted); }
.ac-stat__value { font-size: 2rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; color: var(--ac-ink); }
.ac-stat__icon {
    width: 3rem; height: 3rem; border-radius: .9rem;
    display: flex; align-items: center; justify-content: center;
    background: var(--ac-grad-soft); color: var(--ac-primary);
    box-shadow: inset 0 0 0 1px rgba(79,70,229,.08);
}

.ac-icon-grad {
    width: 3rem; height: 3rem; border-radius: .9rem;
    display: flex; align-items: center; justify-content: center;
    background: var(--ac-grad); color: #fff;
    box-shadow: 0 8px 18px -6px rgba(79,70,229,.5);
}

.ac-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    padding: .7rem 1.15rem; border-radius: .85rem; font-weight: 700; font-size: .875rem;
    background: var(--ac-grad); color: #fff; border: none; cursor: pointer;
    box-shadow: 0 8px 20px -6px rgba(79,70,229,.45);
    transition: transform .18s cubic-bezier(.34,1.56,.64,1), box-shadow .2s ease, filter .2s ease;
}
.ac-btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.ac-btn-ghost {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    padding: .7rem 1.15rem; border-radius: .85rem; font-weight: 700; font-size: .875rem;
    background: #fff; color: var(--ac-ink); border: 1px solid var(--ac-line);
    box-shadow: var(--ac-shadow-sm); cursor: pointer; transition: all .18s ease;
}
.ac-btn-ghost:hover { border-color: #d5dbea; box-shadow: var(--ac-shadow); transform: translateY(-1px); }

.ac-badge {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .25rem .6rem; border-radius: 999px; font-size: .7rem; font-weight: 700;
    letter-spacing: .02em; background: var(--ac-grad-soft); color: var(--ac-primary);
    border: 1px solid rgba(79,70,229,.12);
}

/* Section heading helper */
.ac-h { font-size: 1.05rem; font-weight: 800; letter-spacing: -.02em; color: var(--ac-ink); }
.ac-sub { font-size: .8rem; color: var(--ac-muted); font-weight: 500; }

/* Entrance animation for content */
@keyframes ac-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
main .ac-rise, .ac-rise { animation: ac-rise .5s cubic-bezier(.22,1,.36,1) both; }

/* ---------- Mobile & responsive polish (applies to every screen) ---------
   theme.css is loaded by the main portal AND the library/attendance modules,
   so these rules unify mobile behaviour everywhere without touching markup.
   ------------------------------------------------------------------------ */

/* 1. The page body must never scroll sideways. Media stays within its box. */
html, body { max-width: 100%; overflow-x: hidden; }
img, canvas, video { max-width: 100%; height: auto; }

/* 2. Wide data tables scroll inside their own box on small screens instead of
      stretching the page. white-space:nowrap keeps rows readable while scrolling. */
@media (max-width: 640px) {
    /* Wide data tables scroll inside their own box (works whether the page
       uses <main> or the portal's max-w-7xl div). */
    table:not(.no-scroll) {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        scrollbar-width: thin;
    }

    /* Tighten oversized card padding so content isn't cramped on phones */
    .p-6, .p-8, .sm\:p-6, .sm\:p-8 { padding: 1.1rem !important; }

    /* Comfortable minimum tap targets for buttons on touch devices */
    button, .ac-btn, .ac-btn-ghost,
    a.bg-indigo-600, a.bg-emerald-600, a.bg-slate-900 {
        min-height: 40px;
    }

    /* Modals/dialogs never exceed the viewport width */
    [class*="max-w-"] { max-width: 100% !important; }

    /* Filter/search rows built as flex forms/divs must wrap, not clip.
       (flex-wrap is a no-op on non-flex elements, so this is safe.) */
    form.flex, form[class*="flex "], .filter-row {
        flex-wrap: wrap;
    }
    form.flex > input[type="text"],
    form.flex > input[type="search"],
    form.flex > .flex-1 { min-width: 0; flex-basis: 100%; }
}

/* 3. Consistent, comfortable form controls across the whole ERP.
      Prevents iOS zoom-on-focus (needs >=16px) and unifies control height. */
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]),
select, textarea {
    font-size: 16px;
}
@media (min-width: 641px) {
    /* On desktop keep the app's compact typography */
    input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]),
    select, textarea { font-size: 0.875rem; }
}

/* 4. Smooth momentum scrolling for any horizontal scroll containers already in use */
.overflow-x-auto { -webkit-overflow-scrolling: touch; }

/* Never interfere with print output */
@media print {
    body { background: #fff !important; }
    .ac-stat::after, .ac-stat:hover { box-shadow: none; transform: none; }
    /* Print tables normally, not as scroll blocks */
    main table { display: table !important; white-space: normal !important; overflow: visible !important; }
}
