/* =====================================================================
   FCST Premium Skin for AdminLTE 4 + Bootstrap 5
   Professional Event/Conference ID Tag Management System v1.0
   ===================================================================== */
:root {
    --brand: #4f46e5;
    --brand-2: #7c3aed;
    --brand-dark: #1e1b4b;
    --ink: #0f172a;
    --muted: #64748b;
    --card-radius: 1rem;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .08);
    --shadow: 0 10px 30px -12px rgba(15, 23, 42, .18);
    --shadow-lg: 0 25px 50px -12px rgba(30, 27, 75, .35);
    --bs-font-sans-serif: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

body.premium {
    font-family: var(--bs-font-sans-serif);
    font-size: .925rem;
    color: var(--ink);
    background: #f4f6fb;
}
[data-bs-theme="dark"] body.premium { background: #0b1020; color: #e2e8f0; }

/* ---------------- Sidebar ---------------- */
.premium .app-sidebar {
    background: linear-gradient(180deg, #1e1b4b 0%, #111827 55%, #0b1120 100%) !important;
    border-right: 0;
    box-shadow: 4px 0 24px rgba(15, 23, 42, .25);
}
.premium .sidebar-brand {
    border-bottom: 1px solid rgba(255, 255, 255, .08) !important;
    height: auto; min-height: 3.6rem; padding: .55rem .75rem;
}
.premium .sidebar-brand .brand-link { display: flex; align-items: center; gap: .6rem; text-decoration: none; }
.premium .sidebar-brand .brand-image {
    width: 38px; height: 38px; object-fit: contain; background: #fff; border-radius: .65rem; padding: 3px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .35); margin: 0 !important; max-height: none; float: none;
}
.premium .brand-text { color: #fff !important; font-weight: 700; letter-spacing: .3px; line-height: 1.05; font-size: .98rem; }
.premium .brand-text small { display: block; font-weight: 500; font-size: .68rem; color: #a5b4fc; letter-spacing: .4px; text-transform: uppercase; }
.premium .sidebar-user {
    margin: .9rem .75rem .4rem; padding: .7rem; border-radius: .9rem;
    background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .08);
    display: flex; align-items: center; gap: .65rem;
}
.premium .sidebar-user .name { color: #fff; font-weight: 600; font-size: .82rem; line-height: 1.15; }
.premium .sidebar-user .role { font-size: .68rem; color: #c7d2fe; }
.premium .avatar {
    width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; color: #fff; font-size: .85rem; flex-shrink: 0;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    box-shadow: 0 0 0 3px rgba(255, 255, 255, .12);
}
.premium .sidebar-menu .nav-header {
    color: #818cf8 !important; font-size: .66rem; font-weight: 700; letter-spacing: 1.2px; padding: 1rem 1rem .35rem;
}
.premium .sidebar-menu .nav-link {
    color: #cbd5e1 !important; border-radius: .7rem; margin: 2px .6rem; padding: .55rem .8rem; transition: all .18s ease;
}
.premium .sidebar-menu .nav-link:hover { background: rgba(255, 255, 255, .07) !important; color: #fff !important; transform: translateX(2px); }
.premium .sidebar-menu .nav-link.active {
    background: linear-gradient(90deg, var(--brand), var(--brand-2)) !important; color: #fff !important;
    box-shadow: 0 8px 20px -6px rgba(79, 70, 229, .7);
}
.premium .sidebar-menu .nav-icon { font-size: 1.05rem; }
.premium .sidebar-footer-note { color: #64748b; font-size: .68rem; text-align: center; padding: 1rem .5rem; }

/* ---------------- Header / navbar ---------------- */
.premium .app-header {
    background: rgba(255, 255, 255, .85) !important; backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(15, 23, 42, .06) !important; box-shadow: var(--shadow-sm);
}
[data-bs-theme="dark"] .premium .app-header { background: rgba(15, 23, 42, .85) !important; }
.premium .app-header .nav-link { color: #334155; }
[data-bs-theme="dark"] .premium .app-header .nav-link { color: #cbd5e1; }
.premium .btn-back {
    border-radius: 2rem; padding: .3rem .85rem; font-weight: 600; font-size: .8rem;
    background: #eef2ff; color: var(--brand); border: 1px solid #e0e7ff;
}
.premium .btn-back:hover { background: var(--brand); color: #fff; }

/* ---------------- Content header ---------------- */
.premium .app-content-header { padding: 1.2rem .5rem .6rem; }
.premium .page-title { font-weight: 800; letter-spacing: -.4px; margin: 0; font-size: 1.45rem; }
.premium .page-subtitle { color: var(--muted); margin: .15rem 0 0; font-size: .85rem; }
.premium .breadcrumb { background: transparent; font-size: .8rem; margin: 0; }

/* ---------------- Cards ---------------- */
.premium .card {
    border: 0; border-radius: var(--card-radius); box-shadow: var(--shadow-sm), var(--shadow);
    overflow: hidden;
}
.premium .card-header { background: transparent; border-bottom: 1px solid rgba(15, 23, 42, .06); padding: .9rem 1.2rem; }
.premium .card-title { font-weight: 700; font-size: 1rem; }
.premium .card-header .card-title { float: none; margin: 0; }
.premium .card-premium-head {
    background: linear-gradient(120deg, var(--brand) 0%, var(--brand-2) 100%); color: #fff; border: 0;
}
.premium .card-premium-head .card-title, .premium .card-premium-head small { color: #fff; }

.kpi {
    position: relative; border-radius: 1rem; padding: 1.1rem 1.15rem; color: #fff; overflow: hidden;
    box-shadow: var(--shadow); min-height: 118px; transition: transform .2s ease, box-shadow .2s ease;
}
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.kpi .kpi-label { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .8px; opacity: .9; }
.kpi .kpi-value { font-size: 1.9rem; font-weight: 800; line-height: 1.1; margin-top: .25rem; }
.kpi .kpi-sub { font-size: .75rem; opacity: .9; }
.kpi .kpi-icon { position: absolute; right: .9rem; top: .9rem; font-size: 2.3rem; opacity: .28; }
.kpi::after {
    content: ""; position: absolute; width: 160px; height: 160px; border-radius: 50%; right: -50px; bottom: -70px;
    background: rgba(255, 255, 255, .12);
}
.bg-grad-indigo { background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.bg-grad-emerald { background: linear-gradient(135deg, #059669, #10b981); }
.bg-grad-amber { background: linear-gradient(135deg, #d97706, #f59e0b); }
.bg-grad-rose { background: linear-gradient(135deg, #e11d48, #f43f5e); }
.bg-grad-sky { background: linear-gradient(135deg, #0284c7, #38bdf8); }
.bg-grad-slate { background: linear-gradient(135deg, #334155, #64748b); }
.bg-grad-teal { background: linear-gradient(135deg, #0f766e, #14b8a6); }
.bg-grad-fuchsia { background: linear-gradient(135deg, #a21caf, #e879f9); }

.progress-thin { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .25); }
.progress-thin .progress-bar { background: #fff; }

.insight {
    display: flex; gap: .75rem; padding: .7rem .8rem; border-radius: .8rem; background: #f8fafc;
    border-left: 4px solid var(--brand); margin-bottom: .55rem; font-size: .86rem;
}
[data-bs-theme="dark"] .insight { background: #111827; }
.insight i { font-size: 1.2rem; }

/* ---------------- Tables ---------------- */
.premium .table { --bs-table-bg: transparent; }
.premium .table thead th {
    font-size: .72rem; text-transform: uppercase; letter-spacing: .7px; color: #64748b; font-weight: 700;
    background: #f8fafc; border-bottom: 1px solid #e2e8f0; white-space: nowrap;
}
[data-bs-theme="dark"] .premium .table thead th { background: #111827; color: #94a3b8; }
.premium .table td { vertical-align: middle; }
.premium .table-hover tbody tr:hover { background: #f5f7ff; }

/* ---------------- Forms ---------------- */
.premium .form-label { font-weight: 600; font-size: .83rem; color: #334155; margin-bottom: .3rem; }
[data-bs-theme="dark"] .premium .form-label { color: #cbd5e1; }
.premium .form-control, .premium .form-select { border-radius: .6rem; border-color: #dbe1ea; padding: .5rem .75rem; }
.premium .form-control:focus, .premium .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(79, 70, 229, .15); }
.req { color: #dc2626; font-weight: 700; margin-left: 2px; }
.mandatory-note {
    font-size: .8rem; color: #b91c1c; background: #fef2f2; border: 1px dashed #fecaca; padding: .45rem .75rem;
    border-radius: .6rem; display: inline-flex; align-items: center; gap: .4rem;
}
.premium .btn { border-radius: .6rem; font-weight: 600; }
.premium .btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); border: 0; }
.premium .btn-primary:hover { filter: brightness(1.08); }
.form-section-title {
    font-size: .74rem; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--brand);
    margin: .5rem 0 .9rem; display: flex; align-items: center; gap: .5rem;
}
.form-section-title::after { content: ""; flex: 1; height: 1px; background: #e2e8f0; }

/* ---------------- Upload / dropzone ---------------- */
.dropzone {
    border: 2px dashed #c7d2fe; border-radius: 1rem; background: #f5f7ff; padding: 2rem; text-align: center;
    cursor: pointer; transition: all .2s ease;
}
.dropzone.dragover { background: #e0e7ff; border-color: var(--brand); }
.dropzone i { font-size: 2.6rem; color: var(--brand); }
.preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }
.preview-item {
    position: relative; border-radius: .9rem; overflow: hidden; background: #fff; box-shadow: var(--shadow-sm), var(--shadow);
}
.preview-item .thumb { height: 190px; display: flex; align-items: center; justify-content: center; background: #f1f5f9; }
.preview-item .thumb img, .preview-item .thumb canvas { max-width: 100%; max-height: 190px; object-fit: contain; }
.preview-item .meta { padding: .45rem .6rem; font-size: .72rem; }
.preview-item .remove {
    position: absolute; top: .4rem; right: .4rem; border: 0; border-radius: 50%; width: 28px; height: 28px;
    background: rgba(220, 38, 38, .92); color: #fff;
}
.template-card .thumb { height: 220px; background: repeating-conic-gradient(#f1f5f9 0% 25%, #fff 0% 50%) 50% / 16px 16px; }

/* ---------------- Scanner ---------------- */
.scan-shell { border-radius: 1rem; overflow: hidden; background: #0f172a; min-height: 300px; }
#qr-reader { border: 0 !important; }
#qr-reader video { border-radius: .8rem; }
.scan-result { border-radius: 1rem; padding: 1.25rem; transition: all .2s; }
.scan-result.valid { background: linear-gradient(135deg, #ecfdf5, #d1fae5); border: 2px solid #10b981; }
.scan-result.invalid { background: linear-gradient(135deg, #fef2f2, #fee2e2); border: 2px solid #ef4444; }
.scan-result.warn { background: linear-gradient(135deg, #fffbeb, #fef3c7); border: 2px solid #f59e0b; }
.scan-status { font-size: 1.4rem; font-weight: 800; letter-spacing: .5px; }
.usb-input { font-size: 1.15rem; letter-spacing: 1px; font-family: ui-monospace, monospace; }

/* ---------------- Badges / misc ---------------- */
.badge { font-weight: 600; letter-spacing: .2px; }
.cat-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; }
.code-pill { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; background: #eef2ff; color: #3730a3; padding: .15rem .5rem; border-radius: .4rem; }
.timeline-mini { list-style: none; padding-left: 0; margin: 0; }
.timeline-mini li { position: relative; padding: 0 0 .9rem 1.4rem; border-left: 2px solid #e2e8f0; margin-left: .4rem; }
.timeline-mini li::before { content: ""; position: absolute; left: -7px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px #e0e7ff; }
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty-state i { font-size: 2.6rem; color: #c7d2fe; }
.qr-box svg { width: 100%; height: auto; max-width: 200px; }
.barcode-box svg { width: 100%; height: 60px; max-width: 280px; }

/* ---------------- AI Assistant widget ---------------- */
.ai-fab {
    position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 1060; width: 58px; height: 58px; border-radius: 50%;
    border: 0; color: #fff; font-size: 1.5rem; background: linear-gradient(135deg, var(--brand), var(--brand-2));
    box-shadow: 0 12px 28px -6px rgba(79, 70, 229, .6); animation: aiPulse 2.4s infinite;
}
@keyframes aiPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(124, 58, 237, .45); } 50% { box-shadow: 0 0 0 12px rgba(124, 58, 237, 0); } }
.ai-panel {
    position: fixed; right: 1.25rem; bottom: 5.4rem; z-index: 1060; width: 370px; max-width: calc(100vw - 2rem);
    height: 520px; max-height: calc(100vh - 7rem); background: #fff; border-radius: 1.1rem; box-shadow: var(--shadow-lg);
    display: none; flex-direction: column; overflow: hidden;
}
[data-bs-theme="dark"] .ai-panel { background: #0f172a; }
.ai-panel.open { display: flex; }
.ai-head { padding: .85rem 1rem; color: #fff; background: linear-gradient(120deg, var(--brand), var(--brand-2)); }
.ai-body { flex: 1; overflow-y: auto; padding: .9rem; background: #f8fafc; }
[data-bs-theme="dark"] .ai-body { background: #111827; }
.ai-msg { max-width: 88%; padding: .55rem .8rem; border-radius: .9rem; margin-bottom: .55rem; font-size: .85rem; white-space: pre-line; }
.ai-msg.bot { background: #fff; border: 1px solid #e2e8f0; border-bottom-left-radius: .2rem; }
[data-bs-theme="dark"] .ai-msg.bot { background: #1f2937; border-color: #374151; }
.ai-msg.me { background: var(--brand); color: #fff; margin-left: auto; border-bottom-right-radius: .2rem; }
.ai-chips { display: flex; flex-wrap: wrap; gap: .35rem; padding: .5rem .9rem 0; }
.ai-chips button { font-size: .72rem; border-radius: 2rem; }

/* ---------------- Login page ---------------- */
.login-page-premium { min-height: 100vh; display: flex; background: #0f172a; font-family: var(--bs-font-sans-serif); }
.login-hero {
    flex: 1.15; position: relative; color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between;
    background: radial-gradient(1200px 600px at -10% -10%, #6366f1 0%, transparent 60%),
                radial-gradient(900px 500px at 110% 110%, #a855f7 0%, transparent 55%),
                linear-gradient(135deg, #1e1b4b 0%, #0f172a 100%);
    overflow: hidden;
}
.login-hero .grid-bg {
    position: absolute; inset: 0; opacity: .12;
    background-image: linear-gradient(#fff 1px, transparent 1px), linear-gradient(90deg, #fff 1px, transparent 1px);
    background-size: 42px 42px; mask-image: radial-gradient(circle at 30% 40%, #000 0%, transparent 70%);
}
.login-hero .hero-logo { width: 84px; height: 84px; object-fit: contain; background: #fff; border-radius: 1.2rem; padding: 8px; box-shadow: 0 18px 40px rgba(0, 0, 0, .35); }
.login-hero h1 { font-weight: 800; font-size: 2.2rem; letter-spacing: -.6px; line-height: 1.15; }
.login-hero .feature { display: flex; gap: .8rem; align-items: flex-start; margin-bottom: 1rem; }
.login-hero .feature i { font-size: 1.3rem; background: rgba(255, 255, 255, .12); border-radius: .7rem; padding: .45rem .55rem; }
.floating-badge {
    position: absolute; right: 8%; top: 18%; width: 190px; padding: 1rem; border-radius: 1rem; background: rgba(255, 255, 255, .1);
    backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, .18); transform: rotate(6deg); animation: floaty 6s ease-in-out infinite;
}
@keyframes floaty { 0%, 100% { transform: rotate(6deg) translateY(0); } 50% { transform: rotate(4deg) translateY(-12px); } }
.login-panel { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2rem; background: #f8fafc; }
.login-card { width: 100%; max-width: 430px; background: #fff; border-radius: 1.4rem; padding: 2.2rem; box-shadow: var(--shadow-lg); }
.login-card .form-control { padding: .75rem .95rem; border-radius: .75rem; }
.login-card .input-group-text { border-radius: .75rem; background: #f1f5f9; }
.login-card .toggle-eye { cursor: pointer; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.login-card .btn-login { padding: .8rem; font-size: 1rem; border-radius: .8rem; }
@media (max-width: 991.98px) {
    .login-hero { display: none; }
    .login-panel { background: linear-gradient(135deg, #1e1b4b, #4f46e5); }
}

/* ---------------- Public verify page ---------------- */
.verify-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; background: linear-gradient(135deg, #1e1b4b, #4f46e5); }
.verify-card { max-width: 440px; width: 100%; background: #fff; border-radius: 1.4rem; overflow: hidden; box-shadow: var(--shadow-lg); }

/* ---------------- Responsive tweaks ---------------- */
@media (max-width: 575.98px) {
    .premium .page-title { font-size: 1.15rem; }
    .kpi .kpi-value { font-size: 1.5rem; }
    .premium .card-header { padding: .75rem .9rem; }
    .table-responsive-stack td { white-space: normal; }
}
@media print {
    .app-header, .app-sidebar, .app-footer, .no-print, .ai-fab, .ai-panel, .btn-back { display: none !important; }
    .app-main { margin: 0 !important; }
    .card { box-shadow: none !important; }
}
