/**
 * modern-saas.css - Reusable Modern SaaS Design System Tokens & Utilities
 * Diadopsi dari standar desain Mobbin (Attio, Linear, Supabase, Clay)
 */

:root {
    --saas-radius-sm: 6px;
    --saas-radius-md: 10px;
    --saas-radius-lg: 14px;
    --saas-radius-full: 9999px;
    --saas-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --saas-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --saas-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
    --saas-shadow-floating: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --saas-focus-ring: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* ==========================================================================
   BOOTSTRAP 5 MODERN OVERRIDES & RESET (Anti-Default Bootstrap Engine)
   Mengubah class-class bawaan Bootstrap menjadi standar estetika SaaS Mobbin
   ========================================================================== */

/* 1. Tombol (Buttons) Modern SaaS */
.btn {
    border-radius: var(--saas-radius-md) !important;
    font-weight: 600 !important;
    font-size: 0.85rem !important;
    letter-spacing: -0.01em !important;
    padding: 0.5rem 1rem !important;
    transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
.btn:focus, .btn:active {
    box-shadow: var(--saas-focus-ring) !important;
}
.btn-primary {
    background-color: #0f172a !important;
    border-color: #0f172a !important;
    color: #ffffff !important;
    box-shadow: var(--saas-shadow-sm) !important;
}
.btn-primary:hover {
    background-color: #1e293b !important;
    border-color: #1e293b !important;
    color: #ffffff !important;
    transform: translateY(-1px);
}
.btn-outline-primary {
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
    background-color: #ffffff !important;
}
.btn-outline-primary:hover {
    background-color: #f8fafc !important;
    border-color: #94a3b8 !important;
    color: #0f172a !important;
}

/* 2. Kartu (Cards) Elevated Soft Border */
.card {
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    border-radius: var(--saas-radius-lg) !important;
    box-shadow: var(--saas-shadow-sm) !important;
    background-color: #ffffff !important;
}
.card-header {
    background-color: transparent !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
    padding: 1rem 1.25rem !important;
}
.card-body {
    padding: 1.25rem !important;
}

/* 3. Form Input & Select Modern */
.form-control, .form-select {
    border-radius: var(--saas-radius-md);
    border: 1px solid rgba(0, 0, 0, 0.09) !important;
    background-color: #f8fafc !important;
    font-size: 0.875rem !important;
    color: #0f172a !important;
    padding: 0.55rem 0.85rem !important;
    transition: all 0.15s ease !important;
}
.form-control:focus, .form-select:focus {
    background-color: #ffffff !important;
    border-color: #3b82f6 !important;
    box-shadow: var(--saas-focus-ring) !important;
}

/* Pertahankan Sambungan Presisi di Dalam Input Group & Gaya A Universal Input */
.form-input-icon-group,
.input-group:has(> .input-group-text) {
    position: relative;
    display: flex;
    align-items: stretch;
    background-color: #f8fafc;
    border: 1px solid rgba(0, 0, 0, 0.09) !important;
    border-radius: var(--saas-radius-md, 8px) !important;
    transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--saas-shadow-sm);
    overflow: hidden;
}

.form-input-icon-group:hover,
.input-group:has(> .input-group-text):hover {
    border-color: rgba(0, 0, 0, 0.18) !important;
}

.form-input-icon-group:focus-within,
.input-group:has(> .input-group-text):focus-within {
    background-color: #ffffff !important;
    border-color: #3b82f6 !important;
    box-shadow: var(--saas-focus-ring) !important;
}

/* Icon Prefix: Seamless borderless di dalam container */
.form-input-icon-group > .input-group-text,
.input-group:has(> .input-group-text) > .input-group-text {
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: #64748b;
    font-size: 0.9rem;
    padding-left: 0.85rem !important;
    padding-right: 0.25rem !important;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease;
    border-radius: 0 !important;
}

.form-input-icon-group:focus-within > .input-group-text,
.input-group:has(> .input-group-text):focus-within > .input-group-text {
    color: #0f172a;
}

/* Form Input & Select di dalam Container Terpadu */
.form-input-icon-group > .form-control,
.form-input-icon-group > .form-select,
.input-group:has(> .input-group-text) > .form-control,
.input-group:has(> .input-group-text) > .form-select {
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    font-size: 0.875rem !important;
    color: #0f172a !important;
    padding-left: 0.4rem !important;
    padding-right: 0.85rem !important;
    border-radius: 0 !important;
    height: auto;
}

.form-input-icon-group > .form-control:focus,
.form-input-icon-group > .form-select:focus,
.input-group:has(> .input-group-text) > .form-control:focus,
.input-group:has(> .input-group-text) > .form-select:focus {
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}

/* Trailing Actions / Password Toggle Button */
.form-input-icon-group > .btn,
.form-input-icon-group > .password-toggle-btn,
.input-group:has(> .input-group-text) > .btn {
    background-color: transparent !important;
    border: none !important;
    border-left: 1px solid rgba(0, 0, 0, 0.06) !important;
    box-shadow: none !important;
    color: #64748b !important;
    padding: 0 0.85rem !important;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 !important;
    transition: all 0.15s ease;
}

.form-input-icon-group > .btn:hover,
.form-input-icon-group > .password-toggle-btn:hover,
.input-group:has(> .input-group-text) > .btn:hover {
    background-color: rgba(0, 0, 0, 0.04) !important;
    color: #0f172a !important;
}

/* State: Disabled */
.form-input-icon-group:has(.form-control:disabled),
.input-group:has(> .input-group-text):has(.form-control:disabled) {
    background-color: #f1f5f9 !important;
    border-color: rgba(0, 0, 0, 0.06) !important;
    cursor: not-allowed;
    box-shadow: none !important;
}

.form-input-icon-group:has(.form-control:disabled) > .form-control,
.form-input-icon-group:has(.form-control:disabled) > .input-group-text,
.input-group:has(> .input-group-text):has(.form-control:disabled) > .form-control,
.input-group:has(> .input-group-text):has(.form-control:disabled) > .input-group-text {
    color: #94a3b8 !important;
    cursor: not-allowed;
}

.input-group > :not(:first-child):not(.dropdown-menu) {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
}
.input-group > :not(:last-child):not(.dropdown-toggle):not(.dropdown-menu) {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}
.form-label {
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    color: #475569 !important;
    margin-bottom: 0.35rem !important;
}

/* 4. Badges (Neutralize Solid Colors to Soft Pastel Pills) */
.badge {
    border-radius: var(--saas-radius-full) !important;
    font-weight: 600 !important;
    font-size: 0.75rem !important;
    padding: 4px 10px !important;
    line-height: 1 !important;
}
.badge.bg-success {
    background-color: rgba(25, 135, 84, 0.12) !important;
    color: #0f5132 !important;
    border: 1px solid rgba(25, 135, 84, 0.2) !important;
}
.badge.bg-primary {
    background-color: rgba(13, 110, 253, 0.12) !important;
    color: #084298 !important;
    border: 1px solid rgba(13, 110, 253, 0.2) !important;
}
.badge.bg-warning {
    background-color: rgba(255, 193, 7, 0.15) !important;
    color: #664d03 !important;
    border: 1px solid rgba(255, 193, 7, 0.3) !important;
}
.badge.bg-danger {
    background-color: rgba(220, 53, 69, 0.12) !important;
    color: #842029 !important;
    border: 1px solid rgba(220, 53, 69, 0.25) !important;
}
.badge.bg-secondary {
    background-color: rgba(108, 117, 125, 0.12) !important;
    color: #41464b !important;
    border: 1px solid rgba(108, 117, 125, 0.2) !important;
}

/* 5. Tabel (Modern Table Clean Separator) */
.table {
    border-color: rgba(0, 0, 0, 0.05) !important;
}
.table thead th {
    background-color: #f8fafc !important;
    color: #475569 !important;
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    border-bottom: 1px solid #e2e8f0 !important;
    padding: 10px 16px !important;
}
.table tbody td {
    padding: 12px 16px !important;
    font-size: 0.875rem !important;
    color: #1e293b !important;
    border-bottom: 1px solid #f1f5f9 !important;
    vertical-align: middle !important;
}
.table-hover tbody tr:hover td {
    background-color: #f8fafc !important;
}

/* 6. Modal Backdrop & Dialog Modern Polish */
.modal-content {
    border-radius: var(--saas-radius-lg) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: var(--saas-shadow-floating) !important;
}
.modal-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
    padding: 1.25rem 1.5rem !important;
}
.modal-body {
    padding: 1.5rem !important;
}
.modal-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.05) !important;
    padding: 1rem 1.5rem !important;
}

