/* ==========================================================================
   Modern Web Guidance & Luxury UI/UX Master Design Tokens
   ========================================================================== */

/* 1. Global Typography & Scrollbars (CSS scrollbar-color) */
:root {
    --bg-gradient-start: #F8FAFC;
    --bg-gradient-end: #EFF6FF;
    --accent-blue: #2563EB;
    --accent-blue-hover: #1D4ED8;
    --card-bg: rgba(255, 255, 255, 0.92);
    --card-border: rgba(226, 232, 240, 0.8);
    --shadow-subtle: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-elevation: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    font-size: 13.5px;
    color: #1E293B;
    scrollbar-color: #94A3B8 #F1F5F9;
    scrollbar-width: thin;
    -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbars for Webkit */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #F1F5F9;
    border-radius: 6px;
}
::-webkit-scrollbar-thumb {
    background: #94A3B8;
    border-radius: 6px;
    border: 2px solid #F1F5F9;
}
::-webkit-scrollbar-thumb:hover {
    background: #64748B;
}

/* 2. Responsive Table Wrappers & Luxury Table Styling */
.table-scroll-x {
    overflow-x: auto;
    scrollbar-color: #CBD5E1 #F8FAFC;
    scrollbar-width: thin;
    border-radius: 0.75rem;
    box-shadow: inset 0 0 0 1px rgba(226, 232, 240, 0.6);
}

