/* ============================================
   MIS RAICES - Panel de Administración
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;600;700;800&family=Playfair+Display:wght@600;700&display=swap');

:root {
  --green-dark:   #1a6b2a;
  --green-main:   #2e8b3e;
  --green-light:  #4caf50;
  --green-pale:   #e8f5e9;
  --brown-main:   #6d3b0c;
  --cream:        #fdfaf5;
  --sidebar-bg:   #1a2e1c;
  --sidebar-hover:#243826;
  --sidebar-active:#2e8b3e;
  --white:        #ffffff;
  --gray-light:   #f5f5f5;
  --gray-mid:     #9e9e9e;
  --gray-dark:    #424242;
  --text-main:    #2c2c2c;
  --danger:       #e53935;
  --warning:      #f57c00;
  --success:      #43a047;
  --info:         #1976d2;
  --shadow-sm:    0 2px 8px rgba(0,0,0,0.08);
  --shadow-md:    0 6px 24px rgba(0,0,0,0.12);
  --radius-sm:    8px;
  --radius-md:    14px;
  --transition:   all 0.25s ease;
  --sidebar-w:    260px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Nunito', sans-serif;
  background: #f0f4f1;
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
}

/* ---- SIDEBAR ---- */
.admin-sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  height: 100vh;
  position: fixed;
  left: 0; top: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 100;
  transition: var(--transition);
}
.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-logo img { height: 44px; filter: brightness(0) invert(1); }
.sidebar-logo-text { color: #fff; }
.sidebar-logo-text .brand { font-weight: 800; font-size: 0.95rem; line-height: 1.2; }
.sidebar-logo-text .sub { font-size: 0.72rem; color: rgba(255,255,255,0.5); }

.sidebar-section-label {
  padding: 20px 20px 8px;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.35);
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: rgba(255,255,255,0.72);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: var(--transition);
  border-left: 3px solid transparent;
  position: relative;
}
.sidebar-nav a:hover {
  background: var(--sidebar-hover);
  color: #fff;
}
.sidebar-nav a.active {
  background: rgba(46,139,62,0.25);
  color: var(--green-light);
  border-left-color: var(--green-light);
}
.sidebar-nav a .icon { width: 20px; text-align: center; font-size: 1.1rem; }
.badge-count {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  border-radius: 10px;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 800;
}
.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255,255,255,0.5);
  text-decoration: none;
  font-size: 0.85rem;
  transition: var(--transition);
}
.sidebar-footer a:hover { color: #fff; }

/* ---- MAIN CONTENT ---- */
.admin-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.admin-topbar {
  background: var(--white);
  padding: 0 32px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title h1 { font-size: 1.2rem; font-weight: 800; color: var(--green-dark); }
.topbar-title p { font-size: 0.8rem; color: var(--gray-mid); }
.topbar-actions { display: flex; align-items: center; gap: 16px; }
.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--green-dark);
}
.avatar {
  width: 36px; height: 36px;
  background: var(--green-main);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
}

.admin-content { padding: 32px; flex: 1; }