/* 1. Typography Tabular Nums (NIK, Angka, Tanggal, Nominal) */
.tabular-nums, .font-tabular {
    font-variant-numeric: tabular-nums !important;
    font-feature-settings: "tnum" 1 !important;
    letter-spacing: -0.01em;
}

/* 2. Elevated Floating Card */
.saas-card {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.07);
    border-radius: var(--saas-radius-lg);
    box-shadow: var(--saas-shadow-sm);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.saas-card:hover {
    box-shadow: var(--saas-shadow-md);
    border-color: rgba(0, 0, 0, 0.12);
}

/* 3. Search Input Modern dengan Live Search & Clear (x) */
.saas-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}
.saas-search-wrapper .saas-search-icon {
    position: absolute;
    left: 11px;
    color: #64748b;
    pointer-events: none;
    font-size: 0.85rem;
    z-index: 2;
}
.saas-search-wrapper .saas-search-input {
    width: 100%;
    height: 34px !important;
    padding-left: 32px !important;
    padding-right: 48px !important;
    border-radius: var(--saas-radius-md) !important;
    border: 1px solid rgba(0, 0, 0, 0.09) !important;
    font-size: 0.825rem !important;
    transition: all 0.15s ease;
    background-color: #f8fafc;
    color: #0f172a;
}
.saas-search-wrapper .saas-search-input:focus {
    background-color: #ffffff;
    border-color: #3b82f6 !important;
    box-shadow: var(--saas-focus-ring);
    outline: none;
}
.saas-search-wrapper .saas-search-actions {
    position: absolute;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 3;
}
.saas-search-wrapper .saas-search-clear {
    position: absolute;
    right: 10px;
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 2px 6px;
    font-size: 0.78rem;
    line-height: 1;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
}
.saas-search-wrapper .saas-search-clear:hover {
    color: #0f172a;
    background-color: #e2e8f0;
}
.saas-search-wrapper .saas-search-spinner {
    position: absolute;
    right: 32px;
    width: 0.85rem;
    height: 0.85rem;
    border-width: 0.12em;
    display: none;
    z-index: 3;
}

