/* ============================================
   GanadoPro — Estilos principales
   ============================================ */

:root {
  --verde-osc:   #2d5016;
  --verde-med:   #3a6b1a;
  --verde-clar:  #EAF3DE;
  --tierra:      #8b5e3c;
  --crema:       #f5f0e8;
  --texto:       #444441;
  --texto-muted: #888780;
  --borde:       rgba(0,0,0,0.08);
  --sombra:      0 1px 4px rgba(0,0,0,0.06);
  --font-titulo: 'Playfair Display', Georgia, serif;
  --font-cuerpo: 'Inter', system-ui, sans-serif;
  --radio-sm:    8px;
  --radio-md:    12px;
  --radio-lg:    16px;
  --trans:       0.15s ease;
  --sidebar-w:   240px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  font-family: var(--font-cuerpo);
  color: var(--texto);
  background: var(--crema);
  margin: 0;
  padding: 0;
  overflow-x: hidden !important;
  max-width: 100vw !important;
}

/* ============================================
   LAYOUT — SIDEBAR + MAIN
   ============================================ */

.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--verde-osc);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
}

.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  overflow-x: hidden !important;
  max-width: 100% !important;
}

.page-container {
  padding: 28px 32px;
  max-width: 1280px;
}

/* ============================================
   SIDEBAR INTERNALS
   ============================================ */

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo h1 {
  font-family: var(--font-titulo);
  color: #fff;
  font-size: 1.35rem;
  margin: 0 0 2px;
  letter-spacing: -0.01em;
}

.sidebar-logo p {
  color: rgba(255,255,255,0.5);
  font-size: 0.72rem;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sidebar-nav { flex: 1; padding: 10px 0; }

.nav-section {
  padding: 16px 20px 6px;
  color: rgba(255,255,255,0.35);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: rgba(255,255,255,0.72);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--trans);
  border-left: 3px solid transparent;
}

.nav-link:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
  border-left-color: rgba(255,255,255,0.2);
}

.nav-link.active {
  background: rgba(255,255,255,0.13);
  color: #fff;
  border-left-color: #8bc34a;
}

.nav-link .nav-icon { width: 20px; text-align: center; font-size: 1rem; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-user { margin-bottom: 10px; }
.sidebar-user strong { display: block; color: #fff; font-size: 0.875rem; margin-bottom: 2px; }
.sidebar-user span   { color: rgba(255,255,255,0.55); font-size: 0.75rem; }

.btn-logout {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.8);
  border: 1px solid rgba(255,255,255,0.15);
  padding: 6px 12px;
  border-radius: var(--radio-sm);
  font-size: 0.8rem;
  cursor: pointer;
  width: 100%;
  transition: background var(--trans);
  font-family: var(--font-cuerpo);
}

.btn-logout:hover { background: rgba(255,255,255,0.15); color: #fff; }

/* Mobile header */
.mobile-header {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  height: 52px;
  background: var(--verde-osc);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
}

.btn-menu {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.mobile-header-title {
  font-family: var(--font-titulo);
  font-size: 1.1rem;
  flex: 1;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 99;
}

/* ============================================
   PAGE HEADER
   ============================================ */

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-family: var(--font-titulo);
  font-size: 1.6rem;
  color: var(--verde-osc);
  margin: 0 0 2px;
  line-height: 1.2;
}

.page-subtitle { color: var(--texto-muted); font-size: 0.875rem; margin: 0; }

/* ============================================
   CARDS
   ============================================ */

.card {
  background: #fff;
  border-radius: var(--radio-md);
  box-shadow: var(--sombra);
  border: 1px solid var(--borde);
}

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

.card-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--texto);
  margin: 0;
}

.card-body { padding: 20px; }

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  border-radius: var(--radio-md);
  box-shadow: var(--sombra);
  border: 1px solid var(--borde);
  padding: 18px 20px;
  transition: transform var(--trans);
}

.stat-card:hover { transform: translateY(-1px); }

.stat-icon { font-size: 1.6rem; margin-bottom: 8px; }
.stat-label {
  color: var(--texto-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--texto);
  line-height: 1;
  margin-bottom: 6px;
}

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

/* ============================================
   PLAN BAR
   ============================================ */

.plan-bar {
  background: #e9e9e6;
  border-radius: 999px;
  height: 5px;
  overflow: hidden;
  margin-top: 8px;
}

