/* ═══════════════════════════════════════════════════════════
   SEMAR — Blend UI Layer (Shadcn tokens + Uiverse accents)
   Stack: Bootstrap 5 + vanilla CSS (no Tailwind required)
   ═══════════════════════════════════════════════════════════ */

:root {
    --background: #F8FAFC;
    --foreground: #0F172A;
    --card: #FFFFFF;
    --card-foreground: #0F172A;
    --muted: #E8ECF1;
    --muted-foreground: #64748B;
    --border: #E2E8F0;
    --input: #E2E8F0;
    --primary: #ED1C24;
    --primary-dark: #C8102E;
    --primary-foreground: #FFFFFF;
    --accent: #0369A1;
    --accent-foreground: #FFFFFF;
    --destructive: #DC2626;
    --success: #059669;
    --warning: #D97706;
    --ring: #ED1C24;
    --radius: 0.625rem;
    --radius-lg: 0.875rem;
    --sidebar-bg: #FFFFFF;
    --sidebar-border: #E2E8F0;
    --sidebar-accent: #F1F5F9;
    --shadow-soft: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 16px rgba(15, 23, 42, 0.04);
    --shadow-card: 0 4px 24px -4px rgba(15, 23, 42, 0.08);
    --ease-smooth: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ── Background dot grid ── */
.blend-bg {
    background-color: var(--background);
    background-image: radial-gradient(var(--border) 1px, transparent 1px);
    background-size: 20px 20px;
}

.blend-bg-glow {
    position: relative;
    isolation: isolate;
}

.blend-bg-glow::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(ellipse 60% 40% at 10% 0%, rgba(237, 28, 36, 0.06), transparent 55%),
        radial-gradient(ellipse 50% 35% at 90% 100%, rgba(3, 105, 161, 0.05), transparent 50%);
}

/* ── Topbar ── */
.blend-topbar {
    background: hsl(0 0% 100% / 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
    position: sticky;
    top: 0;
    z-index: 1030;
    padding: 0.6rem 0;
}

.blend-topbar .blend-brand-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--foreground);
    line-height: 1.2;
}

.blend-topbar .blend-brand-sub {
    font-size: 0.68rem;
    color: var(--muted-foreground);
}

.blend-user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--sidebar-accent);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    color: var(--foreground);
}

/* ── Sidebar ── */
.blend-sidebar {
    background: var(--sidebar-bg);
    border: 1px solid var(--sidebar-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.blend-sidebar-head {
    padding: 1rem 1.15rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--foreground);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.blend-nav {
    padding: 0.5rem;
}

.blend-nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.85rem;
    margin-bottom: 2px;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--muted-foreground);
    text-decoration: none;
    transition: background 0.2s var(--ease-smooth), color 0.2s ease;
    min-height: 44px;
}

.blend-nav-link i {
    font-size: 1.05rem;
    width: 1.35rem;
    text-align: center;
    flex-shrink: 0;
}

.blend-nav-link:hover {
    background: var(--sidebar-accent);
    color: var(--foreground);
}

.blend-nav-link.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--primary-foreground) !important;
    box-shadow: 0 4px 14px -2px rgba(237, 28, 36, 0.35);
}

.blend-nav-link.blend-nav-uiverse::after {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 12px;
    right: 12px;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), #ff6b6b);
    border-radius: 2px;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.25s ease;
}

.blend-nav-link.blend-nav-uiverse:hover::after,
.blend-nav-link.blend-nav-uiverse.active::after {
    transform: scaleX(1);
}

.blend-nav-link.active.blend-nav-uiverse::after {
    background: rgba(255, 255, 255, 0.5);
}

/* ── Page header ── */
.blend-page-header {
    margin-bottom: 1.5rem;
}

.blend-page-header h1,
.blend-page-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--foreground);
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
}

.blend-page-header p {
    color: var(--muted-foreground);
    font-size: 0.9rem;
    margin: 0;
}

.blend-page-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* ── Panel / Card ── */
.blend-panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

.blend-panel-head {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--foreground);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.blend-panel-body {
    padding: 1.25rem;
}

/* Uiverse stat card */
.blend-stat {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.15rem 1.25rem;
    position: relative;
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.blend-stat::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(237, 28, 36, 0.4), rgba(237, 28, 36, 0.05) 40%, rgba(3, 105, 161, 0.2));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.blend-stat:hover {
    box-shadow: var(--shadow-card);
    transform: translateY(-2px);
}

.blend-stat:hover::before {
    opacity: 1;
}

