/* ==========================================================================
   Sianta UX Polish — Reusable UI/UX Enhancements
   Covers: Empty States, Skeleton Loaders, Actionable Error Banners,
           Proactive Password Rules, and Accessible Tap Targets (40-44px)
   ========================================================================== */

/* 1. Accessible Form Labels & Helper Text */
.sianta-field-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.4rem;
}

.sianta-field-helper {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.78rem;
    color: #64748b;
}

/* 2. Actionable Error Banner */
.sianta-error-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 10px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #7f1d1d;
    text-align: left;
}

.sianta-error-banner__icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fee2e2;
    color: #dc2626;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.sianta-error-banner__body {
    flex: 1;
    min-width: 0;
}

.sianta-error-banner__title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #991b1b;
    margin: 0 0 3px;
}

.sianta-error-banner__text {
    font-size: 0.84rem;
    color: #7f1d1d;
    margin: 0;
    line-height: 1.45;
}

.sianta-error-banner__actions {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* 3. Guided Empty State */
.sianta-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 28px 20px;
    margin: 4px auto;
    max-width: 440px;
}

.sianta-empty-state--compact {
    padding: 18px 16px;
}

.sianta-empty-state__icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: #f1f5f9;
    color: #475569;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    margin-bottom: 12px;
}

.sianta-empty-state__title {
    font-size: 0.98rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 6px;
}

.sianta-empty-state__desc {
    font-size: 0.85rem;
    color: #64748b;
    margin: 0 0 14px;
    line-height: 1.5;
}

.sianta-empty-state__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

/* 5. Proactive Password Rules & Real-Time Checklist */
.sianta-pw-wrap {
    position: relative;
}

.sianta-pw-rules {
    list-style: none;
    padding: 10px 12px;
    margin: 8px 0 0;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.8rem;
}

.sianta-pw-rules__title {
    font-weight: 700;
    color: #334155;
    margin-bottom: 6px;
    font-size: 0.78rem;
}

.sianta-pw-rule {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 0;
    color: #64748b;
    transition: color 0.15s ease;
}

.sianta-pw-rule__dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1.5px solid #cbd5e1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    flex-shrink: 0;
    background: #fff;
    color: transparent;
    transition: all 0.15s ease;
}

.sianta-pw-rule.is-valid {
    color: #15803d;
    font-weight: 600;
}

.sianta-pw-rule.is-valid .sianta-pw-rule__dot {
    background: #16a34a;
    border-color: #16a34a;
    color: #fff;
}

.sianta-pw-rule.is-invalid {
    color: #b91c1c;
}

.sianta-pw-rule.is-invalid .sianta-pw-rule__dot {
    background: #fee2e2;
    border-color: #ef4444;
    color: #dc2626;
}

.sianta-pw-match-feedback {
    display: none;
    margin-top: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

.sianta-pw-match-feedback.is-match {
    display: block;
    color: #15803d;
}

.sianta-pw-match-feedback.is-mismatch {
    display: block;
    color: #dc2626;
}

/* 6. Accessible Tap Targets (40-44px) & Button Spacing */
.navbar .navbar-toggler,
.navbar .nav-link {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Ensure table/card action buttons have comfortable tap area & breathing room */
td .btn-xs,
td .btn-sm,
.sianta-action-group .btn,
.btn-icon-only {
    min-width: 40px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 2px 3px;
    vertical-align: middle;
}

.sianta-action-group {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

/* Keep icon-only buttons square and centered */
.btn-icon-only {
    padding: 0;
    width: 40px;
    height: 40px;
}

@media (max-width: 767.98px) {
    td .btn-xs,
    td .btn-sm,
    .btn-icon-only {
        min-width: 44px;
        min-height: 44px;
    }
}

/* 7. Skeleton Loader Shimmer */
@keyframes sianta-shimmer {
    0% {
        background-position: -400px 0;
    }
    100% {
        background-position: 400px 0;
    }
}

.sianta-skeleton {
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 800px 100%;
    animation: sianta-shimmer 1.35s infinite linear;
    border-radius: 6px;
    display: block;
}

@media (prefers-reduced-motion: reduce) {
    .sianta-skeleton {
        animation: none;
        background: #e2e8f0;
    }
}

.sianta-skeleton-wrap {
    padding: 8px 4px;
}

.sianta-skeleton-line {
    height: 14px;
    margin-bottom: 10px;
}

.sianta-skeleton-line--title {
    height: 20px;
    width: 48%;
    margin-bottom: 14px;
}

.sianta-skeleton-line--short {
    width: 35%;
}

.sianta-skeleton-line--medium {
    width: 68%;
}

.sianta-skeleton-line--full {
    width: 100%;
}

.sianta-skeleton-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
}

.sianta-skeleton-row:last-child {
    border-bottom: none;
}

.sianta-skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sianta-skeleton-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
}

/* ==========================================================================
   8. Bulletproof Global Modal Guardrails (Aturan Baku Modal Sianta)
   Prevents modal scroll lock, clipped footers, squished .table-responsive,
   and conflicting inline CSS across all 4 Bootstrap 4 modal DOM patterns.
   ========================================================================== */
.modal .modal-content,
.modal .modal-dialog-scrollable .modal-content {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 3.5rem);
    max-height: calc(100dvh - 3.5rem);
    overflow: hidden;
}

.modal .modal-content > form,
.modal .modal-dialog-scrollable .modal-content > form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
}

.modal .modal-header,
.modal .modal-footer {
    flex-shrink: 0;
}

.modal .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* Never apply flex-column or overflow:hidden to forms nested inside .modal-body */
.modal .modal-body form {
    display: block !important;
    overflow: visible !important;
    max-height: none !important;
    flex: none !important;
}

/* Ensure tables inside modals never collapse to 0px */
.modal .modal-body .table-responsive {
    flex-shrink: 0;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* If a view/AJAX injects .modal-footer inside .modal-body, keep it visible */
.modal .modal-body .modal-footer {
    position: sticky;
    bottom: -24px;
    z-index: 15;
    margin-top: 16px;
    background: #f8fafc;
}

@media (max-width: 991.98px) {
    .modal .modal-content,
    .modal .modal-dialog-scrollable .modal-content {
        max-height: calc(100vh - 24px);
        max-height: calc(100dvh - 24px);
    }

    .modal .modal-body .modal-footer {
        bottom: -16px;
    }
}
