/* Modern Design System for Amazon Staff Manager */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg-primary: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --border-color: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-gold: #f59e0b;
  --accent-gold-hover: #d97706;
  --accent-gold-light: rgba(245, 158, 11, 0.15);
  --accent-blue: #3b82f6;
  --accent-blue-light: rgba(59, 130, 246, 0.15);
  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.15);
  --danger: #ef4444;
  --danger-light: rgba(239, 68, 68, 0.15);
  --purple: #8b5cf6;
  --purple-light: rgba(139, 92, 246, 0.15);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

[data-theme="light"] {
  --bg-primary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --border-color: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 80px; /* Space for mobile nav */
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Header & Top Bar */
header.app-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.2rem;
  color: #0f172a;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.brand-title h1 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-title span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.staff-selector-badge {
  background: var(--accent-gold-light);
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold);
  padding: 6px 12px;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.staff-selector-badge:hover {
  background: var(--accent-gold);
  color: #0f172a;
}

.theme-toggle-btn {
  background: var(--border-color);
  border: none;
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

/* Navigation Bar */
.desktop-nav {
  display: flex;
  gap: 8px;
  background: var(--bg-primary);
  padding: 8px 20px;
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
}

.nav-tab {
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.nav-tab:hover {
  color: var(--text-main);
  background: var(--bg-card);
}

.nav-tab.active {
  background: var(--accent-gold);
  color: #0f172a;
}

/* Bottom Mobile Nav */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  padding: 8px 12px;
  justify-content: space-around;
  z-index: 100;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.3);
}

.mobile-nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  padding: 6px;
  width: 25%;
  border-radius: var(--radius-sm);
}

.mobile-nav-tab.active {
  color: var(--accent-gold);
}

.mobile-nav-tab svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

/* Main Container */
main.container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
  flex: 1;
}

.tab-content {
  display: none;
  animation: fadeIn 0.25s ease-in-out;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Cards & Layout */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

/* Metric Widget */
.metric-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.metric-icon {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.metric-info h3 {
  font-size: 1.5rem;
  font-weight: 800;
}

.metric-info p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Buttons & Inputs */
.btn {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #0f172a;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.35);
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}
.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
}
.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.35);
}

.btn-secondary {
  background: var(--border-color);
  color: var(--text-main);
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
}

.btn-lg {
  padding: 16px 28px;
  font-size: 1.1rem;
  border-radius: var(--radius-md);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.form-control:focus {
  border-color: var(--accent-gold);
}

.voice-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.voice-btn {
  position: absolute;
  right: 8px;
  background: var(--accent-gold-light);
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.voice-btn.recording {
  background: var(--danger);
  color: white;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* Emoji Presets Bar */
.emoji-presets-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-top: 6px;
}

.emoji-presets-bar span {
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--bg-card);
  transition: all 0.2s ease;
  user-select: none;
}

.emoji-presets-bar span:hover {
  background: var(--accent-gold);
  transform: scale(1.2);
}

/* Punch Card Layout */
.punch-card {
  text-align: center;
  padding: 30px 20px;
}

.status-badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.status-in {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid var(--success);
}

.status-out {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid var(--danger);
}

.live-clock {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
  color: var(--accent-gold);
}

.live-date {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.photo-preview-box {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 3px dashed var(--border-color);
  margin: 0 auto 20px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  background: var(--bg-primary);
  cursor: pointer;
}

.photo-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-placeholder {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: center;
  padding: 10px;
}

/* Packing Live Timer */
.active-job-box {
  background: var(--accent-gold-light);
  border: 2px solid var(--accent-gold);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  margin-bottom: 20px;
}

.active-job-timer {
  font-size: 3rem;
  font-weight: 800;
  color: var(--accent-gold);
  font-family: monospace;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  text-align: left;
}

table.data-table th {
  background: var(--bg-primary);
  padding: 12px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-color);
}

table.data-table td {
  padding: 14px;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border-color);
}

table.data-table tr:hover {
  background: var(--bg-card-hover);
}

.thumb-img {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  cursor: pointer;
  border: 1px solid var(--border-color);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 90%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
}

.close-modal-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.camera-stream {
  width: 100%;
  height: 280px;
  background: #000;
  border-radius: var(--radius-md);
  object-fit: cover;
  margin-bottom: 16px;
}

/* Staff List Cards in Selector */
.staff-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.staff-card {
  background: var(--bg-primary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.staff-card:hover, .staff-card.selected {
  border-color: var(--accent-gold);
  background: var(--accent-gold-light);
}

.staff-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--border-color);
  margin: 0 auto 10px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
}

.staff-card-name {
  font-size: 0.9rem;
  font-weight: 700;
}

.staff-card-role {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .desktop-nav {
    display: none;
  }
  .mobile-nav {
    display: flex;
  }
  main.container {
    padding: 14px;
  }
  .brand-title h1 {
    font-size: 0.95rem;
  }
  .card {
    padding: 16px;
  }
  .active-job-timer {
    font-size: 2.2rem;
  }
}
