/* =========================================================
   AgroBetty - Modern Mobile-First PWA Design System
   ========================================================= */

:root {
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Color Palette */
  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --bg-input: #0f172a;

  --accent-purple: #8b5cf6;
  --accent-purple-dark: #581c87;
  --accent-emerald: #10b981;
  --accent-green: #22c55e;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: #334155;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 75px; /* Espacio para el bottom nav */
}

/* Utilities */
.hidden { display: none !important; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.85rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* Login Screen */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
  background: radial-gradient(circle at top right, #3b0764, #0f172a 70%);
}

.login-card {
  background-color: rgba(30, 41, 59, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  padding: 2.5rem 2rem;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.login-brand {
  text-align: center;
  margin-bottom: 2rem;
}

.login-brand .brand-icon {
  font-size: 2.5rem;
  color: var(--accent-purple);
  margin-bottom: 0.5rem;
}

.login-brand h1 {
  font-size: 1.8rem;
  font-weight: 700;
  background: linear-gradient(135deg, #a855f7, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-brand p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Header Global */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1.25rem;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1100px;
  margin: 0 auto;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-logo {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-purple-dark));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.2rem;
}

.app-name {
  font-weight: 700;
  font-size: 1.1rem;
}

.campaign-selector-wrapper {
  margin-top: 2px;
}

.campaign-select {
  background-color: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--bg-card);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.85rem;
  border: 1px solid var(--border-color);
}

.user-chip button {
  background: none;
  border: none;
  color: var(--accent-rose);
  cursor: pointer;
  padding: 2px 4px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-closed {
  background-color: rgba(244, 63, 94, 0.2);
  color: #fda4af;
  border: 1px solid rgba(244, 63, 94, 0.4);
}

/* Cards & Layout */
.app-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1rem;
}

.container {
  width: 100%;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.2s ease-in-out;
}

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

.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-md);
}

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

/* Card Saldo Personal */
.card-balance {
  background: linear-gradient(135deg, #4c1d95, #1e1b4b);
  border: 1px solid #6d28d9;
  position: relative;
  overflow: hidden;
}

.card-balance::after {
  content: '🍇';
  position: absolute;
  right: -10px;
  bottom: -15px;
  font-size: 5rem;
  opacity: 0.15;
}

.balance-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  color: #ddd6fe;
}

.balance-amount {
  font-size: 2.2rem;
  font-weight: 700;
  margin: 0.5rem 0;
  letter-spacing: -0.5px;
}

.balance-subtext {
  font-size: 0.85rem;
  color: #c4b5fd;
}

/* Quick Actions Grid */
.section-title {
  font-weight: 600;
  font-size: 1rem;
  margin: 1.5rem 0 0.75rem 0;
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.action-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.action-card:active {
  transform: scale(0.96);
}

.action-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #fff;
}

.bg-purple { background-color: var(--accent-purple); }
.bg-emerald { background-color: var(--accent-emerald); }
.bg-green { background-color: #25d366; }
.bg-amber { background-color: var(--accent-amber); }

/* Counter Display */
.counter-display {
  text-align: center;
  padding: 1.5rem 0 0.5rem 0;
}

.counter-val {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent-emerald);
  font-family: monospace;
}

.counter-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Forms & Buttons */
.form-group {
  margin-bottom: 1.25rem;
}

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

input[type="text"],
input[type="tel"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent-purple);
}

.input-readonly {
  background-color: var(--bg-card);
  opacity: 0.7;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  transition: opacity 0.2s ease, transform 0.1s ease;
}

.btn:active { transform: scale(0.98); }
.btn-block { width: 100%; }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8rem; }

.btn-primary { background-color: var(--accent-purple); color: #fff; }
.btn-emerald { background-color: var(--accent-emerald); color: #fff; }
.btn-whatsapp { background-color: #25d366; color: #fff; }
.btn-secondary { background-color: var(--bg-card-hover); color: var(--text-main); }
.btn-danger { background-color: var(--accent-rose); color: #fff; }

/* Lists & Tables */
.section-header-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.expenses-list, .work-logs-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.list-item-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.item-main h4 {
  font-size: 0.95rem;
  font-weight: 600;
}

.item-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.item-amount {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-purple);
}

.table-responsive {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.table th, .table td {
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.table th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.8rem;
  text-transform: uppercase;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.stat-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.stat-icon {
  width: 36px;
  height: 36px;
  background-color: rgba(139, 92, 246, 0.15);
  color: var(--accent-purple);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-val {
  display: block;
  font-weight: 700;
  font-size: 1rem;
}

.stat-lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  padding: 0.4rem 0;
  z-index: 1000;
}

.nav-item {
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 0.75rem;
  font-family: inherit;
  cursor: pointer;
  padding: 0.3rem 0.75rem;
  transition: color 0.15s ease;
}

.nav-item i {
  font-size: 1.25rem;
}

.nav-item.active {
  color: var(--accent-purple);
  font-weight: 600;
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.active {
  display: flex;
}

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

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

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

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.whatsapp-textarea {
  font-family: monospace;
  background-color: #0b141a;
  color: #e9edef;
  border-color: #2a3942;
}

.print-only { display: none; }

/* Print Styles */
@media print {
  body {
    background-color: #fff;
    color: #000;
    padding-bottom: 0;
  }

  .no-print, .app-header, .bottom-nav {
    display: none !important;
  }

  .print-only {
    display: block !important;
  }

  .card {
    border: 1px solid #ccc;
    background-color: #fff;
    color: #000;
    box-shadow: none;
  }

  .table th, .table td {
    border-bottom: 1px solid #ddd;
    color: #000;
  }
}

/* Checkbox group container */
.checkbox-group-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  max-height: 160px;
  overflow-y: auto;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.checkbox-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-purple);
  cursor: pointer;
}
