/* ============================================================
   HUJANPAY — MAIN STYLESHEET
   Pondok Pesantren Hujan Assalam
   ============================================================ */

:root {
    --primary:        #1B6B3A;
    --primary-light:  #2D9E5A;
    --primary-dark:   #0F4022;
    --accent:         #C8962E;
    --accent-light:   #F0C060;
    --success:        #2D9E5A;
    --warning:        #D97706;
    --danger:         #DC2626;
    --info:           #2563EB;
    --bg:             #F0F4F0;
    --surface:        #FFFFFF;
    --text-primary:   #1A2E1A;
    --text-secondary: #6B7280;
    --border:         #D1E0D1;
    --radius-sm:      8px;
    --radius-md:      12px;
    --radius-lg:      16px;
    --radius-xl:      24px;
    --shadow-sm:      0 1px 3px rgba(27,107,58,0.08);
    --shadow-md:      0 4px 12px rgba(27,107,58,0.12);
    --shadow-lg:      0 8px 24px rgba(27,107,58,0.15);
}

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

body { background: var(--bg); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: var(--text-primary); }

/* ============================================================ APP WRAPPER */
.hj-app { max-width: 480px; margin: 0 auto; min-height: 100vh; background: var(--bg); position: relative; }

/* ============================================================ HEADER */
.hj-header { padding: 24px 20px 32px; color: #fff; position: relative; overflow: hidden; }
.hj-header-green { background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%); }
.hj-header-dark  { background: linear-gradient(135deg, #1A2E1A 0%, #2D4A2D 100%); }
.hj-header::before { content: ''; position: absolute; top: -40px; right: -40px; width: 160px; height: 160px; background: rgba(255,255,255,0.05); border-radius: 50%; }
.hj-header-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.hj-greeting    { font-size: 13px; opacity: 0.8; margin-bottom: 4px; }
.hj-user-name   { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.hj-header-sub  { font-size: 12px; opacity: 0.7; }
.hj-badge       { background: rgba(255,255,255,0.2); padding: 3px 10px; border-radius: 20px; font-size: 12px; }

/* ============================================================ BALANCE CARD */
.hj-balance-card   { background: rgba(255,255,255,0.15); border-radius: var(--radius-lg); padding: 16px 20px; backdrop-filter: blur(10px); }
.hj-balance-label  { font-size: 13px; opacity: 0.8; margin-bottom: 6px; }
.hj-balance-row    { display: flex; align-items: center; gap: 12px; }
.hj-balance        { font-size: 28px; font-weight: 800; }
.hj-toggle-balance { background: rgba(255,255,255,0.2); border: none; color: #fff; border-radius: 50%; width: 32px; height: 32px; cursor: pointer; font-size: 16px; }

/* ============================================================ AVATAR */
.hj-avatar      { width: 48px; height: 48px; border-radius: 50%; background: rgba(255,255,255,0.25); display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700; color: #fff; }
.hj-avatar-sm   { width: 40px; height: 40px; font-size: 16px; }
.hj-avatar-lg   { width: 56px; height: 56px; font-size: 22px; }
.hj-avatar-wali { background: var(--accent); }

/* ============================================================ SECTION */
.hj-section        { padding: 16px; }
.hj-section-title  { font-size: 15px; font-weight: 700; margin-bottom: 12px; color: var(--text-primary); }
.hj-section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.hj-mx             { margin: 0 16px; }

/* ============================================================ CARD */
.hj-card { background: var(--surface); border-radius: var(--radius-lg); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow-sm); }

/* ============================================================ MENU GRID */
.hj-menu-grid  { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.hj-menu-item  { background: var(--surface); border: none; border-radius: var(--radius-md); padding: 14px 6px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; cursor: pointer; position: relative; box-shadow: var(--shadow-sm); transition: transform 0.1s; }
.hj-menu-item:active { transform: scale(0.96); }
.hj-menu-icon  { font-size: 22px; }
.hj-badge-count { position: absolute; top: 6px; right: 6px; background: var(--danger); color: #fff; border-radius: 50%; width: 18px; height: 18px; font-size: 10px; display: flex; align-items: center; justify-content: center; font-weight: 700; }

/* ============================================================ BUTTONS */
.hj-btn          { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 12px 20px; border-radius: var(--radius-md); font-size: 14px; font-weight: 600; cursor: pointer; border: none; transition: all 0.15s; text-decoration: none; }
.hj-btn-full     { width: 100%; display: flex; margin-bottom: 8px; }
.hj-btn-large    { padding: 16px 20px; font-size: 16px; }
.hj-btn-sm       { padding: 6px 14px; font-size: 12px; }
.hj-btn-primary  { background: var(--primary); color: #fff; }
.hj-btn-primary:hover { background: var(--primary-dark); }
.hj-btn-outline  { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.hj-btn-danger   { background: var(--danger); color: #fff; margin-top: 4px; }
.hj-btn-green    { background: var(--success); color: #fff; }
.hj-btn-blue     { background: var(--info); color: #fff; }
.hj-btn-orange   { background: var(--warning); color: #fff; }
.hj-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.hj-btn-remove   { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 16px; padding: 4px; }

/* ============================================================ FORM */
.hj-form-group    { margin-bottom: 16px; }
.hj-form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text-secondary); }
.hj-input         { width: 100%; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-md); font-size: 14px; background: var(--surface); color: var(--text-primary); outline: none; transition: border-color 0.2s; }
.hj-input:focus   { border-color: var(--primary); }
.hj-input-sm      { width: 60px; }
.hj-input-wrap    { position: relative; }
.hj-toggle-pass   { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 16px; }
.hj-pin-input     { letter-spacing: 8px; font-size: 20px; font-weight: 700; text-align: center; }
.hj-text-center   { text-align: center; }

/* ============================================================ ALERT */
.hj-alert         { padding: 12px 16px; border-radius: var(--radius-md); margin-bottom: 12px; font-size: 13px; font-weight: 500; }
.hj-alert-success { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
.hj-alert-error   { background: #FEE2E2; color: #991B1B; border: 1px solid #FCA5A5; }
.hj-alert-warning { background: #FEF3C7; color: #92400E; border: 1px solid #FCD34D; }

/* ============================================================ TRANSAKSI */
.hj-trx-item  { display: flex; align-items: center; gap: 12px; }
.hj-trx-icon  { font-size: 24px; }
.hj-trx-info  { flex: 1; }
.hj-trx-desc  { font-size: 13px; font-weight: 600; }
.hj-trx-date  { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.hj-trx-amount { font-weight: 700; font-size: 14px; white-space: nowrap; }
.hj-plus      { color: var(--success); }
.hj-minus     { color: var(--danger); }

/* ============================================================ TAGIHAN */
.hj-tagihan-item   { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hj-tagihan-info h4 { font-size: 13px; font-weight: 600; }
.hj-tagihan-info p  { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.hj-tagihan-action  { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.hj-text-danger    { color: var(--danger); font-size: 12px; }

/* ============================================================ PROFIL */
.hj-profil-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.hj-profil-row:last-child { border-bottom: none; }

/* ============================================================ QR */
.hj-qr-container { display: flex; justify-content: center; padding: 16px; }
.hj-qr-name      { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.hj-qr-nis       { font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; }
.hj-qr-note      { font-size: 12px; color: var(--text-secondary); margin: 12px 0; }

/* ============================================================ MODAL */
.hj-modal         { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: flex-end; z-index: 1000; }
.hj-modal-content { background: var(--surface); border-radius: var(--radius-xl) var(--radius-xl) 0 0; padding: 24px 20px 32px; width: 100%; max-width: 480px; margin: 0 auto; }
.hj-modal-content h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.hj-modal-detail  { color: var(--text-secondary); font-size: 14px; margin-bottom: 16px; }
.hj-modal-total   { font-size: 20px; font-weight: 800; color: var(--primary); margin-bottom: 16px; }
.hj-modal-actions { display: flex; gap: 12px; margin-top: 16px; }
.hj-modal-actions .hj-btn { flex: 1; }

/* ============================================================ KASIR */
.hj-kasir-tabs     { display: flex; gap: 8px; margin-top: 16px; }
.hj-kasir-tab      { flex: 1; padding: 8px 12px; border-radius: var(--radius-md); border: none; background: rgba(255,255,255,0.15); color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; }
.hj-kasir-tab.active { background: rgba(255,255,255,0.35); }

.hj-omzet-today    { text-align: right; }
.hj-omzet-today p  { font-size: 12px; opacity: 0.8; }
.hj-omzet-today h3 { font-size: 18px; font-weight: 800; }

.hj-scan-area  { text-align: center; padding: 16px 0; }
.hj-qr-reader  { width: 100%; max-width: 300px; margin: 0 auto 12px; border-radius: var(--radius-md); overflow: hidden; }
.hj-scan-note  { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; }
.hj-separator  { text-align: center; color: var(--text-secondary); font-size: 13px; padding: 12px 0; position: relative; }
.hj-separator::before, .hj-separator::after { content: ''; position: absolute; top: 50%; width: 35%; height: 1px; background: var(--border); }
.hj-separator::before { left: 0; }
.hj-separator::after  { right: 0; }
.hj-manual-row { display: flex; gap: 8px; align-items: center; }

.hj-santri-found-card    { display: flex; justify-content: space-between; align-items: center; }
.hj-santri-found-info    { display: flex; align-items: center; gap: 12px; }
.hj-santri-found-balance { text-align: right; }
.hj-santri-found-balance p { font-size: 12px; color: var(--text-secondary); }
.hj-santri-found-balance h2 { font-size: 18px; font-weight: 800; color: var(--primary); }

.hj-cart-item       { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.hj-cart-item-info  { display: flex; flex-direction: column; gap: 4px; }
.hj-cart-item-info strong { font-size: 13px; }
.hj-cart-item-info span   { font-size: 12px; color: var(--text-secondary); }
.hj-cart-item-right { display: flex; align-items: center; gap: 8px; }
.hj-cart-total      { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; font-size: 16px; border-top: 2px solid var(--primary); margin-top: 4px; }
.hj-cart-total strong { font-size: 20px; color: var(--primary); font-weight: 800; }

.hj-manual-item { background: var(--bg); }

.hj-product-grid  { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.hj-product-card  { background: var(--surface); border-radius: var(--radius-md); padding: 10px; text-align: center; cursor: pointer; box-shadow: var(--shadow-sm); transition: transform 0.1s; }
.hj-product-card:active { transform: scale(0.95); }
.hj-product-img-placeholder { font-size: 28px; margin-bottom: 6px; }
.hj-product-name  { font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.hj-product-price { font-size: 11px; color: var(--primary); font-weight: 700; }
.hj-cat-title     { font-size: 13px; font-weight: 700; color: var(--text-secondary); margin: 12px 0 8px; }

/* Struk */
.hj-success-icon   { font-size: 56px; margin-bottom: 12px; }
.hj-struk          { background: var(--bg); border-radius: var(--radius-md); padding: 16px; margin: 16px 0; text-align: left; }
.hj-struk-item     { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; }
.hj-struk-total    { display: flex; justify-content: space-between; font-size: 14px; padding: 6px 0; }
.hj-struk-total strong { font-size: 16px; color: var(--primary); }

/* QRIS */
.hj-qris-display   { padding: 16px; display: flex; justify-content: center; }
.hj-qris-img       { max-width: 220px; border-radius: var(--radius-md); }
.hj-qris-amount    { font-size: 20px; font-weight: 800; color: var(--primary); margin-bottom: 8px; }
.hj-qris-note      { font-size: 12px; color: var(--text-secondary); margin: 8px 0; }
.hj-countdown-wrap { background: var(--bg); border-radius: var(--radius-md); padding: 10px; margin-bottom: 12px; }

/* ============================================================ SANTRI PANEL (WALI) */
.hj-santri-tabs   { display: flex; gap: 8px; padding: 12px 16px 0; overflow-x: auto; }
.hj-santri-tab    { padding: 8px 16px; border-radius: 20px; border: 2px solid var(--border); background: var(--surface); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.hj-santri-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.hj-santri-card        { display: flex; flex-direction: column; gap: 12px; }
.hj-santri-info        { display: flex; align-items: center; gap: 12px; }
.hj-santri-info h3     { font-size: 16px; font-weight: 700; }
.hj-santri-info p      { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.hj-santri-balance     { background: var(--bg); border-radius: var(--radius-md); padding: 12px; text-align: center; }
.hj-santri-balance p   { font-size: 12px; color: var(--text-secondary); }
.hj-santri-balance h2  { font-size: 22px; font-weight: 800; color: var(--primary); }

/* ============================================================ LOGIN */
.hj-login-wrap   { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px; background: linear-gradient(160deg, var(--primary-dark) 0%, var(--primary) 100%); }
.hj-login-header { text-align: center; margin-bottom: 32px; }
.hj-logo         { display: flex; justify-content: center; margin-bottom: 16px; }
.hj-logo-icon    { font-size: 56px; }
.hj-logo img     { width: 80px; height: 80px; border-radius: 20px; object-fit: cover; }
.hj-app-name     { font-size: 28px; font-weight: 800; color: #fff; }
.hj-app-sub      { font-size: 14px; color: rgba(255,255,255,0.75); margin-top: 4px; }
.hj-login-card   { background: #fff; }
.hj-bismi        { text-align: center; font-size: 20px; color: var(--primary); margin-bottom: 20px; font-family: 'Traditional Arabic', serif; }
.hj-login-help   { text-align: center; font-size: 12px; color: var(--text-secondary); margin-top: 16px; line-height: 1.6; }
.hj-login-help a { color: var(--primary); }
.hj-footer-text  { text-align: center; font-size: 11px; color: rgba(255,255,255,0.5); margin-top: 16px; }

/* ============================================================ MISC */
.hj-empty       { text-align: center; padding: 32px 16px; color: var(--text-secondary); }
.hj-empty span  { font-size: 36px; display: block; margin-bottom: 12px; }
.hj-loading     { text-align: center; padding: 24px; color: var(--text-secondary); }
.hj-error       { color: var(--danger); text-align: center; padding: 24px; }
.hj-footer-bar  { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; background: var(--surface); margin-top: 24px; }
.hj-footer-logout { background: none; border: none; color: var(--danger); font-size: 13px; font-weight: 600; cursor: pointer; }
.hj-footer-brand  { font-size: 11px; color: var(--text-secondary); }

/* ============================================================ ADMIN STYLES */
.hj-admin          { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
.hj-stats-grid     { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 20px 0; }
.hj-stat-card      { background: #fff; border-radius: 12px; padding: 20px; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.hj-stat-icon      { font-size: 28px; display: block; margin-bottom: 8px; }
.hj-stat-value     { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.hj-stat-label     { font-size: 12px; color: #6B7280; }
.hj-stat-card.hj-green  { border-top: 4px solid #2D9E5A; }
.hj-stat-card.hj-blue   { border-top: 4px solid #2563EB; }
.hj-stat-card.hj-orange { border-top: 4px solid #D97706; }
.hj-stat-card.hj-red    { border-top: 4px solid #DC2626; }
.hj-stat-card.hj-purple { border-top: 4px solid #7C3AED; }
.hj-quick-actions  { margin: 20px 0; display: flex; flex-wrap: wrap; gap: 8px; }
.hj-btn-sm         { display: inline-block; padding: 4px 10px; background: var(--primary); color: #fff; border-radius: 6px; font-size: 12px; text-decoration: none; margin-top: 8px; }

/* ============================================================ RESPONSIVE */
@media (max-width: 480px) {
    .hj-app { max-width: 100%; }
    .hj-stats-grid { grid-template-columns: repeat(2, 1fr); }
}
