/* ADITION ELECTRIC WORKS - Main Styles */
:root {
  --primary: #1a1a2e;
  --primary-light: #16213e;
  --accent: #e94560;
  --accent2: #f5a623;
  --success: #27ae60;
  --danger: #e74c3c;
  --warning: #f39c12;
  --info: #3498db;
  --text: #ecf0f1;
  --text-muted: #95a5a6;
  --card-bg: #16213e;
  --card-border: #0f3460;
  --surface: #0f3460;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--primary);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--primary); }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 2px; }

/* ===== NAVIGATION ===== */
.nav-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: var(--primary-light);
  border-bottom: 2px solid var(--accent);
  padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 2px 20px rgba(233,69,96,0.3);
}

.nav-logo {
  font-size: 14px; font-weight: 800; letter-spacing: 1px;
  color: var(--accent);
  display: flex; align-items: center; gap: 8px;
}

.nav-actions { display: flex; gap: 8px; align-items: center; }

.nav-btn {
  background: none; border: 1px solid var(--card-border);
  color: var(--text); padding: 6px 12px; border-radius: 8px;
  cursor: pointer; font-size: 12px; transition: all 0.2s;
  display: flex; align-items: center; gap: 5px;
}

.nav-btn:hover, .nav-btn.active { background: var(--accent); border-color: var(--accent); }

/* ===== MAIN CONTENT ===== */
.main-content {
  padding-top: 70px;
  padding-bottom: 80px;
  min-height: 100vh;
}

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: var(--primary-light);
  border-top: 2px solid var(--card-border);
  display: flex;
  box-shadow: 0 -2px 20px rgba(0,0,0,0.3);
}

.bottom-nav-item {
  flex: 1; padding: 10px 4px;
  display: flex; flex-direction: column; align-items: center;
  cursor: pointer; transition: all 0.2s;
  border: none; background: none; color: var(--text-muted);
  font-size: 10px; gap: 3px;
}

.bottom-nav-item i { font-size: 18px; }
.bottom-nav-item.active { color: var(--accent); }
.bottom-nav-item:hover { color: var(--text); background: rgba(255,255,255,0.05); }

/* ===== CARDS ===== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

.stat-card {
  background: linear-gradient(135deg, var(--card-bg), var(--surface));
  border-radius: 12px; padding: 16px; text-align: center;
  border: 1px solid var(--card-border);
  transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-card .stat-value { font-size: 24px; font-weight: 800; color: var(--accent); }
.stat-card .stat-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.stat-card .stat-icon { font-size: 28px; margin-bottom: 8px; }

/* ===== EMPLOYEE GRID ===== */
.employee-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px;
  padding: 16px;
}

.employee-card {
  display: flex; flex-direction: column; align-items: center;
  cursor: pointer; padding: 12px 8px;
  background: var(--card-bg);
  border: 2px solid var(--card-border);
  border-radius: 16px;
  transition: all 0.2s;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.employee-card:active { transform: scale(0.95); }
.employee-card:hover { border-color: var(--accent); box-shadow: 0 0 20px rgba(233,69,96,0.3); }
.employee-card.status-in { border-color: var(--success); box-shadow: 0 0 15px rgba(39,174,96,0.3); }
.employee-card.status-out { border-color: var(--info); }
.employee-card.status-absent { opacity: 0.6; }

.emp-photo {
  width: 70px; height: 70px; border-radius: 50%;
  object-fit: cover; border: 3px solid var(--card-border);
  margin-bottom: 8px;
}

.emp-photo-placeholder {
  width: 70px; height: 70px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--surface));
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 800; color: white;
  border: 3px solid var(--card-border);
  margin-bottom: 8px;
}

