/**
 * Mobile-first responsive overrides for the LMS.
 *
 * The vendored Alina template (style.css / responsive.css) already handles
 * most breakpoint behavior — this file only adds the LMS-specific pieces on
 * top of it: touch-friendly hit areas, the mobile header brand mark, the
 * floating bottom navigation dock (student and admin), and a few
 * overflow/scaling safety nets for modals and embeds. Every rule here is
 * scoped to < 992px (Bootstrap's `lg`) or narrower, so nothing here changes
 * the desktop layout.
 */

/* ---- Mobile header brand mark (hidden >= lg, where the full sidebar logo already shows) ---- */
.lms-header-logo {
    height: 30px;
    width: 30px;
    object-fit: contain;
    border-radius: 8px;
}

/* ---- Mobile header meta row ----
   The batch/status pill, rendered in normal document flow directly under
   the fixed header (see layouts/partials/header.blade.php) — the header's
   own single row is nowrap (see .lms-header-title below) and has no room
   left for the pill once the action icons moved into that row alongside
   the hamburger/logo, so it lives here instead. A normal-flow sibling of
   <header>, not a descendant of it, so it can never be clipped by or
   overlap anything below it (previously, wrapping inside header-main's
   fixed-height box let overflow spill down over the page content beneath
   it — most visibly the dashboard's blue hero card). Hidden at >= lg,
   where the single-row desktop header already has room for the pill inline.
*/
.lms-header-mobile-row {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background-color: rgba(var(--white), 1);
    border-bottom: 1px solid rgba(var(--secondary), 0.15);
}

.lms-header-mobile-row .lms-header-pill {
    min-width: 0;
    max-width: 100%;
}

/* ---- Header title: shrinks + truncates instead of wrapping ----
   The header's top row (hamburger, logo, title, action icons) is nowrap —
   see layouts/partials/header.blade.php — so the title is what gives up
   width first when the row is tight, rather than the icons wrapping onto a
   second line and overflowing the fixed-height header. Overrides
   style.css's own `.head-left h4` 2-line -webkit-line-clamp rule, which
   doesn't leave the icons enough guaranteed space since it lets the title
   claim a full second line before truncating. */
.lms-header-title {
    display: block !important;
    -webkit-line-clamp: unset !important;
    -webkit-box-orient: unset !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    min-width: 0;
    flex: 1 1 auto;
}

