/* ==============================================================================
   SHADCN/UI DESIGN SYSTEM FOR TA OPS
   Modern, Minimalist, Accessible CSS Component Tokens & Utilities
   ============================================================================== */

:root {
    --background: 210 40% 98%;
    --foreground: 222.2 84% 4.9%;
    --card: 0 0% 100%;
    --card-foreground: 222.2 84% 4.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 222.2 84% 4.9%;
    --primary: 221.2 83.2% 53.3%;
    --primary-foreground: 210 40% 98%;
    --secondary: 210 40% 96.1%;
    --secondary-foreground: 222.2 47.4% 11.2%;
    --muted: 210 40% 96.1%;
    --muted-foreground: 215.4 16.3% 46.9%;
    --accent: 210 40% 96.1%;
    --accent-foreground: 222.2 47.4% 11.2%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 210 40% 98%;
    --border: 214.3 31.8% 91.4%;
    --input: 214.3 31.8% 91.4%;
    --ring: 221.2 83.2% 53.3%;
    --radius: 0.5rem;
}

/* ==============================================================================
   DOMINAN BACKGROUND PUTIH & HIGH READABILITY OVERRIDES
   ============================================================================== */
body, html {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #0f172a !important;
    background-color: #f8fafc !important;
    letter-spacing: -0.011em;
}

/* Kartu & Container Putih Bersih */
.bg-slate-800, .bg-slate-900, .bg-slate-950,
.bg-slate-800\/50, .bg-slate-900\/50, .bg-slate-900\/80, .bg-slate-900\/30,
.bg-slate-800\/80, .bg-slate-900\/90, .glass-panel, .card-shadcn {
    background-color: #ffffff !important;
    border-color: #e2e8f0 !important;
    color: #0f172a !important;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.05), 0 1px 2px -1px rgb(0 0 0 / 0.05) !important;
}

/* Mengubah Teks Putih Menjadi Gelap Tajam (Kecuali Elemen Tombol/Badge Berwarna) */
h1, h2, h3, h4, h5, h6 {
    color: #0f172a !important;
}

label, .label-text {
    color: #334155 !important;
    font-weight: 600 !important;
}

.text-white:not(button):not(button *):not(.btn):not(.btn *):not(.badge):not(.badge *):not([class*="bg-primary"]):not([class*="bg-blue"]):not([class*="bg-emerald"]):not([class*="bg-red"]),
.text-slate-100:not(button):not(button *):not(.btn):not(.btn *):not(.badge):not(.badge *),
.text-slate-200:not(button):not(button *):not(.btn):not(.btn *):not(.badge):not(.badge *),
.text-slate-300:not(button):not(button *):not(.btn):not(.btn *):not(.badge):not(.badge *) {
    color: #0f172a !important;
}

.text-slate-400, .text-slate-500 {
    color: #475569 !important;
}

/* Input, Select, Textarea Putih Bersih */
input:not([type="submit"]):not([type="button"]):not([type="checkbox"]):not([type="radio"]),
select, textarea,
.input, .select, .textarea, .input-shadcn, .select-shadcn, .textarea-shadcn {
    background-color: #ffffff !important;
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
}

input:focus, select:focus, textarea:focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15) !important;
}

/* ==============================================================================
   UNIVERSAL MODERN DIALOG & BACKDROP (POP-UP SHADCN UI)
   ============================================================================== */
dialog {
    display: none;
}

dialog[open] {
    display: flex !important;
    flex-direction: column;
    position: fixed !important;
    inset: 0 !important;
    margin: auto !important;
    max-height: 90vh !important;
    max-width: 95vw !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 1rem !important;
    background: #ffffff !important;
    color: #0f172a !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
    padding: 0 !important;
    overflow: hidden !important;
    z-index: 9999 !important;
    animation: modalPopAnim 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

dialog::backdrop {
    background-color: rgba(15, 23, 42, 0.65) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
    animation: modalFadeBackdrop 0.18s ease-out forwards !important;
}

@keyframes modalPopAnim {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes modalFadeBackdrop {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-box {
    background-color: #ffffff !important;
    color: #0f172a !important;
    padding: 1.5rem !important;
    max-height: 85vh !important;
    overflow-y: auto !important;
    width: 100% !important;
}

/* Hilangkan kebocoran teks tombol close pada backdrop dialog */
.modal-backdrop, dialog .modal-backdrop {
    display: none !important;
}

/* ==============================================================================
   UNIVERSAL BUTTON STYLING (SHADCN MODERN THEME)
   ============================================================================== */
.btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: 500 !important;
    border-radius: 0.5rem !important;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1) !important;
    cursor: pointer !important;
    font-size: 0.875rem !important;
    line-height: 1.25rem !important;
    padding: 0.5rem 1rem !important;
    border: 1px solid transparent !important;
    text-decoration: none !important;
    gap: 0.375rem !important;
}

.btn:active {
    transform: scale(0.98) !important;
}

.btn-primary {
    background-color: #2563eb !important;
    color: #ffffff !important;
    box-shadow: 0 1px 3px 0 rgba(37, 99, 235, 0.3) !important;
}
.btn-primary:hover {
    background-color: #1d4ed8 !important;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.35) !important;
}

.btn-success {
    background-color: #10b981 !important;
    color: #ffffff !important;
    box-shadow: 0 1px 3px 0 rgba(16, 185, 129, 0.3) !important;
}
.btn-success:hover {
    background-color: #059669 !important;
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.35) !important;
}