.plan-bar-fill {
  height: 100%;
  background: var(--verde-osc);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.plan-bar-fill.warning { background: #f59e0b; }
.plan-bar-fill.danger  { background: #ef4444; }

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radio-sm);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--trans);
  text-decoration: none;
  font-family: var(--font-cuerpo);
  white-space: nowrap;
}

.btn-primary            { background: var(--verde-osc); color: #fff; }
.btn-primary:hover      { background: var(--verde-med); }
.btn-secondary          { background: #fff; color: var(--texto); border: 1px solid #d1d5db; }
.btn-secondary:hover    { background: #f5f5f3; }
.btn-danger             { background: #fee2e2; color: #dc2626; }
.btn-danger:hover       { background: #fecaca; }
.btn-sm                 { padding: 4px 10px; font-size: 0.8rem; }
.btn:disabled           { opacity: 0.6; cursor: not-allowed; }

/* ============================================
   BADGES
   ============================================ */

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-vivo      { background: var(--verde-clar); color: var(--verde-osc); }
.badge-vendido   { background: #fef3c7; color: #92400e; }
.badge-muerto    { background: #fee2e2; color: #dc2626; }
.badge-secondary { background: #f1f5f9; color: #64748b; }
.badge-vaca      { background: #dbeafe; color: #1e40af; }
.badge-toro      { background: #ede9fe; color: #5b21b6; }
.badge-ternero   { background: #fef3c7; color: #b45309; }
.badge-novillo   { background: #f3f4f6; color: #374151; }
.badge-vaquillona{ background: #fce7f3; color: #9d174d; }

/* ============================================
   TABLE
   ============================================ */

.table-wrapper { overflow-x: auto !important; }

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

.table th {
  background: #f9f9f7;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--texto-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--borde);
  white-space: nowrap;
}

.table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--borde);
  vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: #fafaf8; }

/* ============================================
   FORMS
   ============================================ */

.form-group   { margin-bottom: 16px; }
.form-row     { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--texto);
  margin-bottom: 5px;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: var(--radio-sm);
  font-size: 0.875rem;
  color: var(--texto);
  background: #fff;
  transition: border-color var(--trans), box-shadow var(--trans);
  font-family: var(--font-cuerpo);
}

.form-control:focus {
  outline: none;
  border-color: var(--verde-osc);
  box-shadow: 0 0 0 3px rgba(45,80,22,0.1);
}

textarea.form-control { resize: vertical; min-height: 80px; }

/* ============================================
   MODAL
   ============================================ */

.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.show { display: flex; }

.modal {
  background: #fff;
  border-radius: var(--radio-lg);
  width: 100%;
  max-width: 580px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 24px 48px rgba(0,0,0,0.25);
}

.modal-header {
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--borde);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}

.modal-title { font-family: var(--font-titulo); font-size: 1.25rem; color: var(--verde-osc); margin: 0; }
.modal-close { background: none; border: none; color: var(--texto-muted); font-size: 1.4rem; cursor: pointer; padding: 0 4px; line-height: 1; }
.modal-close:hover { color: var(--texto); }

.modal-body   { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--borde);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  position: sticky;
  bottom: 0;
  background: #fff;
}

/* ============================================
   TOAST
   ============================================ */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 16px;
  border-radius: var(--radio-md);
  font-size: 0.875rem;
  font-weight: 500;
  min-width: 240px;
  max-width: 360px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  animation: toastIn 0.25s ease;
}

.toast-success { background: var(--verde-osc); color: #fff; }
.toast-error   { background: #dc2626; color: #fff; }
.toast-info    { background: #1e40af; color: #fff; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ============================================
   FILTERS BAR
   ============================================ */

.filters-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-control {
  padding: 7px 10px;
  border: 1px solid #d1d5db;
  border-radius: var(--radio-sm);
  font-size: 0.875rem;
  background: #fff;
  color: var(--texto);
  font-family: var(--font-cuerpo);
}

.search-input {
  padding: 7px 12px;
  border: 1px solid #d1d5db;
  border-radius: var(--radio-sm);
  font-size: 0.875rem;
  background: #fff;
  color: var(--texto);
  flex: 1;
  min-width: 180px;
  max-width: 320px;
  font-family: var(--font-cuerpo);
}

.search-input:focus, .filter-control:focus {
  outline: none;
  border-color: var(--verde-osc);
  box-shadow: 0 0 0 3px rgba(45,80,22,0.08);
}

/* ============================================
   WEATHER WIDGET
   ============================================ */

.weather-widget {
  background: linear-gradient(135deg, var(--verde-osc) 0%, var(--verde-med) 100%);
  color: #fff;
  border-radius: var(--radio-md);
  padding: 22px;
  height: 100%;
}

.weather-main { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.weather-location { font-size: 0.78rem; opacity: 0.7; margin-bottom: 4px; }
.weather-temp { font-size: 3rem; font-weight: 700; line-height: 1; }
.weather-desc { font-size: 0.9rem; opacity: 0.85; margin-top: 4px; }
.weather-emoji { font-size: 3.5rem; line-height: 1; }

.weather-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.weather-detail {
  background: rgba(255,255,255,0.12);
  border-radius: var(--radio-sm);
  padding: 8px 10px;
  font-size: 0.75rem;
  opacity: 0.9;
}

.weather-detail strong { display: block; font-size: 1rem; font-weight: 700; margin-bottom: 1px; }

.forecast-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.forecast-day {
  background: rgba(255,255,255,0.12);
  border-radius: var(--radio-sm);
  padding: 8px;
  text-align: center;
  font-size: 0.72rem;
  min-width: 48px;
  flex-shrink: 0;
}

.forecast-day .f-max { font-weight: 700; font-size: 0.9rem; }
.forecast-day .f-min { opacity: 0.65; }

/* ============================================
   EVENTS TIMELINE
   ============================================ */

.event-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--borde);
  align-items: flex-start;
}

.event-item:last-child { border-bottom: none; }

.event-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.ev-peso        { background: #dbeafe; }
.ev-veterinario { background: #fce7f3; }
.ev-parto       { background: var(--verde-clar); }
.ev-observacion { background: #fef3c7; }
.ev-destete     { background: #ede9fe; }
.ev-castracion  { background: #f3f4f6; }
.ev-default     { background: #f3f4f6; }

.event-body { flex: 1; min-width: 0; }
.event-title { font-weight: 600; font-size: 0.875rem; margin-bottom: 2px; }
.event-meta  { font-size: 0.78rem; color: var(--texto-muted); }

/* ============================================
   LLUVIA / RAIN
   ============================================ */

.rain-chart-wrapper {
  position: relative;
  width: 100%;
  height: 220px;
  overflow: hidden;
}

/* ============================================
   EMPTY STATE
   ============================================ */

.empty-state { text-align: center; padding: 48px 24px; color: var(--texto-muted); }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state h3 { color: var(--texto); font-size: 1rem; margin: 0 0 6px; }
.empty-state p  { font-size: 0.875rem; margin: 0; }

/* ============================================
   UPGRADE BANNER
   ============================================ */

.upgrade-banner {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 1px solid #f59e0b;
  border-radius: var(--radio-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.upgrade-banner p { margin: 0; font-size: 0.875rem; color: #92400e; flex: 1; }

/* ============================================
   ALERT / ERROR INLINE
   ============================================ */

.alert {
  padding: 10px 14px;
  border-radius: var(--radio-sm);
  font-size: 0.875rem;
  margin-bottom: 16px;
}

.alert-error   { background: #fee2e2; color: #dc2626; display: none; }
.alert-success { background: var(--verde-clar); color: var(--verde-osc); display: none; }

/* ============================================
   DASHBOARD GRID
   ============================================ */

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}

.dashboard-grid-full { grid-column: 1 / -1; }

/* ============================================
   ANIMATIONS
   ============================================ */

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

.animate-in { animation: fadeUp 0.3s ease forwards; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ============================================
   PLAN BADGES — sidebar
   ============================================ */

.plan-badge { display:inline-block; border-radius:20px; padding:.15rem .55rem; font-size:.7rem; font-weight:700; }
.plan-badge.pro    { background:#f59e0b; color:#fff; }
.plan-badge.gratis { background:rgba(255,255,255,0.2); color:rgba(255,255,255,0.8); }

/* Etiqueta de sección en el sidebar */
.nav-section-label {
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,0.35);
  padding: .6rem 1rem .25rem;
  font-weight: 600;
}

/* Tag "Pro" inline en nav items */
.nav-pro-tag {
  display: inline-block;
  background: rgba(245,158,11,0.25);
  color: #f59e0b;
  font-size: .6rem;
  font-weight: 700;
  border-radius: 4px;
  padding: .05rem .3rem;
  margin-left: .3rem;
  vertical-align: middle;
  letter-spacing: .03em;
}

.btn-upgrade-sidebar {
  display: block;
  margin: .5rem 1rem;
  padding: .5rem .75rem;
  background: rgba(245,158,11,0.15);
  border: 1px solid rgba(245,158,11,0.4);
  border-radius: var(--radio-sm);
  color: #f59e0b;
  font-size: .82rem;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  transition: background var(--trans);
}
.btn-upgrade-sidebar:hover { background: rgba(245,158,11,0.25); }

/* ============================================
   PRO GATE — bloqueo de página
   ============================================ */

.pro-gate-card {
  text-align: center;
  background: #fff;
  border-radius: var(--radio-lg);
  padding: 3rem 2rem;
  max-width: 480px;
  margin: 2rem auto;
  border: 2px solid var(--verde-clar);
}
.pro-gate-icon { font-size: 3rem; margin-bottom: .75rem; }
.pro-gate-card h2 { color: var(--verde-osc); margin-bottom: .5rem; }
.pro-gate-card p  { color: #666; margin-bottom: 1.25rem; }
.pro-features-list { text-align: left; background: var(--verde-clar); border-radius: var(--radio-sm); padding: 1rem 1.25rem; display: inline-block; margin-bottom: 1.5rem; }
.pro-features-list div { font-size: .9rem; color: var(--verde-osc); padding: .2rem 0; }

/* ============================================
   POTREROS GRID
   ============================================ */

.potreros-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.potrero-card {
  background: #fff;
  border-radius: var(--radio-md);
  padding: 1.25rem;
  border: 1px solid var(--borde);
  box-shadow: var(--sombra);
}
.potrero-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: .75rem;
}
.potrero-card-header h4 { margin:0; font-size:1rem; color:var(--verde-osc); }
.potrero-stats { display: flex; gap:.75rem; flex-wrap:wrap; font-size:.85rem; color:#555; margin-bottom:.5rem; }
.potrero-pasto { font-size:.82rem; color:var(--verde-med); margin:.35rem 0; }
.potrero-notas { font-size:.8rem; color:#888; margin:.35rem 0; }
.potrero-acciones { display:flex; gap:.5rem; margin-top:.75rem; }
.progress-bar-wrap { height:6px; background:#e5e7eb; border-radius:3px; margin:.4rem 0; overflow:hidden; }
.progress-bar { height:100%; border-radius:3px; transition:width .4s; }

/* ============================================
   UPGRADE BANNER
   ============================================ */

.upgrade-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border: 1px solid #f59e0b;
  border-radius: var(--radio-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.upgrade-banner-icon { font-size: 1.75rem; flex-shrink: 0; }
.upgrade-banner-text { flex: 1; font-size: .9rem; min-width: 180px; }
.btn-warning { background: #f59e0b; color: #fff; border: none; padding: .5rem 1rem; border-radius: var(--radio-sm); cursor: pointer; font-weight: 600; white-space: nowrap; text-decoration: none; }
.btn-warning:hover { background: #d97706; }

/* ============================================
   GRID 2 COLS
   ============================================ */

.grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
@media(max-width:768px){ .grid-2col { grid-template-columns: 1fr; } }
.mb-2 { margin-bottom: 1rem; }
.mt-2 { margin-top: 1rem; }

/* ============================================
   PARTOS PRÓXIMOS
   ============================================ */

.parto-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .6rem .75rem;
  background: var(--verde-clar);
  border-radius: var(--radio-sm);
  margin-bottom: .5rem;
  flex-wrap: wrap;
  font-size: .9rem;
}
.parto-caravana { font-weight: 700; color: var(--verde-osc); }
.parto-fecha { color: var(--verde-med); }

/* ============================================
   MISC
   ============================================ */

.hidden { display: none !important; }
.loading-state { text-align: center; padding: 3rem; color: #888; font-size: .95rem; }

.skeleton {
  background: #e9e9e6;
  border-radius: var(--radio-sm);
  animation: pulse 1.5s ease infinite;
}