/* 4. Soft Pastel Capsule / Pill Badges */
.saas-badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--saas-radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.02em;
}
.saas-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}
.saas-badge-success {
    background-color: rgba(25, 135, 84, 0.12);
    color: #0f5132;
    border: 1px solid rgba(25, 135, 84, 0.2);
}
.saas-badge-success .saas-badge-dot { background-color: #198754; }

.saas-badge-warning {
    background-color: rgba(255, 193, 7, 0.15);
    color: #664d03;
    border: 1px solid rgba(255, 193, 7, 0.3);
}
.saas-badge-warning .saas-badge-dot { background-color: #ffc107; }

.saas-badge-danger {
    background-color: rgba(220, 53, 69, 0.12);
    color: #842029;
    border: 1px solid rgba(220, 53, 69, 0.25);
}
.saas-badge-danger .saas-badge-dot { background-color: #dc3545; }

.saas-badge-info {
    background-color: rgba(13, 202, 240, 0.14);
    color: #055160;
    border: 1px solid rgba(13, 202, 240, 0.25);
}
.saas-badge-info .saas-badge-dot { background-color: #0dcaf0; }

.saas-badge-secondary {
    background-color: rgba(108, 117, 125, 0.12);
    color: #41464b;
    border: 1px solid rgba(108, 117, 125, 0.2);
}
.saas-badge-secondary .saas-badge-dot { background-color: #6c757d; }

/* 5. Modern Data Table */
.saas-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.saas-table thead th {
    background-color: #f8fafc;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 10px 16px;
    border-bottom: 1px solid #e2e8f0;
}
.saas-table tbody td {
    padding: 12px 16px;
    font-size: 0.875rem;
    color: #1e293b;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    transition: background-color 0.15s ease;
}
.saas-table tbody tr:hover td {
    background-color: #f8fafc;
}

/* 6. Floating Action Toolbar (Batch Selection) */
.saas-floating-toolbar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #1e293b;
    color: #ffffff;
    padding: 10px 20px;
    border-radius: var(--saas-radius-full);
    box-shadow: var(--saas-shadow-floating);
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 1050;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.saas-floating-toolbar.active {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* 7. Segmented Pill Controls */
.saas-segmented-group {
    display: inline-flex;
    background-color: #f1f5f9;
    padding: 3px;
    border-radius: var(--saas-radius-md);
    gap: 2px;
}
.saas-segmented-btn {
    border: none;
    background: transparent;
    padding: 5px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    border-radius: var(--saas-radius-sm);
    transition: all 0.15s ease;
    cursor: pointer;
}
.saas-segmented-btn:hover {
    color: #0f172a;
}
.saas-segmented-btn.active {
    background-color: #ffffff;
    color: #0f172a;
    box-shadow: var(--saas-shadow-sm);
}

/* 8. Skeleton Shimmer Animation */
.saas-skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: saas-shimmer 1.5s infinite;
    border-radius: var(--saas-radius-sm);
    display: inline-block;
}
@keyframes saas-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* 9. Zero-Data & Empty State */
.saas-empty-state {
    padding: 48px 24px;
    text-align: center;
    border: 1px dashed #cbd5e1;
    border-radius: var(--saas-radius-lg);
    background-color: #f8fafc;
}
.saas-empty-state .saas-empty-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 16px auto;
    border-radius: var(--saas-radius-md);
    background-color: #e2e8f0;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}
.saas-empty-state .saas-empty-title {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
}
.saas-empty-state .saas-empty-desc {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 18px;
    max-width: 380px;
    margin-left: auto;
    margin-right: auto;
}

/* 10. Sticky Save Footer (Dirty State Form) */
.saas-sticky-save-bar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #0f172a;
    color: #ffffff;
    padding: 12px 24px;
    border-radius: var(--saas-radius-lg);
    box-shadow: var(--saas-shadow-floating);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    z-index: 1040;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.saas-sticky-save-bar.active {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* 11. Keyboard Shortcut Badge */
kbd.saas-kbd {
    display: inline-block;
    padding: 2px 5px;
    font-size: 0.75rem;
    font-family: inherit;
    color: #64748b;
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
}

/* 12. Modern Compact SaaS Density (Linear & Vercel Pattern) */
.saas-canvas {
    padding: 1rem 1.25rem !important;
}

.saas-kpi-card {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: var(--saas-radius-md);
    padding: 0.75rem 1rem;
    box-shadow: var(--saas-shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.saas-kpi-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--saas-shadow-md);
}
.saas-kpi-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin-bottom: 2px;
}
.saas-kpi-value {
    font-size: 1.45rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}
.saas-kpi-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
}

/* Custom Precise Gutters & Spacing */
.g-2\.5, .gx-2\.5 { --bs-gutter-x: 0.75rem !important; }
.g-2\.5, .gy-2\.5 { --bs-gutter-y: 0.75rem !important; }
.gap-2\.5 { gap: 0.625rem !important; }
.me-2\.5 { margin-right: 0.625rem !important; }
.ms-2\.5 { margin-left: 0.625rem !important; }
.p-2\.5 { padding: 0.625rem !important; }