/* ---- Touch-friendly hit areas (WCAG/Apple HIG minimum ~44px) ---- */
@media (max-width: 991.98px) {
    .head-icon,
    .main-side-toggle,
    .side-toggle {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .btn,
    .page-link,
    .form-select,
    .form-control {
        min-height: 44px;
    }

    .form-check-input[type="checkbox"],
    .form-check-input[type="radio"] {
        width: 1.25em;
        height: 1.25em;
    }

    .form-check-input[role="switch"] {
        height: 1.5em;
    }

    .btn-sm {
        min-height: 40px;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }

    /* Icon-only action buttons in tables (edit/delete/preview) — square 44px targets. */
    table .btn.btn-sm {
        min-width: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .card-body {
        padding: 1rem;
    }

    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }
}

/* ---- Student dashboard hero card ----
   The large gradient "Welcome back" card (dashboard.blade.php). Unstyled
   beyond Bootstrap/theme card + gradient utilities until now, so its
   decorative background icon never had a position and its info pills read
   as flat chips rather than glass. Both get their intended treatment here,
   plus tighter type/spacing so a long student name doesn't wrap into an
   oversized, cramped block on a phone screen. */
.lms-hero-card {
    position: relative;
}

.lms-hero-icon {
    position: absolute;
    top: 50%;
    right: 1.5rem;
    transform: translateY(-50%);
    font-size: 7rem;
    color: rgba(var(--white), 0.12);
    pointer-events: none;
    line-height: 1;
}

.lms-hero-card .badge.bg-light-white {
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

@media (max-width: 767.98px) {
    .lms-hero-icon {
        font-size: 4.5rem;
        right: 1rem;
    }

    .lms-hero-card .card-body {
        padding: 1.25rem;
        gap: 1rem !important;
    }

    .lms-hero-card h3 {
        font-size: 1.375rem;
        line-height: 1.3;
    }

    .lms-hero-card > .card-body > p.text-white-50:first-of-type {
        font-size: 0.8125rem;
    }

    .lms-hero-card .badge {
        font-size: 0.75rem !important;
        padding: 0.4rem 0.7rem !important;
    }
}

/* ---- Floating glassmorphism bottom navigation dock ----
   Shared by both the student (bottom-nav.blade.php) and admin
   (admin-bottom-nav.blade.php) bars — same look for both roles, floating
   clear of the screen edges rather than flush, with a translucent blurred
   background that adapts to light/dark mode. */
.lms-bottom-nav {
    position: fixed;
    bottom: 0.75rem;
    left: 0.75rem;
    right: 0.75rem;
    z-index: 1030;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    text-align: center;
    padding: 0.5rem;
    background-color: rgba(255, 255, 255, 0.85);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 1rem;
    box-shadow: 0 20px 40px -8px rgba(15, 23, 42, 0.2);
    transition: all 0.3s ease;
    margin-bottom: env(safe-area-inset-bottom, 0);
}

body.dark .lms-bottom-nav {
    background-color: rgba(15, 23, 42, 0.85);
    border-color: rgba(51, 65, 85, 0.8);
    box-shadow: 0 20px 40px -8px rgba(0, 0, 0, 0.5);
}

.lms-bottom-nav-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 52px;
    padding: 6px 2px;
    border-radius: 0.75rem;
    color: #64748b; /* slate-500 */
    text-decoration: none;
    font-size: 10px;
    font-weight: 500;
    line-height: 1.1;
    transition: all 0.25s ease;
}

body.dark .lms-bottom-nav-item {
    color: #94a3b8; /* slate-400 */
}

.lms-bottom-nav-item i:not(.lms-bottom-nav-dot) {
    font-size: 1.15rem;
    transition: all 0.25s ease;
}

.lms-bottom-nav-item .lms-bottom-nav-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: transparent;
    box-shadow: none;
}

/* Active: glowing accent pill, bold vivid icon/text, glowing dot indicator. */
.lms-bottom-nav-item.active {
    background-color: rgba(var(--primary), 0.1);
    color: rgba(var(--primary), 1);
    font-weight: 700;
    transform: scale(1.05);
}

body.dark .lms-bottom-nav-item.active {
    background-color: rgba(var(--primary), 0.18);
    color: rgba(var(--primary), 1);
}

.lms-bottom-nav-item.active i:not(.lms-bottom-nav-dot) {
    transform: translateY(-1px);
}

.lms-bottom-nav-item.active .lms-bottom-nav-dot {
    background-color: rgba(var(--primary), 1);
    box-shadow: 0 0 8px 1px rgba(var(--primary), 0.8);
}

.lms-bottom-nav-badge {
    position: absolute;
    top: 0;
    right: calc(50% - 20px);
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: linear-gradient(135deg, #f43f5e, #f59e0b);
    color: #ffffff;
    font-size: 0.6rem;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
}

body.dark .lms-bottom-nav-badge {
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.85);
}

/* Reserve space at the bottom of the scrollable content so the floating
   dock never overlaps the last card/row/button on any mobile page.
   style.css's own base (non-media-query) `.app-wrapper .app-content` rule
   sets a fixed 47px padding-bottom at every screen size — two classes of
   specificity beats this file's plain `.app-content` on source order alone,
   so the selector here has to match it to actually win. */
@media (max-width: 767.98px) {
    .app-wrapper .app-content {
        padding-bottom: 6rem;
    }

    .go-top {
        bottom: 5.25rem;
    }
}
