/* ========================================
   REKENING MODERN - style-rekening.css
   Light High-Contrast Theme
   Sunlight-Optimized, Field-Ready
   ======================================== */
:root {
    /* Light Background */
    --bg-primary: #c8ddf0;
    --bg-secondary: #b8d0e8;
    --bg-card: #ffffff;
    --bg-card-solid: #ffffff;

    /* High-Contrast Text */
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;

    /* Vibrant Accents */
    --accent-blue: #0369a1;
    --accent-cyan: #0891b2;
    --accent-yellow: #b45309;
    --accent-green: #047857;
    --accent-red: #b91c1c;
    --accent-purple: #6d28d9;

    /* Gradients */
    --gradient-header: linear-gradient(135deg, #1e40af 0%, #0891b2 100%);
    --gradient-btn: linear-gradient(135deg, #0369a1 0%, #0891b2 100%);

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Shadows - Updated for Global Deep Elevation */
    --shadow-card: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.2);
    --shadow-glow: 0 0 0 3px rgba(3, 105, 161, 0.15);

    --transition: 200ms ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--bg-primary);
    min-height: 100dvh;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

.page-wrapper {
    max-width: 520px;
    margin: 0 auto;
    padding: 20px 14px 40px;
    animation: fadeInUp 0.4s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: .5;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* === HEADER === */
.pdam-header {
    background: var(--gradient-header);
    border-radius: var(--radius-lg);
    padding: 22px 18px;
    text-align: center;
    margin-bottom: 16px;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

.pdam-header::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -20%;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.12) 0%, transparent 70%);
    border-radius: 50%;
}

.pdam-header h1 {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #ffffff;
    margin-bottom: 4px;
    position: relative;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.pdam-header .alamat {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.9);
    position: relative;
    line-height: 1.4;
}

/* === SEARCH FORM === */
.search-form {
    margin-bottom: 16px;
}

.search-bar {
    display: flex;
    align-items: stretch;
    background: #ffffff;
    border: 2px solid #cbd5e1;
    border-radius: var(--radius-full);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    transition: border-color var(--transition), box-shadow var(--transition);
    min-height: 52px;
}

.search-bar:focus-within {
    border-color: var(--accent-blue);
    box-shadow: var(--shadow-glow);
}

.search-bar input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 0 18px;
    font-size: 1rem;
    color: var(--text-primary);
    font-family: inherit;
    outline: none;
    min-width: 0;
    line-height: 52px;
}

.search-bar input::placeholder {
    color: #94a3b8;
}

.search-bar button {
    flex-shrink: 0;
    background: var(--gradient-btn);
    border: none;
    padding: 0 24px;
    color: #ffffff;
    font-weight: 800;
    font-size: 0.9rem;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.04em;
    transition: filter var(--transition);
    white-space: nowrap;
    min-width: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-bar button:hover {
    filter: brightness(1.1);
}

.search-bar button:active {
    filter: brightness(0.95);
}

/* === PROFILE CARD === */
.profile-card {
    background: var(--bg-card);
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg);
    padding: 20px 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-card);
    animation: slideIn 0.4s ease-out 0.1s both;
    text-align: center;
}

.profile-card .nama {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 2px;
    color: var(--text-primary);
    line-height: 1.3;
}

.profile-card .nama .id-badge {
    color: #b45309;
}

.profile-card .alamat-plg {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 14px;
    text-align: center;
    line-height: 1.4;
}

.profile-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
}

.stat-box {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 12px 8px;
    text-align: center;
    min-width: 0;
}

.stat-box .label {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 600;
}

.stat-box .value {
    font-size: 1.1rem;
    font-weight: 800;
}

.stat-box .value.total {
    color: #b45309;
}

.stat-box .value.bulan {
    color: #0369a1;
}

/* === TABLE === */
.table-container {
    background: var(--bg-card);
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 16px;
    box-shadow: var(--shadow-card);
    animation: slideIn 0.4s ease-out 0.2s both;
}

.table-container table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
}

.table-container thead th {
    background: linear-gradient(135deg, #1e40af 0%, #0369a1 100%);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.78rem;
    padding: 13px 10px;
    border-bottom: 2px solid #1e40af;
    text-align: center;
}

.table-container tbody tr {
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: background var(--transition);
}

.table-container tbody tr:nth-child(even) {
    background: #f8fafc;
}

.table-container tbody tr:hover {
    background: #dbeafe;
}

.table-container tbody tr:active {
    background: #bfdbfe;
}

.table-container tbody td {
    padding: 4px 10px;
    text-align: center;
    color: var(--text-primary);
    vertical-align: middle;
    font-size: 0.92rem;
    font-weight: 500;
}

.table-container tbody td:last-child {
    color: #1e40af;
    font-weight: 800;
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
}

.table-container tfoot td {
    padding: 13px 10px;
    background: #eff6ff;
    border-top: 2px solid #bfdbfe;
    font-weight: 800;
    color: #1e40af;
    text-align: center;
    font-size: 0.9rem;
}

.tap-hint {
    text-align: center;
    font-size: 0.82rem;
    color: #1e40af;
    font-weight: 600;
    padding: 10px;
    border-top: 1px solid #bfdbfe;
    background: #eff6ff;
    animation: pulse 2.5s ease-in-out infinite;
}

/* === PAYMENT === */
.payment-section {
    background: var(--bg-card);
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg);
    padding: 18px 14px;
    margin-bottom: 16px;
    text-align: center;
    box-shadow: var(--shadow-card);
    animation: slideIn 0.4s ease-out 0.3s both;
}

.payment-section .section-title {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    font-weight: 600;
}

.payment-links {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 14px;
    width: 100%;
}

