/* punch-app/public/css/punch.css */
/* Mobile-first responsive styling for Punch In/Out app */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #3b82f6;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #06b6d4;
  --dark: #1f2937;
  --light: #f9fafb;
  --border: #e5e7eb;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 10px;
  color: var(--dark);
}

.punch-container {
  max-width: 500px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.punch-card {
  background: white;
  border-radius: 16px;
  box-shadow: var(--shadow), 0 20px 40px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  width: 100%;
}

/* ── HEADER ── */
.punch-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 24px 20px;
  text-align: center;
}

.punch-header h1 {
  font-size: 24px;
  margin-bottom: 8px;
  font-weight: 700;
}

.punch-header p {
  font-size: 14px;
  opacity: 0.9;
  margin-bottom: 12px;
}

.time-display {
  font-size: 28px;
  font-weight: bold;
  font-family: 'Courier New', monospace;
}

/* ── CONTENT ── */
.punch-content {
  padding: 24px 20px;
}

.code-entry,
.step-content {
  display: block;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--dark);
  font-size: 14px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  transition: all 0.3s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.form-group small {
  display: block;
  margin-top: 6px;
  color: #999;
  font-size: 12px;
}

/* ── BUTTONS ── */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.btn-lg,
.btn-large {
  width: 100%;
  padding: 16px 24px;
  font-size: 16px;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: #2563eb;
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #059669;
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.btn-secondary {
  background: #e5e7eb;
  color: var(--dark);
}

.btn-secondary:hover {
  background: #d1d5db;
}

.btn-info {
  background: var(--info);
  color: white;
}

.btn-info:hover {
  background: #0891b2;
}

.btn-link {
  background: none;
  color: var(--primary);
  text-decoration: underline;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* ── BUTTON GROUPS ── */
.button-group {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-direction: column;
}

.button-group .btn {
  flex: 1;
  margin: 0;
}

@media (min-width: 480px) {
  .button-group {
    flex-direction: row;
  }

  .button-group .btn {
    flex: 1;
  }
}

/* ── CAMERA ── */
.camera-box {
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  margin: 20px 0;
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
}

.camera-box video,
.camera-box canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-preview {
  margin-top: 20px;
  padding: 16px;
  background: var(--light);
  border-radius: 12px;
}

.photo-preview h3 {
  margin-bottom: 12px;
  font-size: 14px;
  color: #666;
}

.photo-preview img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  margin-bottom: 16px;
}

/* ── LOCATION ── */
.location-box {
  background: var(--light);
  border-radius: 12px;
  padding: 20px;
  margin: 20px 0;
  border-left: 4px solid var(--info);
}

.location-info p {
  font-size: 14px;
  margin-bottom: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.location-info p:last-child {
  border-bottom: none;
}

.location-info span {
  font-weight: 600;
  color: var(--primary);
}

/* ── STEPS ── */
.step-indicator {
  display: flex;
  justify-content: space-around;
  padding: 20px;
  background: var(--light);
  border-bottom: 1px solid var(--border);
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  opacity: 0.5;
  transition: all 0.3s;
}

.step.active {
  opacity: 1;
}

.step span {
  width: 40px;
  height: 40px;
  background: var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #666;
  font-size: 16px;
}

.step.active span {
  background: var(--primary);
  color: white;
}

.step p {
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  color: #666;
}

.step.active p {
  color: var(--dark);
}

/* ── CONFIRMATION BOX ── */
.confirm-box {
  margin: 20px 0;
}

.confirm-item {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.confirm-item:last-child {
  border-bottom: none;
}

.confirm-item h3 {
  font-size: 14px;
  font-weight: 600;
  color: #666;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.confirm-item p {
  font-size: 14px;
  padding: 8px 0;
  margin: 0;
}

.confirm-item strong {
  color: var(--dark);
}

/* ── STATUS ── */
.punch-status {
  padding: 20px;
  background: var(--light);
  border-bottom: 1px solid var(--border);
}

.status-box {
  background: white;
  border-radius: 12px;
  padding: 16px;
  border-left: 4px solid var(--warning);
}

.status-box h2 {
  font-size: 16px;
  margin-bottom: 12px;
  color: #666;
}

.status-box p {
  font-size: 14px;
  margin: 8px 0;
}

.status-box p:first-of-type {
  font-size: 18px;
  font-weight: 700;
}

/* ── ACTIONS ── */
.punch-actions {
  padding: 20px;
  background: var(--light);
  border-bottom: 1px solid var(--border);
}

.punch-actions .btn {
  width: 100%;
  padding: 16px;
  margin-bottom: 12px;
  font-size: 16px;
}

.punch-actions .btn:last-child {
  margin-bottom: 0;
}

/* ── HISTORY ── */
.punch-history {
  padding: 20px;
}

.punch-history h3 {
  font-size: 16px;
  margin-bottom: 16px;
  color: var(--dark);
  font-weight: 700;
}

#historyBox {
  background: var(--light);
  border-radius: 8px;
  padding: 16px;
  font-size: 14px;
  line-height: 1.6;
}

/* ── ACTION BAR ── */
.punch-action-bar {
  padding: 16px 20px;
  background: var(--light);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
}

.punch-action-bar .btn {
  flex: 1;
  margin: 0;
  padding: 12px 16px;
  font-size: 14px;
}

/* ── MESSAGES ── */
.error-message,
.message {
  padding: 12px 16px;
  border-radius: 8px;
  margin: 16px 0;
  font-size: 14px;
  font-weight: 500;
  animation: slideIn 0.3s ease-out;
}

.error-message {
  background: #fee2e2;
  color: #dc2626;
  border-left: 4px solid #dc2626;
}

.message.success {
  background: #d1fae5;
  color: #059669;
  border-left: 4px solid #059669;
}

.message.error {
  background: #fee2e2;
  color: #dc2626;
  border-left: 4px solid #dc2626;
}

.message.info {
  background: #dbeafe;
  color: #1e40af;
  border-left: 4px solid #1e40af;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── INFO SECTION ── */
.info-section {
  background: var(--light);
  border-radius: 8px;
  padding: 16px;
  margin-top: 20px;
}

.info-section h3 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--dark);
}

.info-section ol {
  margin-left: 20px;
  font-size: 13px;
  line-height: 1.8;
  color: #666;
}

/* ── FOOTER ── */
.punch-footer {
  padding: 16px 20px;
  text-align: center;
  border-top: 1px solid var(--border);
  background: var(--light);
  font-size: 12px;
  color: #999;
}

.punch-footer p {
  margin: 6px 0;
}

.punch-footer a {
  color: var(--primary);
  text-decoration: none;
}

.punch-footer a:hover {
  text-decoration: underline;
}

/* ── LOADING ── */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.spinner {
  border: 4px solid var(--border);
  border-top: 4px solid var(--primary);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-spinner p {
  color: #999;
  font-size: 14px;
}

/* ── RESPONSIVE ── */
@media (max-width: 480px) {
  .punch-header h1 {
    font-size: 20px;
  }

  .punch-header {
    padding: 16px;
  }

  .punch-content,
  .punch-actions,
  .punch-history,
  .punch-action-bar {
    padding: 16px;
  }

  .btn {
    padding: 12px 16px;
    font-size: 14px;
  }

  .form-group input {
    font-size: 16px; /* Prevent zoom on iOS */
  }
}

@media (min-width: 480px) {
  .punch-card {
    margin-top: 20px;
    margin-bottom: 20px;
  }
}