.emp-name { font-size: 12px; font-weight: 600; text-align: center; color: var(--text); line-height: 1.2; }
.emp-status { font-size: 10px; margin-top: 4px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.emp-status.in { background: rgba(39,174,96,0.2); color: var(--success); }
.emp-status.out { background: rgba(52,152,219,0.2); color: var(--info); }
.emp-status.absent { background: rgba(231,76,60,0.2); color: var(--danger); }
.emp-hours { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

.status-dot {
  width: 10px; height: 10px; border-radius: 50%;
  position: absolute; top: 8px; right: 8px;
}
.status-dot.in { background: var(--success); animation: pulse 2s infinite; }
.status-dot.out { background: var(--info); }
.status-dot.absent { background: var(--danger); }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 10px 20px; border-radius: 10px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  border: none; transition: all 0.2s; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.96); }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: #c73652; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #219150; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #c0392b; }
.btn-warning { background: var(--warning); color: white; }
.btn-info { background: var(--info); color: white; }
.btn-outline { background: transparent; border: 1px solid var(--card-border); color: var(--text); }
.btn-outline:hover { background: var(--surface); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn-lg { padding: 16px 32px; font-size: 18px; font-weight: 700; border-radius: 16px; }
.btn-full { width: 100%; }

/* Clock IN/OUT BIG BUTTONS */
.clock-btn-in {
  background: linear-gradient(135deg, #27ae60, #2ecc71);
  color: white; border: none; border-radius: 20px;
  width: 100%; padding: 28px; font-size: 28px; font-weight: 800;
  cursor: pointer; transition: all 0.2s;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  box-shadow: 0 8px 30px rgba(39,174,96,0.4);
  -webkit-tap-highlight-color: transparent;
}
.clock-btn-out {
  background: linear-gradient(135deg, #e94560, #c0392b);
  color: white; border: none; border-radius: 20px;
  width: 100%; padding: 28px; font-size: 28px; font-weight: 800;
  cursor: pointer; transition: all 0.2s;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  box-shadow: 0 8px 30px rgba(233,69,96,0.4);
  -webkit-tap-highlight-color: transparent;
}
.clock-btn-in:active, .clock-btn-out:active { transform: scale(0.95); }

/* ===== TOAST NOTIFICATIONS ===== */
#toast-container {
  position: fixed; top: 80px; right: 16px;
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
  max-width: 340px;
}

.toast {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-left: 4px solid var(--accent);
  border-radius: 12px; padding: 14px 18px;
  animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
  font-size: 14px;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--info); }
.toast-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }

@keyframes slideIn { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-10px); } }

/* ===== MODALS ===== */
#modal-container {
  position: fixed; inset: 0; z-index: 9998;
  display: none; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.7);
  padding: 16px;
}
#modal-container.open { display: flex; }

.modal {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px; padding: 24px;
  width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto;
  animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 20px; padding: 4px; }
.modal-close:hover { color: var(--accent); }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; font-weight: 500; }
.form-input {
  width: 100%; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--card-border);
  border-radius: 8px; color: var(--text); font-size: 14px;
  transition: border-color 0.2s;
}
.form-input:focus { outline: none; border-color: var(--accent); }
.form-input::placeholder { color: var(--text-muted); }

/* ===== TABLES ===== */
.table-container { overflow-x: auto; border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead { background: var(--surface); }
th { padding: 12px 10px; text-align: left; color: var(--text-muted); font-weight: 600; font-size: 11px; text-transform: uppercase; white-space: nowrap; }
td { padding: 10px 10px; border-bottom: 1px solid rgba(255,255,255,0.04); white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.03); }
.td-edited { background: rgba(245,166,35,0.08) !important; }

/* ===== BADGES ===== */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-success { background: rgba(39,174,96,0.2); color: var(--success); }
.badge-danger { background: rgba(231,76,60,0.2); color: var(--danger); }
.badge-warning { background: rgba(243,156,18,0.2); color: var(--warning); }
.badge-info { background: rgba(52,152,219,0.2); color: var(--info); }
.badge-gray { background: rgba(149,165,166,0.2); color: var(--text-muted); }

/* ===== TABS ===== */
.tab-bar { display: flex; gap: 4px; background: var(--surface); border-radius: 12px; padding: 4px; margin-bottom: 16px; overflow-x: auto; }
.tab-item { flex-shrink: 0; padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-muted); transition: all 0.2s; border: none; background: none; }
.tab-item.active { background: var(--accent); color: white; }
.tab-item:hover:not(.active) { color: var(--text); }