.blend-stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    background: linear-gradient(135deg, var(--foreground), var(--primary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.blend-stat-label {
    font-size: 0.8rem;
    color: var(--muted-foreground);
    margin-top: 0.15rem;
}

.blend-stat--success .blend-stat-value {
    background: linear-gradient(135deg, #065f46, var(--success));
    -webkit-background-clip: text;
    background-clip: text;
}

.blend-stat--accent .blend-stat-value {
    background: linear-gradient(135deg, #0c4a6e, var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
}

/* ── Buttons (Uiverse shine — CTA only) ── */
.blend-btn {
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 44px;
    padding: 0.5rem 1.1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.blend-btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--primary-foreground);
    box-shadow: 0 4px 14px -2px rgba(237, 28, 36, 0.4);
}

.blend-btn-primary:hover {
    color: var(--primary-foreground);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px -2px rgba(237, 28, 36, 0.5);
}

.blend-btn-primary .blend-btn-shine {
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.25) 50%, transparent 60%);
    transform: translateX(-100%);
    transition: transform 0.55s ease;
    pointer-events: none;
}

.blend-btn-primary:hover .blend-btn-shine {
    transform: translateX(100%);
}

.blend-btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--foreground);
}

.blend-btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(237, 28, 36, 0.04);
}

.blend-btn-sm {
    min-height: 36px;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.blend-btn-ghost {
    background: var(--sidebar-accent);
    color: var(--foreground);
    border: 1px solid var(--border);
}

/* ── Inputs (Uiverse glow) ── */
.blend-input,
.blend-select {
    display: block;
    width: 100%;
    min-height: 40px;
    padding: 0.45rem 0.85rem;
    font-size: 0.875rem;
    color: var(--foreground);
    background: var(--card);
    border: 1px solid var(--input);
    border-radius: var(--radius);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.blend-input:focus,
.blend-select:focus {
    outline: none;
    border-color: rgba(237, 28, 36, 0.5);
    box-shadow: 0 0 0 3px rgba(237, 28, 36, 0.1), 0 0 20px -4px rgba(237, 28, 36, 0.15);
}

.blend-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--foreground);
    margin-bottom: 0.35rem;
}

/* ── Table ── */
.blend-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.blend-table {
    width: 100%;
    margin: 0;
    font-size: 0.875rem;
}

.blend-table thead th {
    background: var(--sidebar-accent);
    color: var(--muted-foreground);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.blend-table tbody td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--foreground);
}

.blend-table tbody tr {
    transition: background 0.15s ease;
}

.blend-table tbody tr:hover {
    background: rgba(241, 245, 249, 0.8);
}

.blend-table tbody tr.table-active {
    background: hsl(0 84% 52% / 0.08) !important;
}

/* ── Badges ── */
.blend-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2em 0.65em;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 999px;
    line-height: 1.4;
}

