/* =============================================
   ADMIN PANEL — Asociación Cultural Tera
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=Raleway:wght@400;500;600;700&display=swap');

:root {
  --a-bg:       #0F1A0A;
  --a-surface:  #1A2E12;
  --a-surface2: #243D1A;
  --a-border:   rgba(255,255,255,.08);
  --a-text:     #E8DFD0;
  --a-muted:    rgba(232,223,208,.5);
  --a-verde:    #5BA83C;
  --a-ocre:     #E8A830;
  --a-terra:    #D4622A;
  --a-azul:     #5B9BD5;
  --a-danger:   #E05050;
  --a-success:  #5BA83C;
  --radius:     8px;
  --radius-lg:  12px;
  --shadow:     0 4px 24px rgba(0,0,0,.4);
  --transition: 0.25s cubic-bezier(.4,0,.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }

body {
  font-family: 'Raleway', sans-serif;
  background: var(--a-bg);
  color: var(--a-text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ── LAYOUT ── */
.admin-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

/* ── SIDEBAR ── */
.admin-sidebar {
  background: var(--a-surface);
  border-right: 1px solid var(--a-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 1.5rem;
  border-bottom: 1px solid var(--a-border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.sidebar-brand img { width: 40px; height: 40px; object-fit: contain; }
.sidebar-brand-text strong {
  display: block;
  font-family: 'Playfair Display', serif;
  font-size: 0.9rem;
  color: var(--a-text);
}
.sidebar-brand-text span {
  font-size: 0.7rem;
  color: var(--a-ocre);
  letter-spacing: 0.08em;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-section-label {
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--a-muted);
  padding: 0.75rem 0.75rem 0.25rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius);
  color: var(--a-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
}
.sidebar-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-link:hover { color: var(--a-text); background: rgba(255,255,255,.05); }
.sidebar-link.active { color: var(--a-text); background: rgba(91,168,60,.15); }
.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  background: var(--a-verde);
  border-radius: 0 2px 2px 0;
}
.sidebar-badge {
  margin-left: auto;
  background: var(--a-terra);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.5rem;
  border-radius: 50px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 1rem 0.75rem;
  border-top: 1px solid var(--a-border);
}
.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius);
  color: var(--a-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
}
.sidebar-footer a svg { width: 18px; height: 18px; }
.sidebar-footer a:hover { color: var(--a-danger); background: rgba(224,80,80,.08); }

/* ── MAIN CONTENT ── */
.admin-main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--a-border);
  background: rgba(26,46,18,.5);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.admin-topbar h1 {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--a-text);
}
.topbar-actions { display: flex; align-items: center; gap: 0.75rem; }

.admin-content {
  flex: 1;
  padding: 2rem;
  max-width: 1200px;
}

/* ── CARDS ── */
.a-card {
  background: var(--a-surface);
  border: 1px solid var(--a-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.a-card-title {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--a-muted);
  margin-bottom: 0.5rem;
}

/* ── STAT CARDS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--a-surface);
  border: 1px solid var(--a-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.stat-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-card-icon svg { width: 22px; height: 22px; }
.icon-verde  { background: rgba(91,168,60,.15); color: var(--a-verde); }
.icon-ocre   { background: rgba(232,168,48,.15); color: var(--a-ocre); }
.icon-terra  { background: rgba(212,98,42,.15); color: var(--a-terra); }
.icon-azul   { background: rgba(91,155,213,.15); color: var(--a-azul); }
.stat-card-info .value {
  font-size: 1.75rem;
  font-weight: 700;
  font-family: 'Playfair Display', serif;
  line-height: 1;
}
.stat-card-info .title {
  font-size: 0.75rem;
  color: var(--a-muted);
  margin-top: 0.2rem;
}

/* ── TABLES ── */
.a-table-wrap { overflow-x: auto; }
.a-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.a-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--a-muted);
  border-bottom: 1px solid var(--a-border);
  white-space: nowrap;
}
.a-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.04);
  vertical-align: middle;
}
.a-table tr:last-child td { border-bottom: none; }
.a-table tr:hover td { background: rgba(255,255,255,.02); }
.a-table .col-actions { width: 1px; white-space: nowrap; }

/* ── BUTTONS ── */
.a-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: 'Raleway', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}
.a-btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.a-btn-primary   { background: var(--a-verde); color: white; }
.a-btn-secondary { background: var(--a-surface2); color: var(--a-text); border-color: var(--a-border); }
.a-btn-danger    { background: rgba(224,80,80,.15); color: var(--a-danger); border-color: rgba(224,80,80,.25); }
.a-btn-success   { background: rgba(91,168,60,.15); color: var(--a-success); border-color: rgba(91,168,60,.25); }
.a-btn-warning   { background: rgba(232,168,48,.15); color: var(--a-ocre); border-color: rgba(232,168,48,.25); }
.a-btn-sm { font-size: 0.72rem; padding: 0.35rem 0.75rem; }