/* ===== TOGGLE SWITCH ===== */
.toggle-switch { position: relative; display: inline-block; width: 48px; height: 26px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--card-border); border-radius: 26px;
  transition: 0.3s;
}
.toggle-slider:before {
  position: absolute; content: '';
  height: 20px; width: 20px; left: 3px; bottom: 3px;
  background: white; border-radius: 50%; transition: 0.3s;
}
input:checked + .toggle-slider { background: var(--accent); }
input:checked + .toggle-slider:before { transform: translateX(22px); }

/* ===== PAGE HEADER ===== */
.page-header { padding: 16px 16px 0; }
.page-title { font-size: 20px; font-weight: 800; color: var(--text); }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ===== SECTION ===== */
.section { padding: 16px; }
.section-title { font-size: 14px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }

/* ===== MASKED FINANCE (Customer View) ===== */
.masked { filter: blur(5px); user-select: none; }
.masked::after { content: '****'; }

/* ===== AVATAR ===== */
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.avatar-sm { width: 32px; height: 32px; border-radius: 50%; }

/* ===== CLOCK DISPLAY ===== */
.live-clock { font-size: 42px; font-weight: 800; text-align: center; color: var(--accent); font-variant-numeric: tabular-nums; line-height: 1; }
.live-date { font-size: 14px; color: var(--text-muted); text-align: center; margin-top: 4px; }

/* ===== CHART CONTAINER ===== */
.chart-container { position: relative; height: 220px; margin: 12px 0; }

/* ===== TROPHY / BADGE CARD ===== */
.trophy-card {
  background: linear-gradient(135deg, #f5a623, #f39c12);
  border-radius: 16px; padding: 20px;
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 12px;
}
.trophy-icon { font-size: 48px; }
.trophy-name { font-size: 18px; font-weight: 800; }
.trophy-desc { font-size: 13px; opacity: 0.8; }

/* ===== PAYROLL TABLE ===== */
.payroll-day-row:hover { background: rgba(255,255,255,0.04); }
.payroll-day-absent td { opacity: 0.4; }
.payroll-day-edited td { background: rgba(245,166,35,0.06); }

/* ===== PWA INSTALL BANNER ===== */
.install-banner {
  position: fixed; bottom: 80px; left: 16px; right: 16px; z-index: 200;
  background: linear-gradient(135deg, var(--accent), #c73652);
  border-radius: 16px; padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 8px 30px rgba(233,69,96,0.5);
  animation: slideUp 0.4s ease;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.install-banner-text { font-size: 13px; font-weight: 600; }
.install-banner-btn { background: white; color: var(--accent); padding: 8px 16px; border-radius: 8px; font-weight: 700; font-size: 13px; border: none; cursor: pointer; }

/* ===== LOADING ===== */
.loading-spinner {
  border: 3px solid rgba(255,255,255,0.1);
  border-top: 3px solid var(--accent);
  border-radius: 50%; width: 32px; height: 32px;
  animation: spin 0.8s linear infinite;
  margin: 24px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== EMPLOYEE CLOCKIN MODAL ===== */
.clockin-modal-emp {
  display: flex; flex-direction: column; align-items: center;
  padding: 16px 0; text-align: center;
}
.clockin-modal-photo { width: 100px; height: 100px; border-radius: 50%; object-fit: cover; border: 4px solid var(--accent); margin-bottom: 12px; }
.clockin-modal-name { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.clockin-modal-time { font-size: 14px; color: var(--text-muted); }

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
  .employee-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px; }
  .emp-photo, .emp-photo-placeholder { width: 60px; height: 60px; font-size: 22px; }
  .live-clock { font-size: 36px; }
}

/* ===== AUDIT LOG ===== */
.audit-item { padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.05); }
.audit-item:last-child { border-bottom: none; }
.audit-action { font-size: 12px; font-weight: 600; }
.audit-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.audit-changes { font-size: 11px; color: var(--warning); margin-top: 3px; }

/* Summary row */
.summary-total { background: var(--surface); font-weight: 700; }

/* PDF print styles hidden in UI */
@media print { .no-print { display: none !important; } }
