/* PoncheApp Styles - Clean Industrial Design */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@500&display=swap');

:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #334155;
  --bg-input: #1e293b;
  --accent: #0ea5e9;
  --accent-hover: #38bdf8;
  --accent-glow: rgba(14, 165, 233, 0.3);
  --success: #22c55e;
  --success-glow: rgba(34, 197, 94, 0.3);
  --warning: #f59e0b;
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.3);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: #475569;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  --radius: 12px;
  --radius-sm: 8px;
}

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

html, body {
  height: 100%;
  overflow-x: hidden;
}

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
}

/* App Container */
.app-container {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  background: var(--bg-secondary);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-title {
  font-size: 1.25rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-title .icon {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-user {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 20px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

/* Login Screen */
.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  padding: 20px;
}

.login-logo {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--accent), #6366f1);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  box-shadow: 0 8px 32px var(--accent-glow);
}

.login-logo svg {
  width: 48px;
  height: 48px;
  color: white;
}

.login-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 8px;
  text-align: center;
}

.login-subtitle {
  color: var(--text-secondary);
  margin-bottom: 32px;
  text-align: center;
}

.login-form {
  width: 100%;
  max-width: 320px;
}

/* Form Elements */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  transition: all 0.2s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.form-input::placeholder {
  color: var(--text-muted);
}

/* PIN Input */
.pin-input-container {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.pin-digit {
  width: 56px;
  height: 64px;
  text-align: center;
  font-size: 1.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.pin-digit:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: white;
  width: 100%;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #16a34a;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.btn-icon {
  padding: 10px;
  border-radius: var(--radius-sm);
}

/* Punch Button - Big and Prominent */
.punch-section {
  text-align: center;
  padding: 40px 20px;
}

.punch-status {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.punch-time {
  font-size: 3rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 8px;
}

.punch-date {
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.punch-btn {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  font-size: 1.25rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.punch-btn.entrada {
  background: linear-gradient(135deg, var(--success), #16a34a);
  color: white;
  box-shadow: 0 8px 32px var(--success-glow);
}

.punch-btn.entrada:hover {
  transform: scale(1.05);
  box-shadow: 0 12px 40px var(--success-glow);
}

.punch-btn.salida {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: white;
  box-shadow: 0 8px 32px var(--danger-glow);
}

.punch-btn.salida:hover {
  transform: scale(1.05);
  box-shadow: 0 12px 40px var(--danger-glow);
}

.punch-btn:active {
  transform: scale(0.98);
}

.punch-btn-text {
  position: relative;
  z-index: 1;
}

.punch-btn-icon {
  font-size: 2.5rem;
  margin-bottom: 4px;
}

/* Vehicle Selection */
.vehicle-section {
  margin-top: 32px;
  padding: 20px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.vehicle-section-title {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.vehicle-select {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.vehicle-select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Cards */
.card {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  margin-bottom: 16px;
}

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

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
}

.card-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* Table */
.table-container {
  overflow-x: auto;
  margin: -20px;
  margin-top: 0;
  padding: 0 20px 20px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table th,
.table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table th {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.table tr:last-child td {
  border-bottom: none;
}

/* List Items */
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.list-item-content {
  flex: 1;
}

.list-item-title {
  font-weight: 500;
}

.list-item-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.list-item-actions {
  display: flex;
  gap: 8px;
}

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  position: sticky;
  top: 65px;
  z-index: 99;
}

.nav-tab {
  flex: 1;
  padding: 14px 16px;
  text-align: center;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.875rem;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-family: inherit;
}

.nav-tab:hover {
  color: var(--text-primary);
}

.nav-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Bottom Nav (Mobile) */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 8px 0;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 100;
}

.bottom-nav-items {
  display: flex;
  justify-content: space-around;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.75rem;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.bottom-nav-item.active {
  color: var(--accent);
}

.bottom-nav-item svg {
  width: 24px;
  height: 24px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

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

.modal {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn 0.3s ease;
  border-left: 4px solid var(--accent);
}

.toast.success {
  border-left-color: var(--success);
}

.toast.error {
  border-left-color: var(--danger);
}

.toast.warning {
  border-left-color: var(--warning);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-secondary);
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  opacity: 0.5;
}

.empty-state-title {
  font-size: 1.125rem;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-primary);
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-success {
  background: rgba(34, 197, 94, 0.2);
  color: var(--success);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.2);
  color: var(--warning);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

/* Expense Type Icons */
.expense-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
}

.expense-icon.gas {
  background: rgba(245, 158, 11, 0.2);
  color: var(--warning);
}

.expense-icon.repair {
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

.expense-icon.product {
  background: rgba(14, 165, 233, 0.2);
  color: var(--accent);
}

/* Responsive */
@media (max-width: 640px) {
  .nav-tabs {
    display: none;
  }
  
  .bottom-nav {
    display: block;
  }
  
  .main-content {
    padding-bottom: 80px;
  }
  
  .header-title {
    font-size: 1.125rem;
  }
  
  .punch-time {
    font-size: 2.5rem;
  }
  
  .punch-btn {
    width: 160px;
    height: 160px;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* Screen visibility */
.screen {
  display: none;
}

.screen.active {
  display: block;
}

/* Utility classes */
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }
.font-mono { font-family: 'JetBrains Mono', monospace; }
.hidden { display: none !important; }

/* Week Navigator */
.week-navigator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--border);
}

.week-display {
  text-align: center;
  flex: 1;
}

.week-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.week-dates {
  font-size: 1rem;
  font-weight: 600;
}

.week-day {
  color: var(--accent);
}

.week-navigator .btn.disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Stat Diff */
.stat-diff {
  font-size: 0.75rem;
  margin-top: 8px;
  padding: 4px 8px;
  border-radius: 4px;
}

.stat-diff.positive {
  color: var(--success);
  background: rgba(34, 197, 94, 0.1);
}

.stat-diff.negative {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

/* Export Section */
.export-section {
  margin: 20px 0;
  text-align: center;
}

.export-section .btn {
  width: 100%;
  max-width: 300px;
}