.pay-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 4px;
    border-radius: var(--radius-md);
    font-size: 0.7rem;
    font-weight: 700;
    text-decoration: none;
    color: white;
    text-align: center;
    letter-spacing: 0.03em;
    transition: transform var(--transition), box-shadow var(--transition);
    font-family: inherit;
    line-height: 1.2;
}

.pay-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.pay-btn.pamnas {
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
}

.pay-btn.dana {
    background: linear-gradient(135deg, #0891b2, #06b6d4);
}

.pay-btn.action {
    background: linear-gradient(135deg, #7c3aed, #8b5cf6);
}

.btn-cetak {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #0369a1, #0891b2);
    color: white;
    border: none;
    padding: 13px 32px;
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
    font-family: inherit;
    box-shadow: 0 4px 12px rgba(3, 105, 161, 0.35);
}

.btn-cetak:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(3, 105, 161, 0.4);
}

.btn-cetak:active {
    transform: scale(0.97);
}

.btn-cetak svg {
    width: 16px;
    height: 16px;
}

/* === CHART === */
.chart-card {
    background: var(--bg-card);
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg);
    padding: 18px 14px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-card);
    animation: slideIn 0.4s ease-out 0.4s both;
}

.chart-card .chart-title {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    font-weight: 600;
    text-align: center;
}

/* === MODAL === */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.modal-box {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 440px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.55);
    animation: modalSlideUp 0.3s ease-out;
    font-family: 'Arial Narrow', Arial, Helvetica, sans-serif;
    letter-spacing: -0.3px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px 10px;
    border-bottom: 1px solid #f1f5f9;
}

.modal-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent-blue);
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
}

.modal-close:hover {
    background: #fee2e2;
    color: #b91c1c;
}

.modal-body {
    padding: 12px 18px 18px;
    font-size: 1rem;
}

.detail-section {
    margin-bottom: 8px;
}

.detail-section-title {
    font-size: 1.05rem;
    text-transform: uppercase;
    color: var(--accent-blue);
    margin-bottom: 4px;
    margin-top: 6px;
    font-weight: 800;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    font-size: 1rem;
    border-bottom: 1px solid #f1f5f9;
    gap: 16px;
}

.detail-row .lbl {
    color: var(--text-muted);
    flex-shrink: 0;
}

.detail-row .val {
    color: var(--text-primary);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-align: right;
    word-break: break-word;
}

.detail-total {
    display: flex;
    justify-content: space-between;
    padding: 13px 0 0;
    font-size: 1.1rem;
    font-weight: 800;
    margin-top: 8px;
    border-top: 2px solid #bfdbfe;
}

/* === PHOTO METER === */
.btn-photo {
    width: 100%;
    margin-top: 14px;
    padding: 12px;
    background: linear-gradient(135deg, #0369a1, #0891b2);
    color: white;
    font-size: 1rem;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(3, 105, 161, 0.2);
    transition: transform var(--transition), box-shadow var(--transition);
}

.btn-photo:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(3, 105, 161, 0.3);
}

.btn-photo:active {
    transform: scale(0.98);
}

.photo-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.photo-modal-overlay.active {
    display: flex;
    animation: fadeIn 0.2s;
}

.photo-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    touch-action: none;
}

.photo-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.1s ease-out;
    transform-origin: center center;
}

.photo-controls {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    background: rgba(15, 23, 42, 0.6);
    padding: 8px;
    border-radius: var(--radius-full);
    backdrop-filter: blur(8px);
}

.photo-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
}

.photo-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.close-photo {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 2010;
}


.detail-total .lbl {
    color: var(--text-secondary);
}

.detail-total .val {
    color: #b45309;
}

/* === FOOTER NOTES === */
.note-card {
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    margin-bottom: 10px;
    font-size: 0.8rem;
    line-height: 1.65;
    box-shadow: var(--shadow-card);
    animation: slideIn 0.4s ease-out 0.5s both;
}

.note-card.footnote {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: var(--text-muted);
}

.note-card.notes {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: var(--text-secondary);
}

/* === DESKTOP PHONE FRAME === */
@media (min-width: 768px) {
    html {
        background: #1e293b;
        min-height: 100vh;
    }

    body {
        display: flex;
        justify-content: center;
        padding: 30px 0;
    }

    .page-wrapper {
        max-width: 420px;
        min-height: 700px;
        max-height: 92vh;
        overflow-y: auto;
        background: var(--bg-primary);
        border-radius: var(--radius-xl);
        box-shadow:
            0 0 0 4px #334155,
            0 0 0 7px #475569,
            0 25px 60px rgba(0, 0, 0, 0.5);
        scrollbar-width: thin;
        scrollbar-color: #cbd5e1 transparent;
    }

    .page-wrapper::-webkit-scrollbar {
        width: 4px;
    }

    .page-wrapper::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 4px;
    }

    .modal-overlay,
    .photo-modal-overlay {
        left: 50%;
        transform: translateX(-50%);
        width: 100%;
        max-width: 420px;
        top: 30px;
        bottom: auto;
        height: min(92vh, 100vh - 60px);
        min-height: 700px;
        border-radius: var(--radius-xl);
    }
}

/* === RESPONSIVE SMALL === */
@media (max-width: 380px) {
    .pdam-header {
        padding: 16px 14px;
    }

    .pdam-header h1 {
        font-size: 1.05rem;
    }

    .payment-links {
        gap: 6px;
    }

    .table-container table {
        font-size: 0.78rem;
    }

    .search-bar input {
        font-size: 0.9rem;
    }

    .search-bar button {
        padding: 0 16px;
        font-size: 0.82rem;
        min-width: 60px;
    }
}

/* === REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}