/* ---- STAT CARDS ---- */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}
.stat-card-admin {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
}
.stat-card-admin:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.si-green { background: var(--green-pale); }
.si-orange { background: #fff3e0; }
.si-blue { background: #e3f2fd; }
.si-red { background: #ffebee; }
.stat-card-admin .number { font-size: 1.8rem; font-weight: 800; color: var(--text-main); line-height: 1; }
.stat-card-admin .label { font-size: 0.82rem; color: var(--gray-mid); margin-top: 4px; }
.stat-card-admin .trend { font-size: 0.78rem; color: var(--success); margin-top: 4px; font-weight: 700; }

/* ---- TABLES ---- */
.admin-card {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 24px;
}
.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h3 { font-size: 1rem; font-weight: 800; color: var(--green-dark); }
.card-body { padding: 24px; }

table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--gray-mid);
  border-bottom: 2px solid #f0f0f0;
  background: #fafafa;
}
tbody td {
  padding: 14px 16px;
  font-size: 0.9rem;
  border-bottom: 1px solid #f5f5f5;
  vertical-align: middle;
}
tbody tr:hover { background: var(--gray-light); }
tbody tr:last-child td { border-bottom: none; }

/* ---- BADGES ---- */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
}
.badge-success { background: #e8f5e9; color: #2e7d32; }
.badge-warning { background: #fff3e0; color: #e65100; }
.badge-danger  { background: #ffebee; color: #c62828; }
.badge-info    { background: #e3f2fd; color: #1565c0; }
.badge-gray    { background: #f5f5f5; color: #616161; }

/* ---- FORMS ---- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-group { margin-bottom: 20px; }
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--green-dark);
  margin-bottom: 6px;
}
.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #e0e0e0;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.92rem;
  transition: var(--transition);
  outline: none;
  color: var(--text-main);
  background: #fafafa;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  border-color: var(--green-main);
  background: var(--white);
}
.form-group textarea { resize: vertical; min-height: 100px; }
.form-group .form-hint { font-size: 0.78rem; color: var(--gray-mid); margin-top: 4px; }
.form-check { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.form-check input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--green-main); }
.form-check label { font-size: 0.88rem; font-weight: 600; margin: 0; }

/* ---- BUTTONS ---- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 20px; border-radius: var(--radius-sm); font-family: inherit; font-size: 0.88rem; font-weight: 700; cursor: pointer; border: none; transition: var(--transition); text-decoration: none; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-green { background: var(--green-main); color: #fff; }
.btn-green:hover { background: var(--green-dark); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b71c1c; }
.btn-gray { background: var(--gray-light); color: var(--gray-dark); }
.btn-gray:hover { background: #e0e0e0; }
.btn-outline { background: none; border: 2px solid var(--green-main); color: var(--green-main); }
.btn-outline:hover { background: var(--green-pale); }
.btn-warning { background: var(--warning); color: #fff; }
.btn-info { background: var(--info); color: #fff; }

/* ---- IMAGE UPLOAD ---- */
.img-upload-zone {
  border: 2px dashed #c8e6c9;
  border-radius: var(--radius-md);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--green-pale);
}
.img-upload-zone:hover { border-color: var(--green-main); background: #d0f0d5; }
.img-preview { max-width: 160px; max-height: 160px; border-radius: var(--radius-sm); object-fit: cover; margin-top: 12px; }

/* ---- PAGINATION ---- */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 24px; }
.page-btn { width: 36px; height: 36px; border: 2px solid #e0e0e0; background: #fff; border-radius: var(--radius-sm); cursor: pointer; font-family: inherit; font-weight: 700; font-size: 0.88rem; transition: var(--transition); display: flex; align-items: center; justify-content: center; text-decoration: none; color: var(--text-main); }
.page-btn.active, .page-btn:hover { background: var(--green-main); border-color: var(--green-main); color: #fff; }

/* ---- ALERT ---- */
.alert { padding: 14px 18px; border-radius: var(--radius-sm); margin-bottom: 20px; font-size: 0.9rem; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.alert-success { background: #e8f5e9; color: #2e7d32; border-left: 4px solid var(--success); }
.alert-danger  { background: #ffebee; color: #c62828; border-left: 4px solid var(--danger); }
.alert-warning { background: #fff3e0; color: #e65100; border-left: 4px solid var(--warning); }

/* ---- MODAL ---- */
.modal-bg { position:fixed;inset:0;background:rgba(0,0,0,0.5);z-index:500;display:flex;align-items:center;justify-content:center;padding:20px; }
.modal-panel { background:var(--white);border-radius:var(--radius-md);padding:32px;max-width:560px;width:100%;max-height:90vh;overflow-y:auto;position:relative; }
.modal-panel h3 { font-size:1.2rem;font-weight:800;color:var(--green-dark);margin-bottom:20px; }

/* ---- RESPONSIVE ---- */
@media(max-width:1024px){
  .stat-cards{grid-template-columns:repeat(2,1fr);}
  .form-grid{grid-template-columns:1fr;}
}
@media(max-width:768px){
  .admin-sidebar{transform:translateX(-100%);}
  .admin-sidebar.open{transform:none;}
  .admin-main{margin-left:0;}
  .stat-cards{grid-template-columns:1fr 1fr;}
  .admin-content{padding:20px;}
}

/* ---- UTILS ---- */
.flex{display:flex;} .flex-between{display:flex;justify-content:space-between;align-items:center;}
.gap-8{gap:8px;} .gap-12{gap:12px;} .gap-16{gap:16px;}
.mb-16{margin-bottom:16px;} .mb-24{margin-bottom:24px;}
.text-right{text-align:right;} .text-center{text-align:center;}
.text-green{color:var(--green-main);} .text-danger{color:var(--danger);}
.fw-700{font-weight:700;} .fw-800{font-weight:800;}
.full-width{width:100%;}