.btn-error, .btn-destructive {
    background-color: #ef4444 !important;
    color: #ffffff !important;
    box-shadow: 0 1px 3px 0 rgba(239, 68, 68, 0.3) !important;
}
.btn-error:hover, .btn-destructive:hover {
    background-color: #dc2626 !important;
    box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.35) !important;
}

.btn-info {
    background-color: #0ea5e9 !important;
    color: #ffffff !important;
    box-shadow: 0 1px 3px 0 rgba(14, 165, 233, 0.3) !important;
}
.btn-info:hover {
    background-color: #0284c7 !important;
}

.btn-outline {
    background-color: #ffffff !important;
    border-color: #cbd5e1 !important;
    color: #334155 !important;
}
.btn-outline:hover {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
    border-color: #94a3b8 !important;
}

.btn-outline.btn-error {
    border-color: #fca5a5 !important;
    color: #dc2626 !important;
    background-color: #ffffff !important;
}
.btn-outline.btn-error:hover {
    background-color: #fef2f2 !important;
    border-color: #ef4444 !important;
    color: #b91c1c !important;
}

.btn-outline.btn-info {
    border-color: #bae6fd !important;
    color: #0284c7 !important;
    background-color: #ffffff !important;
}
.btn-outline.btn-info:hover {
    background-color: #f0f9ff !important;
    border-color: #0ea5e9 !important;
    color: #0369a1 !important;
}

.btn-outline.btn-primary {
    border-color: #bfdbfe !important;
    color: #2563eb !important;
    background-color: #ffffff !important;
}
.btn-outline.btn-primary:hover {
    background-color: #eff6ff !important;
    border-color: #3b82f6 !important;
    color: #1d4ed8 !important;
}

.btn-ghost {
    background-color: transparent !important;
    color: #64748b !important;
    border: none !important;
}
.btn-ghost:hover {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
}

.btn-sm {
    padding: 0.375rem 0.75rem !important;
    font-size: 0.8125rem !important;
    height: 2.125rem !important;
    border-radius: 0.375rem !important;
}

.btn-xs {
    padding: 0.25rem 0.5rem !important;
    font-size: 0.75rem !important;
    height: 1.75rem !important;
    border-radius: 0.375rem !important;
}

.btn-circle {
    border-radius: 9999px !important;
    padding: 0 !important;
    width: 2rem !important;
    height: 2rem !important;
}
.btn-circle.btn-xs {
    width: 1.5rem !important;
    height: 1.5rem !important;
}

/* ==============================================================================
   UNIVERSAL BADGE STYLING (MODERN PILL BADGES)
   ============================================================================== */
.badge {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 9999px !important;
    padding: 0.125rem 0.625rem !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    line-height: 1rem !important;
    border: 1px solid transparent !important;
    white-space: nowrap !important;
    gap: 0.25rem !important;
}

.badge-sm {
    font-size: 0.6875rem !important;
    padding: 0.1rem 0.5rem !important;
}

.badge-xs {
    font-size: 0.625rem !important;
    padding: 0.05rem 0.375rem !important;
}

.badge-success {
    background-color: #ecfdf5 !important;
    color: #059669 !important;
    border-color: #a7f3d0 !important;
}

.badge-error {
    background-color: #fef2f2 !important;
    color: #dc2626 !important;
    border-color: #fecaca !important;
}

