/* ==========================================================================
   PAYROLLX BEDENGAN - DESIGN SYSTEM & STYLESHEET
   ========================================================================== */

:root {
    --primary: #047857;
    --primary-hover: #065f46;
    --primary-light: #d1fae5;
    --secondary: #64748b;
    --secondary-hover: #475569;
    --accent: #0d9488;
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-header: #064e3b;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-focus: #047857;
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --radius-sm: 6px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --primary: #10b981;
    --primary-hover: #34d399;
    --primary-light: rgba(16, 185, 129, 0.15);
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --bg-header: #022c22;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border: #334155;
    --border-focus: #10b981;
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.5;
    transition: var(--transition);
    min-height: 100vh;
}

/* ==========================================================================
   APP HEADER
   ========================================================================== */
.app-header {
    background: linear-gradient(135deg, var(--bg-header) 0%, #065f46 100%);
    color: #ffffff;
    padding: 1.25rem 2rem;
    box-shadow: var(--shadow);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand-logo {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #34d399;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.brand-text h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: #ffffff;
}

.brand-text p {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.periode-picker {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.periode-picker label {
    font-size: 0.875rem;
    font-weight: 500;
}

.periode-picker input {
    background: transparent;
    border: none;
    color: #ffffff;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.periode-picker input::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

/* ==========================================================================
   MAIN LAYOUT & STATS
   ========================================================================== */
.main-content {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

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

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #ffffff;
    flex-shrink: 0;
}

.bg-emerald { background: linear-gradient(135deg, #059669, #10b981); }
.bg-teal { background: linear-gradient(135deg, #0d9488, #14b8a6); }
.bg-gold { background: linear-gradient(135deg, #d97706, #f59e0b); }
.bg-blue { background: linear-gradient(135deg, #2563eb, #3b82f6); }

.stat-info {
    flex-grow: 1;
}

.stat-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.stat-info h3 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0.2rem 0;
}

.stat-sub {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.quick-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

/* ==========================================================================
   NAVIGATION TABS
   ========================================================================== */
.nav-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1.5rem;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 0.75rem 1.25rem;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-btn:hover {
    color: var(--primary);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

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

/* ==========================================================================
   CARDS & TABLES
   ========================================================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

.data-table th {
    background-color: rgba(0, 0, 0, 0.03);
    color: var(--text-secondary);
    font-weight: 700;
    padding: 0.85rem 1rem;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

[data-theme="dark"] .data-table th {
    background-color: rgba(255, 255, 255, 0.03);
}

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

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background-color: rgba(4, 120, 87, 0.04);
}

/* Inputs in tables */
.table-input {
    width: 100%;
    min-width: 80px;
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-body);
    color: var(--text-primary);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
}

.table-input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.input-sm {
    max-width: 85px;
    text-align: center;
}

.input-money {
    max-width: 120px;
    text-align: right;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-success { background: #d1fae5; color: #047857; }
.badge-warning { background: #fef3c7; color: #d97706; }
.badge-info { background: #e0f2fe; color: #0284c7; }

[data-theme="dark"] .badge-success { background: rgba(16, 185, 129, 0.2); color: #34d399; }
[data-theme="dark"] .badge-warning { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn-primary { background: var(--primary); color: #ffffff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--secondary); color: #ffffff; }
.btn-secondary:hover { background: var(--secondary-hover); }
.btn-success { background: #059669; color: #ffffff; }
.btn-success:hover { background: #047857; }
.btn-danger { background: #dc2626; color: #ffffff; }
.btn-danger:hover { background: #b91c1c; }
.btn-outline { background: transparent; border: 1px solid rgba(255,255,255,0.3); color: #ffffff; }
.btn-outline:hover { background: rgba(255,255,255,0.1); }

/* Form Controls */
.form-control {
    width: 100%;
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-body);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* ==========================================================================
   LIVE PREVIEW & SLIP PAPER FORMATTING
   ========================================================================== */
.slip-paper-wrapper {
    display: flex;
    justify-content: center;
    background: rgba(0, 0, 0, 0.05);
    padding: 2rem 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
}

[data-theme="dark"] .slip-paper-wrapper {
    background: rgba(0, 0, 0, 0.3);
}

/* Identical paper design matching Bedengan Word document */
.slip-paper {
    width: 210mm; /* Standard A4 width */
    max-width: 100%;
    background: #ffffff;
    color: #000000;
    padding: 8mm 10mm;
    border: 1px solid #ccc;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 8.5pt;
    line-height: 1.25;
    position: relative;
    box-sizing: border-box;
}

.slip-header-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2px;
}

.slip-header-table td {
    border: none !important;
    padding: 2px 6px;
    vertical-align: middle;
}

.header-divider-double {
    border-top: 2.5px solid #000000;
    border-bottom: 1px solid #000000;
    height: 1.5px;
    margin-bottom: 6px;
    margin-top: 2px;
}

.company-title {
    font-size: 13pt;
    font-weight: bold;
    text-align: center;
    color: #000;
}

.doc-title {
    font-size: 12pt;
    font-weight: bold;
    text-align: center;
    letter-spacing: 1px;
}

.disclaimer-box {
    border: 1px solid #000;
    padding: 4px 8px;
    font-size: 7.5pt;
    line-height: 1.2;
    margin-bottom: 6px;
    background: #fff8f8;
}

.disclaimer-title {
    font-weight: bold;
    color: #990000;
}

.slip-info-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 6px;
}

.slip-info-table td {
    border: 1px solid #000;
    padding: 3px 6px;
    font-size: 8.5pt;
}

.slip-info-table td.label-col {
    width: 30%;
    font-weight: bold;
    background-color: #f2f2f2;
}

.slip-main-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 6px;
}

.slip-main-table th, .slip-main-table td {
    border: 1px solid #000;
    padding: 3px 6px;
    font-size: 8.5pt;
}

.slip-main-table th {
    background-color: #e6e6e6;
    font-weight: bold;
    text-transform: uppercase;
}

.slip-main-table td.amount {
    text-align: right;
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
}

.highlight-row td {
    background-color: #e2f0d9;
    font-weight: bold;
    font-size: 9pt;
}

.catatan-box {
    border: 1px solid #000;
    padding: 4px 8px;
    font-size: 7.5pt;
    line-height: 1.2;
    margin-bottom: 8px;
    background-color: #fafafa;
}

.signature-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 6px;
}

.signature-table td {
    width: 50%;
    text-align: center;
    vertical-align: top;
    font-size: 8.5pt;
}

.sig-space {
    height: 35px;
}

.sig-name {
    font-weight: bold;
    text-decoration: underline;
}

/* ==========================================================================
   MODAL DIALOG
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalSlide 0.3s ease-out;
}

@keyframes modalSlide {
    from { transform: translateY(20px); }
    to { transform: translateY(0); }
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-body {
    padding: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-help {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* ==========================================================================
   PRINT STYLES (@media print)
   ========================================================================== */
@media print {
    @page {
        size: A4 portrait;
        margin: 5mm;
    }

    body {
        background: #ffffff !important;
        color: #000000 !important;
    }

    .no-print, .app-header, .main-content, .modal-overlay {
        display: none !important;
    }

    .print-only {
        display: block !important;
    }

    .slip-paper {
        width: 100% !important;
        box-shadow: none !important;
        border: 1px solid #000 !important;
        padding: 6mm 8mm !important;
        margin-bottom: 0 !important;
        page-break-after: always;
        page-break-inside: avoid;
    }
}

.print-only {
    display: none;
}

/* ==========================================================================
   CHARTS & SEARCH BAR & STATUS BADGES STYLES
   ========================================================================== */
.charts-flex {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 900px) {
    .charts-flex {
        grid-template-columns: 1fr;
    }
}

.chart-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}

.chart-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    text-align: center;
}

.canvas-container {
    position: relative;
    height: 240px;
    width: 100%;
}

.search-box {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    pointer-events: none;
}

.search-input {
    padding: 0.45rem 0.8rem 0.45rem 2.2rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-body);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    width: 240px;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    width: 280px;
    box-shadow: 0 0 0 3px var(--primary-light);
}

.select-status-bayar {
    padding: 0.25rem 0.5rem;
    font-size: 0.775rem;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid var(--border);
    cursor: pointer;
    background: var(--bg-card);
}

.select-status-bayar.status-draft {
    background: #fef3c7;
    color: #92400e;
    border-color: #fcd34d;
}

.select-status-bayar.status-transfer {
    background: #d1fae5;
    color: #065f46;
    border-color: #6ee7b7;
}

.select-status-bayar.status-cash {
    background: #e0f2fe;
    color: #075985;
    border-color: #7dd3fc;
}

.form-help {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

