:root {
  --primary: #009688;
  --primary-dark: #00796B;
  --primary-light: #E0F2F1;
  --primary-bg: #F0F7F6;
  --secondary: #212121;
  --surface: #FFFFFF;
  --on-surface: #333333;
  --on-surface-variant: #666666;
  --outline: #E0E0E0;
  --danger: #E53935;
  --success: #2E7D32;
  --warning: #F57C00;
  --radius-lg: 24px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 20px rgba(0, 150, 136, 0.15);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }

body { background: #F5F7F7; color: var(--on-surface); min-height: 100vh; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 24px; border-radius: 50px; font-size: 14px; font-weight: 600; border: none; cursor: pointer; transition: all 0.2s; }
.btn-primary { background: var(--primary); color: white; box-shadow: 0 4px 12px rgba(0,150,136,0.3); }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-primary:disabled { background: #CCC; box-shadow: none; cursor: not-allowed; }
.btn-outline { background: transparent; border: 1px solid var(--outline); color: var(--on-surface-variant); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-block { width: 100%; }

/* Cards */
.card { background: var(--surface); border-radius: var(--radius-md); padding: 20px; box-shadow: var(--shadow); border: 1px solid var(--outline); margin-bottom: 20px; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }
.card-header h3 { font-size: 16px; font-weight: 700; color: var(--secondary); }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--on-surface-variant); text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--outline); border-radius: var(--radius-sm);
  font-size: 15px; background: var(--surface); transition: border-color 0.15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,150,136,0.1);
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.form-hint { font-size: 11px; color: #999; margin-top: 4px; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; }
.alert-success { background: #E8F5E9; color: var(--success); border: 1px solid #C8E6C9; }
.alert-error { background: #FFEBEE; color: var(--danger); border: 1px solid #FFCDD2; }
.alert-info { background: var(--primary-light); color: var(--primary-dark); border: 1px solid #B2DFDB; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
table th { text-align: left; padding: 10px 8px; font-weight: 600; color: var(--on-surface-variant); border-bottom: 2px solid var(--outline); font-size: 12px; text-transform: uppercase; }
table td { padding: 12px 8px; border-bottom: 1px solid #F0F0F0; vertical-align: middle; }
table tr:last-child td { border-bottom: none; }

/* Status badges */
.badge { font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 20px; display: inline-block; text-transform: capitalize; }
.badge-active, .badge-online, .badge-paid, .badge-success { background: #E8F5E9; color: var(--success); }
.badge-inactive, .badge-failed, .badge-danger { background: #FFEBEE; color: var(--danger); }
.badge-offline, .badge-pending { background: #FFF8E1; color: var(--warning); }

/* Layout - Admin */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: var(--surface); border-right: 1px solid var(--outline); padding: 24px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; flex-shrink: 0; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 32px; padding-bottom: 20px; border-bottom: 1px solid var(--outline); }
.sidebar-brand .brand-text { font-size: 18px; font-weight: 800; color: var(--primary); line-height: 1.2; }
.sidebar-brand .brand-text small { font-weight: 400; color: var(--on-surface-variant); font-size: 11px; display: block; }
.nav-menu { display: flex; flex-direction: column; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); color: var(--on-surface-variant); font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.15s; border: none; background: transparent; width: 100%; text-align: left; text-decoration: none; }
.nav-item:hover { background: var(--primary-bg); color: var(--primary); text-decoration: none; }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.main-content { flex: 1; padding: 24px 32px 40px; max-width: calc(100% - 240px); overflow-x: hidden; }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 28px; flex-wrap: wrap; gap: 12px; }
.page-header h1 { font-size: 24px; font-weight: 800; color: var(--secondary); }
.page-header h1 span { color: var(--primary); }
.page-header p { color: var(--on-surface-variant); font-size: 14px; margin-top: 4px; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card { background: var(--surface); border-radius: var(--radius-md); padding: 20px; box-shadow: var(--shadow); border: 1px solid var(--outline); }
.stat-card .stat-label { font-size: 12px; font-weight: 600; color: var(--on-surface-variant); text-transform: uppercase; }
.stat-card .stat-value { font-size: 28px; font-weight: 800; color: var(--secondary); margin-top: 6px; }

/* Customer payment page */
.payment-page { max-width: 420px; margin: 0 auto; padding: 20px 16px; }
.brand-header { text-align: center; margin-bottom: 24px; }
.brand-header img { height: 40px; }
.app-container { background: var(--surface); border-radius: var(--radius-lg); padding: 32px 24px; box-shadow: var(--shadow); }
.title-section { text-align: center; margin-bottom: 24px; }
.title-section h1 { color: var(--primary); font-size: 24px; font-weight: 800; margin-bottom: 8px; }
.title-section p { color: var(--on-surface-variant); font-size: 14px; }
.merchant-card { background: #F9F9F9; border-radius: var(--radius-md); padding: 16px; margin-bottom: 24px; border: 1px solid var(--outline); position: relative; }
.merchant-label { font-size: 11px; color: var(--primary); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; display: block; }
.merchant-content { display: flex; align-items: center; gap: 12px; }
.driver-image { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: var(--primary); }
.merchant-info h2 { font-size: 16px; font-weight: 700; color: var(--secondary); }
.merchant-info p { font-size: 12px; color: var(--on-surface-variant); margin-top: 2px; }
.secure-tag { position: absolute; top: 16px; right: 16px; font-size: 10px; font-weight: 700; color: var(--success); background: #E8F5E9; padding: 4px 8px; border-radius: 4px; }
.price-display { background: var(--secondary); border-radius: var(--radius-md); padding: 16px 20px; margin-bottom: 24px; display: flex; justify-content: space-between; align-items: center; }
.price-display .label { color: #999; font-size: 13px; font-weight: 600; text-transform: uppercase; }
.price-display .amount { color: white; font-size: 24px; font-weight: 800; }
.price-display .amount span { font-size: 14px; font-weight: 400; color: #aaa; }
.method-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 24px; }
.method-item { background: #F9F9F9; border: 2px solid var(--outline); border-radius: var(--radius-md); padding: 16px 8px; text-align: center; cursor: pointer; transition: all 0.2s; }
.method-item.active { border-color: var(--primary); background: var(--primary-light); }
.method-item .name { font-size: 11px; font-weight: 600; color: var(--on-surface-variant); }
.method-item.active .name { color: var(--primary); }
.pay-btn { width: 100%; background: var(--primary); color: white; border: none; padding: 18px; border-radius: 50px; font-size: 16px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer; box-shadow: 0 4px 12px rgba(0,150,136,0.3); }
.pay-btn:disabled { background: #CCC; cursor: not-allowed; }
.footer { text-align: center; margin-top: 24px; font-size: 11px; color: var(--on-surface-variant); }
.footer span { font-weight: 700; color: var(--primary); }

/* Receipt / QR display */
.receipt-card { background: white; max-width: 400px; width: 100%; border-radius: var(--radius-lg); padding: 32px 24px; box-shadow: 0 20px 60px rgba(0,0,0,0.2); text-align: center; }
.receipt-title { color: var(--primary); font-size: 18px; font-weight: 800; margin-bottom: 4px; }
.receipt-sub { color: #999; font-size: 12px; margin-bottom: 16px; }
.qr-header-text { font-size: 20px; font-weight: 800; color: #000; margin: 12px 0 4px; line-height: 1.3; }
.qr-sub-text { font-size: 16px; font-weight: 700; color: var(--secondary); margin-bottom: 12px; }
.qr-wrapper { display: flex; justify-content: center; margin: 16px 0; }
#qrCodeContainer, .qr-container { background: white; padding: 12px; border-radius: 12px; border: 2px solid var(--outline); display: inline-block; }
.receipt-status { margin-top: 12px; font-size: 12px; padding: 8px; border-radius: 8px; font-weight: 600; }
.receipt-status.valid { color: var(--success); background: #E8F5E9; }
.receipt-status.expired { color: var(--danger); background: #FFEBEE; }

/* Checker result */
.checker-result { text-align: center; padding: 24px; }
.checker-result.valid .route-text { color: var(--success); }
.checker-result.expired .route-text { color: var(--danger); }
.checker-result .route-text { font-size: 28px; font-weight: 900; margin-bottom: 12px; }
.checker-result .detail-text { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.checker-result.valid .detail-text { color: var(--success); }
.checker-result.expired .detail-text { color: var(--danger); }
.checker-result .time-text { font-size: 14px; margin-top: 16px; }
.checker-result.valid .time-text { color: var(--success); }
.checker-result.expired .time-text { color: var(--danger); }

/* Login */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: white; border-radius: var(--radius-lg); padding: 40px 32px; box-shadow: var(--shadow); max-width: 400px; width: 100%; }
.login-card h1 { text-align: center; color: var(--primary); font-size: 24px; margin-bottom: 8px; }
.login-card p { text-align: center; color: var(--on-surface-variant); margin-bottom: 24px; font-size: 14px; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { max-width: 100%; padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .method-grid { grid-template-columns: 1fr 1fr; }
}

/* Utility */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.text-muted { color: var(--on-surface-variant); }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