.blend-badge--success { background: #D1FAE5; color: #065F46; }
.blend-badge--muted { background: var(--muted); color: var(--muted-foreground); }
.blend-badge--primary { background: #FEE2E2; color: var(--primary-dark); }
.blend-badge--warning { background: #FEF3C7; color: #92400E; }
.blend-badge--accent { background: #E0F2FE; color: #0369A1; }

/* ── Alerts ── */
.blend-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    border: 1px solid;
}

.blend-alert--success { background: #ECFDF5; border-color: #A7F3D0; color: #065F46; }
.blend-alert--warning { background: #FFFBEB; border-color: #FDE68A; color: #92400E; }
.blend-alert--danger { background: #FEF2F2; border-color: #FECACA; color: #991B1B; }
.blend-alert--info { background: #EFF6FF; border-color: #BFDBFE; color: #1E40AF; }

/* ── Toolbar ── */
.blend-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.blend-toolbar-label {
    font-size: 0.8rem;
    color: var(--muted-foreground);
    margin-right: auto;
}

/* ── Section (form groups) ── */
.blend-section {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    overflow: hidden;
    background: var(--card);
}

.blend-section-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 1.15rem;
    background: linear-gradient(180deg, #FFF8F8 0%, var(--card) 100%);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.9rem;
}

.blend-section-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.blend-section-body {
    padding: 1.15rem;
}

/* ── Login glass ── */
.blend-login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.blend-login-card {
    width: 100%;
    max-width: 920px;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border);
}

.blend-login-brand {
    background: linear-gradient(145deg, var(--foreground) 0%, #1e293b 100%);
    color: #fff;
    padding: 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100%;
}

.blend-login-form-side {
    background: hsl(0 0% 100% / 0.9);
    backdrop-filter: blur(16px);
    padding: 2rem 2.25rem;
}

.blend-glass {
    background: hsl(0 0% 100% / 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid hsl(0 0% 100% / 0.6);
}

/* ── Reveal animation ── */
.reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.5s var(--ease-smooth), transform 0.5s var(--ease-smooth);
}

.reveal.visible {
    opacity: 1;
    transform: none;
}

/* ── Modal overlay (keep existing behavior, blend style) ── */
.blend-modal-overlay {
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
}

/* ── Credential box ── */
.blend-credential-box {
    background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
    border: 1px solid #FDE68A;
    border-radius: var(--radius-lg);
    padding: 1rem 1.15rem;
}

.blend-credential-box code {
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.9rem;
}

.blend-topbar--scrolled {
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
}

/* ── Tabs (profil & settings) ── */
.blend-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.35rem;
    background: var(--muted);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    margin-bottom: 1.25rem;
}

.blend-tabs .nav-link {
    border: none;
    border-radius: var(--radius-md);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--muted-foreground);
    background: transparent;
    transition: background 0.2s ease, color 0.2s ease;
}

.blend-tabs .nav-link:hover {
    color: var(--foreground);
    background: hsl(0 0% 100% / 0.6);
}

.blend-tabs .nav-link.active {
    background: var(--card);
    color: var(--primary);
    box-shadow: var(--shadow-soft);
}

/* ── Profil sections ── */
.blend-profil-hero {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    align-items: flex-start;
    padding: 1.25rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
}

.blend-section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    overflow: hidden;
}

.blend-section-head {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.85rem 1.15rem;
    background: var(--muted);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.9rem;
}

.blend-section-head .step-num {
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.blend-section-body {
    padding: 1.15rem;
}

.blend-select-sm {
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
}

.blend-label-required::after {
    content: ' *';
    color: var(--primary);
}

/* ── Chart cards ── */
.blend-chart-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    height: 100%;
}

.blend-chart-card .blend-panel-head {
    border-bottom: none;
    padding-bottom: 0;
}

.blend-chart-wrap {
    position: relative;
    height: 200px;
}

.blend-chart-wrap--donut {
    height: 180px;
}

/* ── Leaderboard ── */
.blend-leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1.15rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s ease;
}

.blend-leaderboard-item:last-child {
    border-bottom: none;
}

.blend-leaderboard-item:hover {
    background: var(--muted);
}

.blend-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.75rem;
    height: 1.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.blend-rank--gold { background: #FEF3C7; color: #92400E; }
.blend-rank--silver { background: #F1F5F9; color: #475569; }
.blend-rank--bronze { background: #F8FAFC; color: #64748B; border: 1px solid var(--border); }

/* ── Harmonize legacy penugasan cards ── */
.penugasan-ai-card,
.penugasan-form-card,
.penugasan-list-card {
    background: var(--card) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-soft) !important;
}

.penugasan-card-head {
    border-bottom: 1px solid var(--border) !important;
}

.penugasan-input {
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-md) !important;
    padding: 0.5rem 0.75rem !important;
    font-size: 0.875rem !important;
}

.penugasan-input:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px hsl(0 84% 52% / 0.12) !important;
}

.penugasan-table thead th {
    background: var(--muted) !important;
    color: var(--muted-foreground) !important;
    font-size: 0.75rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.04em !important;
}

.penugasan-table tbody tr:hover {
    background: var(--muted) !important;
}

.btn-penugasan-submit,
.btn-penugasan-ai {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    border-radius: var(--radius-md) !important;
}

/* ── Legacy page-header → blend ── */
.page-header-clean h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--foreground);
}

.page-header-clean p {
    color: var(--muted-foreground);
    font-size: 0.9rem;
    margin-bottom: 0;
}

.page-header-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    background: hsl(0 84% 52% / 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}
@media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1; transform: none; transition: none; }
    .blend-stat:hover { transform: none; }
    .blend-btn-primary:hover { transform: none; }
    .blend-btn-primary .blend-btn-shine { display: none; }
    .blend-stat::before { display: none; }
}

/* ── Responsive ── */
@media (max-width: 767.98px) {
    .blend-sidebar {
        margin-bottom: 1rem;
    }

    .blend-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .blend-toolbar-label {
        margin-right: 0;
        margin-bottom: 0.25rem;
    }
}
