/* ==========================================================================
   INDOMILK SPG REPORTING PWA - GOJEK ANDROID STYLE DESIGN SYSTEM
   ========================================================================== */

:root {
  --gojek-green: #0284C7;
  --gojek-green-dark: #0055A5;
  --gojek-green-light: #E0F2FE;
  --gojek-green-subtle: #F0F9FF;
  --indomilk-blue: #0284C7;
  --indomilk-blue-dark: #0055A5;
  --indomilk-blue-light: #E0F2FE;
  --text-dark: #1C1C1C;
  --text-muted: #687176;
  --bg-light: #F4F6F8;
  --card-bg: #FFFFFF;
  --border-color: #E2E8F0;
  --accent-red: #EE2737;
  --accent-blue: #0284C7;
  --accent-yellow: #FFB703;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: #E2E8F0;
  color: var(--text-dark);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 0;
  overflow-x: hidden;
}

/* Mobile Container Enclosure */
.app-container {
  width: 100%;
  max-width: 480px;
  background-color: var(--bg-light);
  min-height: 100vh;
  position: relative;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  padding-bottom: 84px; /* Space for bottom navbar */
}

/* Header Bar - Gojek Style */
.app-header {
  background: linear-gradient(135deg, var(--gojek-green) 0%, var(--gojek-green-dark) 100%);
  color: white;
  padding: 20px 20px 24px 20px;
  border-bottom-left-radius: 24px;
  border-bottom-right-radius: 24px;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background-color: white;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: var(--gojek-green-dark);
  font-size: 20px;
  box-shadow: var(--shadow-sm);
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: white;
}

.brand-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.user-pill {
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: white;
  font-size: 12px;
  font-weight: 600;
}

.role-badge {
  background-color: #FFD166;
  color: #1C1C1C;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

/* Views Management */
.view-section {
  display: none;
  padding: 16px;
  animation: fadeIn 0.25s ease-in-out;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Cards & Layout */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0, 0, 0, 0.03);
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Banner Card Gojek Style */
.banner-card {
  background: linear-gradient(135deg, #0284C7 0%, #0055A5 100%);
  color: white;
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  margin-bottom: 16px;
}

.banner-card::after {
  content: '';
  position: absolute;
  right: -20px;
  bottom: -20px;
  width: 120px;
  height: 120px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  pointer-events: none;
}

.banner-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 600;
  margin-bottom: 4px;
}

.banner-amount {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 12px;
}

.banner-meta {
  display: flex;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12px;
}

/* Gojek Quick Action Grid */
.grid-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.action-btn-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  border: none;
  background: none;
}

.action-icon-wrapper {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background-color: var(--gojek-green-light);
  color: var(--gojek-green-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease;
}

.action-btn-item:active .action-icon-wrapper {
  transform: scale(0.92);
}

.action-icon-wrapper.blue {
  background-color: #E0F2FE;
  color: #0284C7;
}

.action-icon-wrapper.orange {
  background-color: #FEF3C7;
  color: #D97706;
}

.action-icon-wrapper.purple {
  background-color: #F3E8FF;
  color: #9333EA;
}

.action-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dark);
  text-align: center;
}

/* Status Timeline Box */
.attendance-status-card {
  display: flex;
  gap: 12px;
  background-color: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid var(--border-color);
  margin-bottom: 16px;
}

.status-box {
  flex: 1;
  background-color: var(--bg-light);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
  border: 1px solid transparent;
}

.status-box.done {
  background-color: var(--gojek-green-subtle);
  border-color: var(--gojek-green-light);
}

.status-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.status-time {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-dark);
}

.status-box.done .status-time {
  color: var(--gojek-green-dark);
}

/* Bottom Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: #FFFFFF;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
  display: flex;
  justify-content: space-around;
  padding: 10px 0 12px 0;
  z-index: 100;
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  width: 25%;
  transition: color 0.15s ease;
}

.nav-item.active {
  color: var(--gojek-green-dark);
  font-weight: 700;
}

.nav-item svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* Form Styling */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background-color: #FAFAFA;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--gojek-green);
  background-color: #FFFFFF;
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background-color: var(--gojek-green);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.2s ease, transform 0.1s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:active {
  background-color: var(--gojek-green-dark);
  transform: scale(0.98);
}

.btn-secondary {
  width: 100%;
  padding: 12px;
  background-color: #E2E8F0;
  color: var(--text-dark);
  border: none;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.btn-danger {
  background-color: var(--accent-red);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.btn-outline-green {
  background-color: white;
  border: 1.5px solid var(--gojek-green);
  color: var(--gojek-green-dark);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

/* Product Input Row */
.product-card {
  background: #FAFAFA;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.product-info {
  flex: 1;
}

.product-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dark);
}

.product-price {
  font-size: 12px;
  color: var(--gojek-green-dark);
  font-weight: 600;
}

.qty-counter {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-qty {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background-color: white;
  color: var(--text-dark);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qty-input {
  width: 44px;
  text-align: center;
  font-weight: 800;
  font-size: 15px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 4px;
}

/* Camera Stream & Canvas Box */
.camera-box {
  width: 100%;
  aspect-ratio: 4 / 3;
  background-color: #000000;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#cameraStream, #photoPreview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-overlay {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
}

/* History Card */
.history-item {
  background: white;
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #E2E8F0;
}

.history-user {
  font-size: 14px;
  font-weight: 700;
}

.history-date {
  font-size: 11px;
  color: var(--text-muted);
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.history-subcard {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.history-subcard.masuk {
  border-left: 4px solid #10B981;
}

.history-subcard.pulang {
  border-left: 4px solid #EF4444;
}

.history-subcard.empty {
  border-left: 4px solid #CBD5E1;
  background: #FAFAFA;
  justify-content: center;
  align-items: center;
  min-height: 90px;
  color: #94A3B8;
  font-size: 11px;
  font-style: italic;
  text-align: center;
}

.history-subcard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.history-badge-masuk {
  background: #E6F4EA;
  color: #137333;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
}

.history-badge-pulang {
  background: #FCE8E6;
  color: #C5221F;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
}

.history-body {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.history-thumb {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border-color);
  cursor: pointer;
  flex-shrink: 0;
}

.history-details {
  flex: 1;
  font-size: 11px;
}

.history-loc {
  color: var(--text-muted);
  margin-bottom: 4px;
  line-height: 1.3;
}

.history-omset {
  font-size: 13px;
  font-weight: 800;
  color: var(--gojek-green-dark);
}

.history-actions,
.history-subcard-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed #E2E8F0;
}

/* Modal System */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: white;
  width: 100%;
  max-width: 440px;
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-title {
  font-size: 16px;
  font-weight: 800;
}

.btn-close-modal {
  background: none;
  border: none;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  color: var(--text-muted);
}
