/* ==========================================================================
   Flat Theme — Flat Able-inspired design system for Media Server
   Palette: indigo → violet brand, amber accent. All brand tokens live in
   :root so the palette can be retuned in one place.
   ========================================================================== */

:root {
    --flat-primary: #6d28d9;
    --flat-primary-2: #4f46e5;
    --flat-primary-soft: #ede9fe;
    --flat-accent: #f59e00;
    --flat-accent-soft: #fef3c7;
    --flat-canvas: #f1f3f9;
    --flat-ink: #1e1b34;
    --flat-ink-soft: #6b6f8d;
    --flat-card-shadow: 0 1px 2px rgba(30, 27, 52, .05), 0 8px 24px -12px rgba(76, 29, 149, .18);
    --flat-card-shadow-hover: 0 2px 4px rgba(30, 27, 52, .06), 0 16px 40px -12px rgba(76, 29, 149, .28);
    --flat-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #9333ea 100%);
    --flat-gradient-warm: linear-gradient(135deg, #f59e00 0%, #f97316 100%);
    --flat-radius: 14px;
}

/* ---------- Canvas ---------- */
body.flat-ui {
    background-color: var(--flat-canvas);
    color: var(--flat-ink);
}

/* ---------- Page entrance ---------- */
@keyframes flat-page-in {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes flat-card-in {
    from { opacity: 0; transform: translateY(18px) scale(.99); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.flat-page {
    animation: flat-page-in .45s cubic-bezier(.22, .9, .28, 1) backwards;
}
.flat-stagger > * {
    animation: flat-card-in .5s cubic-bezier(.22, .9, .28, 1) backwards;
}
.flat-stagger > *:nth-child(1) { animation-delay: .03s; }
.flat-stagger > *:nth-child(2) { animation-delay: .09s; }
.flat-stagger > *:nth-child(3) { animation-delay: .15s; }
.flat-stagger > *:nth-child(4) { animation-delay: .21s; }
.flat-stagger > *:nth-child(5) { animation-delay: .27s; }
.flat-stagger > *:nth-child(6) { animation-delay: .33s; }
.flat-stagger > *:nth-child(n+7) { animation-delay: .38s; }

/* ---------- Sidebar ---------- */
.flat-sidebar {
    background: linear-gradient(178deg, #312e81 0%, #4c1d95 52%, #6d28d9 100%) !important;
    border-right: 0 !important;
    box-shadow: 4px 0 24px -8px rgba(49, 46, 129, .5);
}
.flat-sidebar .navbar-brand,
.flat-sidebar .navbar-brand a {
    color: #fff !important;
}
.flat-sidebar .nav-link-title,
.flat-sidebar .nav-link {
    color: rgba(255, 255, 255, .72) !important;
}
.flat-sidebar .nav-link .nav-link-icon {
    color: rgba(255, 255, 255, .55) !important;
}
.flat-sidebar .nav-link:hover {
    background: rgba(255, 255, 255, .12) !important;
    color: #fff !important;
    transform: translateX(3px);
}
.flat-sidebar .nav-link {
    border-radius: 10px;
    margin: 1px 8px;
    transition: background .2s ease, transform .2s ease, color .2s ease;
}
.flat-sidebar .nav-link.active {
    background: rgba(255, 255, 255, .18) !important;
    color: #fff !important;
    box-shadow: inset 3px 0 0 var(--flat-accent);
}
.flat-sidebar .nav-link.active .nav-link-icon {
    color: var(--flat-accent) !important;
}
.flat-sidebar .nav-link-title.text-uppercase {
    color: rgba(255, 255, 255, .45) !important;
}
.flat-sidebar .text-white,
.flat-sidebar .text-white-50 {
    color: rgba(255, 255, 255, .85) !important;
}

/* ---------- Topbar ---------- */
.flat-topbar {
    background: rgba(255, 255, 255, .85) !important;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(30, 27, 52, .07) !important;
    position: sticky;
    top: 0;
    z-index: 1030;
}
/* Dropdowns must always paint above page content (animated sections
   create their own stacking contexts). */
.flat-ui .dropdown-menu {
    z-index: 1050;
}
.flat-crumb {
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -.01em;
}
.flat-crumb small {
    display: block;
    font-weight: 400;
    font-size: .75rem;
    color: var(--flat-ink-soft);
}

/* ---------- Cards ---------- */
.flat-ui .card {
    border: 0;
    border-radius: var(--flat-radius);
    box-shadow: var(--flat-card-shadow);
    transition: transform .22s ease, box-shadow .22s ease;
}
.flat-ui .card.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--flat-card-shadow-hover);
}
.flat-ui .card-header {
    border-bottom: 1px solid rgba(30, 27, 52, .07);
    background: transparent;
}
.flat-ui .card-header:first-child {
    border-radius: var(--flat-radius) var(--flat-radius) 0 0;
}
.flat-ui .page-title {
    font-weight: 800;
    letter-spacing: -.02em;
}

/* Section heading with icon badge */
.flat-heading {
    display: flex;
    align-items: center;
    gap: .65rem;
}
.flat-heading .flat-ico {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--flat-gradient);
    color: #fff;
    box-shadow: 0 6px 14px -6px rgba(109, 40, 217, .6);
}
.flat-heading .flat-ico i { font-size: 1.1rem; }

/* ---------- Gradient stat cards ---------- */
.flat-stat {
    position: relative;
    overflow: hidden;
    border: 0;
    border-radius: var(--flat-radius);
    color: #fff;
    box-shadow: 0 12px 28px -12px rgba(76, 29, 149, .55);
}
.flat-stat::after {
    content: "";
    position: absolute;
    right: -46px;
    top: -46px;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .14);
}
.flat-stat::before {
    content: "";
    position: absolute;
    right: 6px;
    bottom: -58px;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .1);
}
.flat-stat-1 { background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.flat-stat-2 { background: linear-gradient(135deg, #7c3aed, #a855f7); }
.flat-stat-3 { background: linear-gradient(135deg, #9333ea, #d946ef); }
.flat-stat-4 { background: linear-gradient(135deg, #f59e00, #f97316); }
.flat-stat .flat-stat-num {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -.02em;
}
.flat-stat .flat-stat-ico {
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: rgba(255, 255, 255, .2);
}
.flat-stat .flat-stat-ico i { font-size: 1.4rem; }

/* ---------- Buttons ---------- */
.flat-ui .btn-flat-primary {
    background: var(--flat-gradient);
    border: 0;
    color: #fff;
    font-weight: 600;
    border-radius: 10px;
    box-shadow: 0 8px 18px -8px rgba(109, 40, 217, .7);
    transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}
.flat-ui .btn-flat-primary:hover,
.flat-ui .btn-flat-primary:focus {
    color: #fff;
    filter: brightness(1.08);
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -8px rgba(109, 40, 217, .75);
}
.flat-ui .btn-flat-primary:active { transform: translateY(0); }
.flat-ui .btn-flat-warm {
    background: var(--flat-gradient-warm);
    border: 0;
    color: #fff;
    font-weight: 600;
    border-radius: 10px;
    box-shadow: 0 8px 18px -8px rgba(249, 115, 22, .7);
    transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}
.flat-ui .btn-flat-warm:hover { color: #fff; filter: brightness(1.06); transform: translateY(-2px); }
.flat-ui .btn {
    border-radius: 10px;
    transition: transform .16s ease, box-shadow .16s ease;
}
.flat-ui .btn:not(.btn-flat-primary):not(.btn-flat-warm):hover {
    transform: translateY(-1px);
}

/* ---------- Tables ---------- */
.flat-ui .table thead th {
    text-transform: uppercase;
    font-size: .68rem;
    letter-spacing: .06em;
    color: var(--flat-ink-soft);
    border-bottom: 1px solid rgba(30, 27, 52, .1);
    background: rgba(109, 40, 217, .04);
}
.flat-ui .table-hover tbody tr {
    transition: background .15s ease, transform .15s ease;
}
.flat-ui .table-hover tbody tr:hover {
    background: rgba(109, 40, 217, .05);
}

/* ---------- Forms ---------- */
.flat-ui .form-control,
.flat-ui .form-select {
    border-radius: 10px;
    border: 1px solid rgba(30, 27, 52, .14);
    transition: border-color .18s ease, box-shadow .18s ease;
}
.flat-ui .form-control:focus,
.flat-ui .form-select:focus {
    border-color: var(--flat-primary);
    box-shadow: 0 0 0 .2rem rgba(109, 40, 217, .15);
}
@keyframes flat-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}
.flat-ui .is-invalid {
    animation: flat-shake .4s ease;
}

/* ---------- Badges ---------- */
.flat-ui .badge {
    border-radius: 999px;
    font-weight: 600;
}

/* ---------- Timeline (approval flows) ---------- */
.flat-timeline {
    position: relative;
    padding-left: 1.75rem;
}
.flat-timeline::before {
    content: "";
    position: absolute;
    left: 9px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--flat-primary), var(--flat-accent));
}
.flat-timeline-item {
    position: relative;
    animation: flat-card-in .45s cubic-bezier(.22, .9, .28, 1) backwards;
}
.flat-timeline-item::before {
    content: "";
    position: absolute;
    left: -1.75rem;
    top: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    border: 5px solid var(--flat-primary);
    box-shadow: 0 0 0 3px var(--flat-primary-soft);
}

/* ---------- Login ---------- */
.flat-login-bg {
    position: relative;
    overflow: hidden;
    background: linear-gradient(160deg, #1e1b4b 0%, #4c1d95 45%, #7c3aed 100%);
}
.flat-login-bg .blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: .5;
    animation: flat-drift 12s ease-in-out infinite alternate;
}
.flat-login-bg .blob-1 { width: 340px; height: 340px; background: #a855f7; top: -90px; left: -90px; }
.flat-login-bg .blob-2 { width: 280px; height: 280px; background: #4c1d95; bottom: -100px; right: -70px; animation-delay: -6s; }
@keyframes flat-drift {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(40px, 30px) scale(1.12); }
}
.flat-login-wrap { max-width: 880px; }
.flat-login-card {
    position: relative;
    border: 0;
    border-radius: 20px;
    box-shadow: 0 30px 80px -20px rgba(30, 27, 52, .55);
    overflow: hidden;
    animation: flat-card-in .55s cubic-bezier(.22, .9, .28, 1) backwards;
    background: #fff;
}
/* Left welcome panel — mock shape, current indigo/violet palette */
.flat-login-welcome {
    position: relative;
    overflow: hidden;
    padding: 2.5rem 2.25rem;
    background: linear-gradient(160deg, #312e81 0%, #4c1d95 45%, #6d28d9 75%, #7c3aed 100%);
}
.flat-login-curve {
    position: absolute;
    top: -10%;
    right: -110px;
    width: 220px;
    height: 120%;
    background: #fff;
    border-radius: 50% 0 0 50% / 50% 0 0 50%;
}
.flat-login-circle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
}
.flat-login-circle-1 { width: 190px; height: 190px; left: -60px; bottom: -70px; background: rgba(255,255,255,.16); }
.flat-login-circle-2 { width: 150px; height: 150px; left: 130px; bottom: -40px; background: rgba(255,255,255,.14); }
.flat-login-welcome-inner { position: relative; z-index: 1; }
.flat-login-welcome-title {
    font-weight: 800;
    letter-spacing: .04em;
    font-size: 2rem;
    margin-bottom: .15rem;
}
.flat-login-welcome-sub {
    font-weight: 700;
    letter-spacing: .12em;
    font-size: .8rem;
    color: rgba(255,255,255,.85);
    margin-bottom: 1rem;
}
.flat-login-welcome-text {
    font-size: .82rem;
    line-height: 1.6;
    color: rgba(255,255,255,.72);
    margin-bottom: 0;
    max-width: 26ch;
}
.flat-login-points { color: rgba(255,255,255,.7); font-size: .85rem; }
/* Right form panel — mock pill inputs + centered heading */
.flat-login-form { padding: 2.5rem 3rem; }
.flat-login-title {
    text-align: center;
    font-weight: 800;
    letter-spacing: -.02em;
    font-size: 1.9rem;
    margin-bottom: .15rem;
    color: var(--flat-ink);
}
.flat-login-subtitle {
    text-align: center;
    font-size: .76rem;
    color: var(--flat-ink-soft);
    margin-bottom: 1.5rem;
}
.flat-login-field {
    display: flex;
    align-items: center;
    gap: .6rem;
    background: #f1f3f9;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: .7rem 1rem;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.flat-login-field:focus-within {
    background: #fff;
    border-color: var(--flat-primary);
    box-shadow: 0 0 0 .2rem rgba(109, 40, 217, .15);
}
.flat-login-field.is-invalid { border-color: #d63939; animation: flat-shake .4s ease; }
.flat-login-field-icon { color: var(--flat-ink); font-size: 1.05rem; flex: 0 0 auto; }
.flat-login-input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    background: transparent;
    outline: 0;
    font-size: .9rem;
    color: var(--flat-ink);
}
.flat-login-input::placeholder { color: #9aa0b8; }
.flat-login-show {
    flex: 0 0 auto;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .06em;
    color: var(--flat-primary-2);
    text-decoration: none;
}
.flat-login-show:hover { color: var(--flat-primary); }
.flat-login-meta { font-size: .78rem; color: var(--flat-ink-soft); }
.flat-login-forgot { color: var(--flat-ink-soft); cursor: help; }
.flat-login-submit { border-radius: 10px; }
.flat-login-corner {
    position: absolute;
    right: -38px;
    bottom: -38px;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: var(--flat-primary);
    opacity: .9;
    pointer-events: none;
}
.flat-login-help { color: rgba(255,255,255,.7); font-size: .82rem; }
@media (max-width: 767.98px) {
    .flat-login-form { padding: 1.75rem 1.5rem; }
    .flat-login-corner { display: none; }
}

/* ---------- Toasts ---------- */
@keyframes flat-toast-in {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
}
.flat-ui .toast.show {
    animation: flat-toast-in .35s cubic-bezier(.22, .9, .28, 1) backwards;
    border-radius: 12px;
    border: 0;
}

/* ---------- Livewire loading shimmer ---------- */
@keyframes flat-shimmer {
    from { background-position: -400px 0; }
    to   { background-position: 400px 0; }
}
.flat-loading-shimmer {
    background: linear-gradient(90deg, rgba(109,40,217,.08) 25%, rgba(109,40,217,.18) 50%, rgba(109,40,217,.08) 75%);
    background-size: 800px 100%;
    animation: flat-shimmer 1.2s linear infinite;
    border-radius: 8px;
    min-height: 1.4em;
}

/* ---------- Kiosk player (functional-first) ---------- */
@keyframes flat-kiosk-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.flat-kiosk-stage {
    animation: flat-kiosk-in .8s ease both;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .flat-page,
    .flat-stagger > *,
    .flat-timeline-item,
    .flat-login-card,
    .flat-ui .toast.show {
        animation: none;
    }
    .flat-login-bg .blob { animation: none; }
    .flat-ui .card.hover-lift:hover,
    .flat-ui .btn-flat-primary:hover,
    .flat-sidebar .nav-link:hover {
        transform: none;
    }
}