.a-btn-primary:hover   { background: #4a9030; color: white; }
.a-btn-secondary:hover { background: var(--a-surface2); border-color: rgba(255,255,255,.15); color: var(--a-text); }
.a-btn-danger:hover    { background: var(--a-danger); color: white; }
.a-btn-success:hover   { background: var(--a-success); color: white; }
.a-btn-warning:hover   { background: var(--a-ocre); color: var(--a-bg); }

/* ── FORMS ── */
.a-form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
}
.a-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--a-muted);
}
.a-input, .a-select, .a-textarea {
  font-family: 'Raleway', sans-serif;
  font-size: 0.875rem;
  color: var(--a-text);
  background: rgba(255,255,255,.05);
  border: 1px solid var(--a-border);
  border-radius: var(--radius);
  padding: 0.625rem 0.875rem;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.a-input:focus, .a-select:focus, .a-textarea:focus {
  outline: none;
  border-color: var(--a-verde);
  box-shadow: 0 0 0 3px rgba(91,168,60,.15);
}
.a-select option { background: var(--a-surface); }
.a-textarea { resize: vertical; min-height: 100px; }

.a-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.a-full { grid-column: 1 / -1; }

/* ── UPLOAD ZONE ── */
.upload-zone {
  border: 2px dashed var(--a-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--a-muted);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--a-verde);
  background: rgba(91,168,60,.05);
  color: var(--a-verde);
}
.upload-zone input[type="file"] { display: none; }
.upload-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.upload-zone p { font-size: 0.85rem; }
.upload-zone strong { color: var(--a-verde); }

/* ── IMAGE PREVIEW ── */
.img-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}
.img-preview-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--a-surface2);
}
.img-preview-item img { width: 100%; height: 100%; object-fit: cover; }
.img-preview-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,.7);
  color: white;
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── BADGES ── */
.a-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: 50px;
}
.a-badge-pending  { background: rgba(232,168,48,.15); color: var(--a-ocre); }
.a-badge-approved { background: rgba(91,168,60,.15); color: var(--a-verde); }
.a-badge-rejected { background: rgba(224,80,80,.15); color: var(--a-danger); }
.a-badge-ingreso  { background: rgba(91,168,60,.15); color: var(--a-verde); }
.a-badge-gasto    { background: rgba(212,98,42,.15); color: var(--a-terra); }
.a-badge-published   { background: rgba(91,168,60,.15); color: var(--a-verde); }
.a-badge-draft    { background: rgba(255,255,255,.08); color: var(--a-muted); }

/* ── MODALS ── */
.a-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.a-modal-overlay.open { opacity: 1; pointer-events: all; }
.a-modal {
  background: var(--a-surface);
  border: 1px solid var(--a-border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  transform: scale(0.95);
  transition: transform var(--transition);
}
.a-modal-overlay.open .a-modal { transform: scale(1); }
.a-modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--a-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.a-modal-header h3 { font-family: 'Playfair Display', serif; font-size: 1.1rem; }
.a-modal-close {
  background: none;
  border: none;
  color: var(--a-muted);
  cursor: pointer;
  font-size: 1.25rem;
  transition: color var(--transition);
}
.a-modal-close:hover { color: var(--a-text); }
.a-modal-body { padding: 1.5rem; }
.a-modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--a-border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ── NOTICES ── */
.a-notice {
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
  border-left: 3px solid;
}
.a-notice-success { background: rgba(91,168,60,.1); color: var(--a-verde); border-color: var(--a-verde); }
.a-notice-error   { background: rgba(224,80,80,.1); color: var(--a-danger); border-color: var(--a-danger); }
.a-notice-info    { background: rgba(91,155,213,.1); color: var(--a-azul); border-color: var(--a-azul); }

/* ── SECTION HEADER ── */
.a-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.a-section-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--a-text);
}

/* ── LOGIN PAGE ── */
.admin-login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--a-bg);
  padding: 1.5rem;
  background-image: radial-gradient(ellipse at 20% 80%, rgba(45,90,27,.3) 0%, transparent 60%),
                    radial-gradient(ellipse at 80% 20%, rgba(184,77,30,.15) 0%, transparent 60%);
}
.login-card {
  background: var(--a-surface);
  border: 1px solid var(--a-border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}
.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.login-logo img { width: 70px; height: 70px; object-fit: contain; margin: 0 auto 1rem; }
.login-logo h1 {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  color: var(--a-text);
}
.login-logo p { font-size: 0.8rem; color: var(--a-ocre); letter-spacing: 0.1em; }

/* ── TOGGLE SWITCH ── */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}
.toggle-input { display: none; }
.toggle-label {
  width: 40px;
  height: 22px;
  background: rgba(255,255,255,.1);
  border-radius: 50px;
  cursor: pointer;
  position: relative;
  transition: background var(--transition);
  flex-shrink: 0;
}
.toggle-label::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition);
}
.toggle-input:checked + .toggle-label { background: var(--a-verde); }
.toggle-input:checked + .toggle-label::after { transform: translateX(18px); }

/* ── FILTERS BAR ── */
.a-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  align-items: center;
}
.a-filter-btn {
  font-family: 'Raleway', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 0.375rem 0.875rem;
  border: 1px solid var(--a-border);
  background: transparent;
  color: var(--a-muted);
  border-radius: 50px;
  cursor: pointer;
  transition: all var(--transition);
}
.a-filter-btn:hover, .a-filter-btn.active {
  background: var(--a-verde);
  border-color: var(--a-verde);
  color: white;
}

/* ── CONFIRM DIALOG ── */
.confirm-msg {
  font-size: 0.9rem;
  color: var(--a-text);
  line-height: 1.6;
  padding: 0.5rem 0;
}

/* ── MOBILE SIDEBAR ── */
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--a-text);
  cursor: pointer;
  padding: 0.5rem;
}
.sidebar-toggle svg { width: 22px; height: 22px; }

@media (max-width: 900px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    bottom: 0;
    z-index: 200;
    transition: left var(--transition);
    box-shadow: none;
  }
  .admin-sidebar.open {
    left: 0;
    box-shadow: var(--shadow);
  }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 199;
  }
  .sidebar-overlay.open { display: block; }
  .sidebar-toggle { display: flex; }
  .admin-content { padding: 1.25rem; }
  .a-form-grid { grid-template-columns: 1fr; }
}