.report-section {
    display: none;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.report-section.active,
.report-section[style*="display: block"],
.report-section[style*="display:block"] {
    display: block !important;
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* Table Cells & Headers */
.th-style {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 700;
    color: #1E3A8A;
    background-color: #F8FAFC;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 2px solid #E2E8F0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.thead-dark th {
    background-color: #1E293B !important;
    color: #FFFFFF !important;
    padding: 0.75rem 0.75rem;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #0F172A;
}
.thead-dark th.text-emerald-300 {
    color: #6EE7B7 !important;
}
.thead-dark th.text-red-300 {
    color: #FCA5A5 !important;
}
.thead-dark th.text-blue-200 {
    color: #BFDBFE !important;
}

.td-style {
    padding: 0.75rem 1rem;
    white-space: nowrap;
    font-size: 0.825rem;
    color: #334155;
    border-bottom: 1px solid #F1F5F9;
    transition: background-color 150ms ease, color 150ms ease;
}

.striped-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.striped-table tbody tr:nth-child(odd) {
    background-color: #FFFFFF;
}
.striped-table tbody tr:nth-child(even) {
    background-color: #F8FAFC;
}
.striped-table tbody tr:hover td {
    background-color: #EFF6FF !important;
    color: #1D4ED8;
}

/* 3. Sidebar Navigation & Tabs */
aside {
    font-size: 0.95rem;
    background: linear-gradient(180deg, #0F172A 0%, #1E293B 50%, #0F172A 100%) !important;
}
@media (min-width: 768px) {
    aside {
        height: 100vh !important;
        position: sticky !important;
        top: 0 !important;
        overflow-y: auto !important;
    }
}

.nav-link, button.nav-link {
    font-size: 0.925rem;
    padding: 0.65rem 1rem;
    border-radius: 0.6rem;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.nav-link.tab-active,
button.nav-link.tab-active {
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.9) 0%, rgba(29, 78, 216, 0.9) 100%);
    color: #FFFFFF;
    font-weight: 600;
    box-shadow: 0 4px 12px -2px rgba(37, 99, 235, 0.4);
    transform: translateX(3px);
    border-left: 4px solid #60A5FA;
}

.nav-link.tab-inactive,
button.nav-link.tab-inactive {
    color: #94A3B8;
}

.nav-link.tab-inactive:hover,
button.nav-link.tab-inactive:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: #F8FAFC;
    transform: translateX(2px);
}

/* 4. Native Dialog & Modal Transitions (@starting-style) */
.modal {
    display: none;
    position: fixed;
    z-index: 50;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show, .modal[style*="display: block"], .modal[style*="display: flex"] {
    opacity: 1;
}

.modal-content {
    background-color: #FFFFFF;
    margin: 4% auto;
    padding: 1.5rem 1.75rem;
    border: 1px solid rgba(226, 232, 240, 0.8);
    width: 88%;
    max-width: 1100px;
    border-radius: 1.25rem;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
    font-size: 0.95rem;
    transform: scale(0.96);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.modal[style*="display: block"] .modal-content,
.modal[style*="display: flex"] .modal-content {
    transform: scale(1);
    opacity: 1;
}

/* Modern @starting-style support for modern browsers */
@starting-style {
    .modal[style*="display: block"] .modal-content,
    .modal[style*="display: flex"] .modal-content {
        transform: scale(0.96);
        opacity: 0;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #E2E8F0;
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
}

.close-button {
    color: #64748B;
    font-size: 24px;
    font-weight: 600;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}
.close-button:hover {
    background-color: #F1F5F9;
    color: #0F172A;
    transform: rotate(90deg);
}

/* 5. Modern Forms & Input Ergonomics (:user-valid, :user-invalid) */
.input-field, .input-field-sm, 
select:not([class*="bg-slate-800"]):not([class*="bg-slate-900"]):not([class*="bg-gray-800"]), 
input[type="text"]:not([class*="bg-slate-800"]):not([class*="bg-slate-900"]):not([class*="bg-gray-800"]), 
input[type="date"]:not([class*="bg-slate-800"]):not([class*="bg-slate-900"]):not([class*="bg-gray-800"]), 
input[type="password"]:not([class*="bg-slate-800"]):not([class*="bg-slate-900"]):not([class*="bg-gray-800"]) {
    margin-top: 0.25rem;
    display: block;
    width: 100%;
    padding: 0.5rem 0.85rem;
    border: 1px solid #CBD5E1;
    border-radius: 0.6rem;
    background-color: #FFFFFF !important;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
    font-size: 0.9rem;
    color: #1E293B !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    color-scheme: light;
}

/* Paksa date input & select selalu rendering mode terang (light) di semua browser Windows/macOS */
input[type="date"]:not([class*="bg-slate-800"]):not([class*="bg-slate-900"]):not([class*="bg-gray-800"]),
input[type="datetime-local"]:not([class*="bg-slate-800"]):not([class*="bg-slate-900"]):not([class*="bg-gray-800"]) {
    color-scheme: light;
    background-color: #FFFFFF !important;
    color: #1E293B !important;
}

/* Paksa ikon kalender tidak menutupi / mempengaruhi background input date */
input[type="date"]::-webkit-calendar-picker-indicator {
    background-color: transparent;
    cursor: pointer;
    opacity: 0.6;
    filter: invert(0);
    padding: 2px;
    border-radius: 3px;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover {
    background-color: #EFF6FF;
    opacity: 1;
}

/* Normalisasi select agar tidak terlihat seperti OS default (abu-abu) di Windows */
select:not([class*="bg-slate-800"]):not([class*="bg-slate-900"]):not([class*="bg-gray-800"]) {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236B7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1.2em 1.2em;
    padding-right: 2.25rem;
    color-scheme: light;
}

.input-field-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.825rem;
}

/* Ensure inputs using Tailwind padding utility classes or containing icons preserve their left/right padding and height */
input.pl-8, input[type="text"].pl-8, input[type="password"].pl-8, .input-field.pl-8 { padding-left: 2rem !important; }
input.pl-9, input[type="text"].pl-9, input[type="password"].pl-9, .input-field.pl-9 { padding-left: 2.25rem !important; }
input.pl-10, input[type="text"].pl-10, input[type="password"].pl-10, .input-field.pl-10 { padding-left: 2.5rem !important; }
input.pl-11, input[type="text"].pl-11, input[type="password"].pl-11, .input-field.pl-11 { padding-left: 2.75rem !important; }
input.pl-12, input[type="text"].pl-12, input[type="password"].pl-12, .input-field.pl-12 { padding-left: 3rem !important; }

input.pr-8, input[type="text"].pr-8, input[type="password"].pr-8, .input-field.pr-8 { padding-right: 2rem !important; }
input.pr-9, input[type="text"].pr-9, input[type="password"].pr-9, .input-field.pr-9 { padding-right: 2.25rem !important; }
input.pr-10, input[type="text"].pr-10, input[type="password"].pr-10, .input-field.pr-10 { padding-right: 2.5rem !important; }
input.pr-11, input[type="text"].pr-11, input[type="password"].pr-11, .input-field.pr-11 { padding-right: 2.75rem !important; }
input.pr-12, input[type="text"].pr-12, input[type="password"].pr-12, .input-field.pr-12 { padding-right: 3rem !important; }

input.py-3, input[type="text"].py-3, input[type="password"].py-3, .input-field.py-3 { padding-top: 0.75rem !important; padding-bottom: 0.75rem !important; }
input.py-2, input[type="text"].py-2, input[type="password"].py-2, .input-field.py-2 { padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }

/* Universal safety for inputs inside relative containers with absolute left/right icons */
.relative span.absolute.left-0 + input,
.relative div.absolute.left-0 + input,
.relative i.absolute.left-0 + input {
    padding-left: 2.5rem !important;
}
.relative input:has(+ button.absolute.right-0),
.relative input:has(+ span.absolute.right-0) {
    padding-right: 2.75rem !important;
}

.input-field:focus-visible, .input-field-sm:focus-visible, select:focus-visible, input:focus-visible {
    outline: none;
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

/* Normalisasi Warna Font Input, Select, Option & Date Picker (Mencegah font tidak tampil/pudar) */
input:not([class*="bg-slate-800"]):not([class*="bg-slate-900"]):not([class*="bg-gray-850"]):not([class*="bg-gray-800"]):not([class*="text-white"]),
select:not([class*="bg-slate-800"]):not([class*="bg-slate-900"]):not([class*="bg-gray-850"]):not([class*="bg-gray-800"]):not([class*="text-white"]),
textarea:not([class*="bg-slate-800"]):not([class*="bg-slate-900"]):not([class*="bg-gray-850"]):not([class*="bg-gray-800"]):not([class*="text-white"]),
option:not([class*="bg-slate-800"]):not([class*="bg-slate-900"]):not([class*="bg-gray-900"]):not([class*="bg-gray-850"]):not([class*="bg-gray-800"]):not([class*="text-white"]) {
    color: #0F172A !important;
}
input::placeholder, textarea::placeholder {
    color: #94A3B8 !important;
    opacity: 1 !important;
}
input[type="date"]::-webkit-datetime-edit,
input[type="date"]::-webkit-datetime-edit-fields-wrapper,
input[type="date"]::-webkit-datetime-edit-text,
input[type="date"]::-webkit-datetime-edit-month-field,
input[type="date"]::-webkit-datetime-edit-day-field,
input[type="date"]::-webkit-datetime-edit-year-field,
input[type="datetime-local"]::-webkit-datetime-edit,
input[type="datetime-local"]::-webkit-datetime-edit-fields-wrapper,
input[type="datetime-local"]::-webkit-datetime-edit-text,
input[type="datetime-local"]::-webkit-datetime-edit-month-field,
input[type="datetime-local"]::-webkit-datetime-edit-day-field,
input[type="datetime-local"]::-webkit-datetime-edit-year-field {
    color: #0F172A !important;
    background-color: transparent !important;
    font-weight: 600 !important;
}

/* Precise validation styling via modern :user-valid / :user-invalid */
input:user-valid:not(:placeholder-shown) {
    border-color: #10B981;
}
input:user-invalid:not(:placeholder-shown) {
    border-color: #EF4444;
    background-color: #FEF2F2;
}

header {
    font-size: 1.05rem;
}
h1, h3 {
    font-size: 1.15rem;
    letter-spacing: -0.01em;
}
.btn, button {
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
button:active {
    transform: scale(0.98);
}

/* 6. Notifications System */
.notification-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 300ms cubic-bezier(0.16, 1, 0.3, 1);
}

.notification-box {
    background-color: #FFFFFF;
    padding: 2rem;
    border-radius: 1.25rem;
    text-align: center;
    max-width: 400px;
    width: 90%;
    margin: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: scale(0.92) translateY(10px);
    opacity: 0;
    transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1), opacity 300ms ease;
}

.notification-box .icon-wrapper {
    margin-bottom: 1.25rem;
}
.notification-box .icon-wrapper i {
    font-size: 64px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}
.notification-box .icon-wrapper .icon-success {
    color: #10B981;
}
.notification-box .icon-wrapper .icon-error {
    color: #EF4444;
}

.notification-box .title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #0F172A;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.notification-box .message {
    font-size: 0.95rem;
    color: #4B5563;
    line-height: 1.5;
}

.notification-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}
.notification-overlay.visible .notification-box {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* 7. Payment History & Specialized Sub-Tables */
.payment-history-section {
    margin-top: 1.25rem;
    border-top: 1px solid #E2E8F0;
    padding-top: 1rem;
}

.payment-history-table {
    width: 100%;
    font-size: 0.8rem;
    color: #334155;
}

.payment-history-table th {
    padding: 0.5rem 0.75rem;
    background-color: #F8FAFC;
    color: #64748B;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    text-align: left;
    border-bottom: 1px solid #E2E8F0;
}

.payment-history-table th.text-right,
.payment-history-table td.text-right {
    text-align: right;
}

.payment-history-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid #F1F5F9;
}

.payment-summary {
    margin-top: 0.75rem;
    text-align: right;
    font-size: 0.9rem;
    font-weight: 600;
    color: #0F172A;
}

/* 8. Reusable Status Badges & Animations */
@keyframes subtle-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    }
    50% {
        transform: scale(1.03);
        box-shadow: 0 4px 12px -1px rgba(34, 197, 94, 0.25), 0 2px 4px -2px rgba(34, 197, 94, 0.15);
    }
}