.badge-info, .badge-primary {
    background-color: #eff6ff !important;
    color: #2563eb !important;
    border-color: #bfdbfe !important;
}

.badge-ghost, .badge-neutral {
    background-color: #f1f5f9 !important;
    color: #64748b !important;
    border-color: #e2e8f0 !important;
}

/* ==============================================================================
   UNIVERSAL TABLE STYLING (CLEAN LIGHT SHADCN UI)
   ============================================================================== */
table, .table {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    font-size: 0.875rem !important;
}

table thead tr, .table thead tr {
    background-color: #f8fafc !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

table thead th, .table thead th {
    background-color: #f8fafc !important;
    color: #475569 !important;
    font-weight: 600 !important;
    font-size: 0.75rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    padding: 0.75rem 1rem !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

table tbody tr, .table tbody tr {
    border-bottom: 1px solid #f1f5f9 !important;
    transition: background-color 0.15s ease !important;
}

table tbody tr:hover, .table tbody tr:hover {
    background-color: #f8fafc !important;
}

table tbody td, .table tbody td {
    padding: 0.75rem 1rem !important;
    vertical-align: middle !important;
    color: #1e293b !important;
    border-bottom: 1px solid #f1f5f9 !important;
}


/* --------------------------------------------------
   SHADCN CARDS
   -------------------------------------------------- */
.card-shadcn {
    background-color: hsl(var(--card));
    color: hsl(var(--card-foreground));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.05), 0 1px 2px -1px rgb(0 0 0 / 0.05);
    transition: all 0.2s ease-in-out;
}

.card-header-shadcn {
    padding: 1.5rem 1.5rem 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.card-title-shadcn {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.025em;
    color: hsl(var(--card-foreground));
}

.card-desc-shadcn {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    line-height: 1.4;
}

.card-content-shadcn {
    padding: 1.5rem;
}

.card-footer-shadcn {
    padding: 1rem 1.5rem;
    border-top: 1px solid hsl(var(--border));
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    background-color: hsl(var(--muted) / 0.3);
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
}

/* --------------------------------------------------
   SHADCN BUTTONS
   -------------------------------------------------- */
.btn-shadcn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.875rem;
    font-weight: 500;
    height: 2.375rem;
    padding: 0 1rem;
    transition: all 0.15s ease;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    gap: 0.5rem;
}

.btn-shadcn:disabled, .btn-shadcn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-shadcn-sm {
    height: 2rem;
    padding: 0 0.75rem;
    font-size: 0.75rem;
    border-radius: calc(var(--radius) - 3px);
}

.btn-shadcn-lg {
    height: 2.75rem;
    padding: 0 1.5rem;
    font-size: 1rem;
    border-radius: var(--radius);
}

.btn-shadcn-default {
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}
.btn-shadcn-default:hover {
    background-color: hsl(var(--primary) / 0.9);
}

.btn-shadcn-secondary {
    background-color: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
}
.btn-shadcn-secondary:hover {
    background-color: hsl(var(--secondary) / 0.8);
}

.btn-shadcn-outline {
    background-color: transparent;
    border-color: hsl(var(--border));
    color: hsl(var(--foreground));
}
.btn-shadcn-outline:hover {
    background-color: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

.btn-shadcn-destructive {
    background-color: hsl(var(--destructive));
    color: hsl(var(--destructive-foreground));
}
.btn-shadcn-destructive:hover {
    background-color: hsl(var(--destructive) / 0.9);
}

.btn-shadcn-ghost {
    background-color: transparent;
    color: hsl(var(--foreground));
}
.btn-shadcn-ghost:hover {
    background-color: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

/* --------------------------------------------------
   SHADCN FORM CONTROLS (INPUT, SELECT, TEXTAREA)
   -------------------------------------------------- */
.input-shadcn, .select-shadcn, .textarea-shadcn {
    display: flex;
    width: 100%;
    border-radius: calc(var(--radius) - 2px);
    border: 1px solid hsl(var(--input));
    background-color: hsl(var(--card));
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: hsl(var(--foreground));
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input-shadcn {
    height: 2.375rem;
}

.input-shadcn:focus, .select-shadcn:focus, .textarea-shadcn:focus {
    outline: none;
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

.input-shadcn::placeholder, .textarea-shadcn::placeholder {
    color: hsl(var(--muted-foreground));
}

.label-shadcn {
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--foreground));
    margin-bottom: 0.375rem;
    display: inline-block;
}

/* --------------------------------------------------
   SHADCN BADGES
   -------------------------------------------------- */
.badge-shadcn {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    padding: 0.125rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid transparent;
    white-space: nowrap;
    gap: 0.25rem;
}

.badge-shadcn-default {
    background-color: hsl(var(--primary) / 0.15);
    color: hsl(var(--primary));
    border-color: hsl(var(--primary) / 0.3);
}

.badge-shadcn-secondary {
    background-color: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
    border-color: hsl(var(--border));
}

.badge-shadcn-success {
    background-color: rgb(34 197 94 / 0.15);
    color: rgb(22 163 74);
    border-color: rgb(34 197 94 / 0.3);
}

.badge-shadcn-warning {
    background-color: rgb(245 158 11 / 0.15);
    color: rgb(217 119 6);
    border-color: rgb(245 158 11 / 0.3);
}

.badge-shadcn-destructive {
    background-color: rgb(239 68 68 / 0.15);
    color: rgb(220 38 38);
    border-color: rgb(239 68 68 / 0.3);
}

/* --------------------------------------------------
   SHADCN TABLES
   -------------------------------------------------- */
.table-container-shadcn {
    width: 100%;
    overflow-x: auto;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    background-color: hsl(var(--card));
}

.table-shadcn {
    width: 100%;
    caption-side: bottom;
    font-size: 0.875rem;
    border-collapse: collapse;
}

.table-shadcn thead tr {
    border-bottom: 1px solid hsl(var(--border));
    background-color: hsl(var(--muted) / 0.5);
}

.table-shadcn th {
    height: 2.75rem;
    padding: 0 1rem;
    text-align: left;
    vertical-align: middle;
    font-weight: 600;
    color: hsl(var(--muted-foreground));
    font-size: 0.8125rem;
    letter-spacing: 0.025em;
    text-transform: uppercase;
}

.table-shadcn tbody tr {
    border-bottom: 1px solid hsl(var(--border));
    transition: background-color 0.15s ease;
}

.table-shadcn tbody tr:last-child {
    border-bottom: none;
}

.table-shadcn tbody tr:hover {
    background-color: hsl(var(--muted) / 0.4);
}

.table-shadcn td {
    padding: 0.875rem 1rem;
    vertical-align: middle;
    color: hsl(var(--foreground));
}

/* --------------------------------------------------
   SHADCN STAT CARDS
   -------------------------------------------------- */
.stat-card-shadcn {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-header-shadcn {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-title-shadcn {
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--muted-foreground));
}

.stat-value-shadcn {
    font-size: 1.875rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: hsl(var(--foreground));
    margin-top: 0.5rem;
}

.stat-desc-shadcn {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    margin-top: 0.25rem;
}

/* --------------------------------------------------
   MODERN SCROLLBAR & TRANSITIONS
   -------------------------------------------------- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: hsl(var(--background));
}

::-webkit-scrollbar-thumb {
    background: hsl(var(--muted-foreground) / 0.3);
    border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--muted-foreground) / 0.5);
}

.fade-in-portal {
    animation: fadeInPortal 0.2s ease-out forwards;
}

@keyframes fadeInPortal {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------
   CROSS-PLATFORM & MOBILE-FRIENDLY RESPONSIVE STYLES
   -------------------------------------------------- */
/* Smooth touch scrolling untuk tabel di smartphone */
.overflow-x-auto, .table-container-shadcn {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    max-width: 100%;
}

/* Optimasi layar Smartphone & Tablet */
@media (max-width: 768px) {
    /* Touch Target nyaman minimal 42px */
    .btn-shadcn {
        min-height: 2.625rem;
        font-size: 0.875rem;
    }
    
    .input-shadcn, .select-shadcn {
        min-height: 2.625rem;
        font-size: 0.9375rem; /* Cegah auto-zoom iOS Safari */
    }

    .card-content-shadcn {
        padding: 1rem;
    }

    .card-header-shadcn {
        padding: 1rem 1rem 0.75rem 1rem;
    }

    /* Tabel di smartphone */
    .table-shadcn th, .table-shadcn td {
        padding: 0.625rem 0.75rem;
        font-size: 0.8125rem;
        white-space: nowrap;
    }

    /* Modal box full width di smartphone */
    .modal-box {
        width: 95% !important;
        max-width: 95% !important;
        margin: 0 auto;
        padding: 1.25rem !important;
        border-radius: 1rem !important;
    }

    /* Stat card */
    .stat-value-shadcn {
        font-size: 1.5rem;
    }
}