.clickable-pulse {
    animation: subtle-pulse 2.5s infinite ease-in-out;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.725rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1;
}

.badge-success {
    background-color: #D1FAE5;
    color: #065F46;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-warning {
    background-color: #FEF3C7;
    color: #92400E;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-danger {
    background-color: #FEE2E2;
    color: #991B1B;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-info {
    background-color: #DBEAFE;
    color: #1E40AF;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* 9. Explicit Button & Color Utilities for Stok Movement & Dynamic Dashboards */
.bg-indigo-600 {
    background-color: #4F46E5 !important;
}
.hover\:bg-indigo-700:hover {
    background-color: #4338CA !important;
}
.bg-indigo-700 {
    background-color: #4338CA !important;
}
.bg-indigo-800 {
    background-color: #3730A3 !important;
}
.bg-indigo-900 {
    background-color: #312E81 !important;
}
.border-indigo-600 {
    border-color: #4F46E5 !important;
}
.text-indigo-600 {
    color: #4F46E5 !important;
}
.text-indigo-700 {
    color: #4338CA !important;
}
.text-indigo-800 {
    color: #3730A3 !important;
}
.text-indigo-900 {
    color: #312E81 !important;
}

/* Ensure buttons and badges inside Stok Movement have crisp white text where required */
button.bg-indigo-600,
button.bg-blue-600,
button.bg-emerald-600,
button.bg-red-600,
span.bg-indigo-800,
span.bg-blue-800,
span.bg-emerald-800,
span.bg-red-800 {
    color: #FFFFFF !important;
}
button.bg-indigo-600 i,
button.bg-blue-600 i,
button.bg-emerald-600 i,
button.bg-red-600 i,
button.bg-indigo-600 span,
button.bg-blue-600 span,
button.bg-emerald-600 span,
button.bg-red-600 span {
    color: #FFFFFF !important;
}


