/* ═══════════════════════════════════════════════════════════════════════════
   Panel admin – Mechi y Javi
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --cream:       #F6EFE3;
  --cream-dark:  #EDE0CC;
  --sepia:       #4A3B2C;
  --sepia-light: #7A6555;
  --tan:         #B08D6B;
  --coral:       #E58F7B;
  --white:       #FFFFFF;
  --success:     #4caf50;
  --danger:      #e53935;
  --font-serif:  'Cormorant Garamond', Georgia, serif;
  --radius:      8px;
  --shadow:      0 2px 12px rgba(74,59,44,.1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  background: #f0e8da;
  color: var(--sepia);
  font-family: system-ui, -apple-system, sans-serif;
  font-size: .95rem;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--tan); text-decoration: none; }
a:hover { color: var(--sepia); }
:focus-visible { outline: 2px solid var(--coral); outline-offset: 3px; }

/* ─── Layout ──────────────────────────────────────────────────────────────── */
.panel-wrap { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--sepia);
  color: var(--cream);
  display: flex; flex-direction: column;
  padding: 1.5rem 1rem;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-logo {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  color: var(--cream);
  margin-bottom: 2rem;
  line-height: 1.2;
}
.sidebar-logo small { display: block; font-size: .7rem; opacity: .6; letter-spacing: .06em; text-transform: uppercase; }
.sidebar-nav { flex: 1; }
.sidebar-nav a {
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem .75rem;
  border-radius: 6px;
  color: rgba(246,239,227,.8);
  font-size: .875rem;
  margin-bottom: .25rem;
  transition: all .2s;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
  background: rgba(255,255,255,.1);
  color: var(--cream);
}
.sidebar-nav a.active { background: rgba(176,141,107,.3); color: var(--cream); }
.sidebar-footer { margin-top: auto; font-size: .78rem; opacity: .5; }
.sidebar-footer a { color: rgba(246,239,227,.6); }

.main-content {
  flex: 1; padding: 2rem;
  max-width: 1100px;
  width: 100%;
  overflow-x: hidden;
}

/* ─── Top bar ─────────────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap; gap: .75rem;
}
.topbar-title {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--sepia);
}

/* ─── Cards / stats ───────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  text-align: center;
}
.stat-num {
  font-family: var(--font-serif);
  font-size: 2.5rem;
  font-weight: 600;
  color: var(--sepia);
  line-height: 1;
}
.stat-label {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--sepia-light);
  margin-top: .3rem;
}

/* ─── Table ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--cream-dark);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .5rem;
}
.card-header-title { font-weight: 600; font-size: 1rem; color: var(--sepia); }
.card-body { padding: 1.25rem; }

.table-wrap { overflow-x: auto; }
table {
  width: 100%; border-collapse: collapse;
  font-size: .88rem;
}
thead { background: var(--cream); }
th {
  text-align: left; padding: .65rem .75rem;
  font-size: .75rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--sepia-light); font-weight: 600; white-space: nowrap;
  border-bottom: 1.5px solid var(--cream-dark);
  cursor: pointer; user-select: none;
}
th:hover { color: var(--sepia); }
td {
  padding: .7rem .75rem;
  border-bottom: 1px solid var(--cream-dark);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(246,239,227,.4); }

.badge {
  display: inline-block; padding: .2em .6em;
  border-radius: 99px; font-size: .75rem; font-weight: 600;
}
.badge-yes  { background: #e8f5e9; color: #2e7d32; }
.badge-no   { background: #fbe9e7; color: #c62828; }
.badge-mail { background: #e3f2fd; color: #1565c0; }
.badge-warn { background: #fff3e0; color: #e65100; }

/* ─── Forms ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .35rem; color: var(--sepia); }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: .55rem .8rem;
  border: 1.5px solid var(--cream-dark);
  border-radius: 6px; background: var(--white);
  font-size: .9rem; color: var(--sepia);
  transition: border-color .2s;
  -webkit-appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--tan);
  box-shadow: 0 0 0 3px rgba(176,141,107,.15);
}
.form-inline { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-end; }
.form-inline .form-group { flex: 1; min-width: 160px; margin: 0; }

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1.1rem; border-radius: 6px;
  font-size: .875rem; font-weight: 600; cursor: pointer;
  border: none; transition: all .2s; text-decoration: none;
  min-height: 36px;
}
.btn-primary  { background: var(--sepia); color: var(--white); }
.btn-primary:hover { background: var(--sepia-light); color: var(--white); }
.btn-outline  { background: transparent; border: 1.5px solid var(--cream-dark); color: var(--sepia); }
.btn-outline:hover { border-color: var(--tan); color: var(--tan); }
.btn-danger   { background: var(--danger); color: var(--white); }
.btn-danger:hover { opacity: .85; }
.btn-success  { background: var(--success); color: var(--white); }
.btn-sm { padding: .35rem .75rem; font-size: .8rem; min-height: 30px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ─── Alert ───────────────────────────────────────────────────────────────── */
.alert {
  padding: .75rem 1rem; border-radius: 6px;
  margin-bottom: 1rem; font-size: .9rem;
}
.alert-success { background: #e8f5e9; color: #2e7d32; border-left: 4px solid #4caf50; }
.alert-error   { background: #fbe9e7; color: #c62828; border-left: 4px solid #e53935; }
.alert-info    { background: #e3f2fd; color: #1565c0; border-left: 4px solid #1e88e5; }

/* ─── Login page ──────────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center;
  background: var(--cream);
  padding: 1rem;
}
.login-card {
  background: var(--white); width: min(400px,100%);
  border-radius: var(--radius); padding: 2.5rem 2rem;
  box-shadow: var(--shadow);
  text-align: center;
}
.login-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.8rem; font-weight: 600;
  color: var(--sepia); margin-bottom: 1.5rem;
}
.login-sub { font-size: .85rem; color: var(--sepia-light); margin-bottom: 1.5rem; }

/* ─── Pagination ──────────────────────────────────────────────────────────── */
.pagination { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.page-btn {
  padding: .35rem .7rem; border-radius: 5px;
  border: 1.5px solid var(--cream-dark); background: var(--white);
  font-size: .82rem; cursor: pointer; transition: all .2s;
  color: var(--sepia); text-decoration: none;
}
.page-btn:hover, .page-btn.active {
  border-color: var(--tan); background: var(--tan); color: var(--white);
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .panel-wrap { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: static;
    flex-direction: row; flex-wrap: wrap;
    padding: .75rem 1rem; gap: .5rem;
    align-items: center;
  }
  .sidebar-logo { margin-bottom: 0; font-size: 1.1rem; flex: 1; }
  .sidebar-nav { display: flex; gap: .25rem; flex-wrap: wrap; }
  .sidebar-nav a { padding: .35rem .6rem; font-size: .8rem; margin: 0; }
  .sidebar-footer { display: none; }
  .main-content { padding: 1rem; }
}

/* ─── Confirm dialog ──────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
  opacity: 0; visibility: hidden; transition: .2s;
}
.modal-backdrop.open { opacity: 1; visibility: visible; }
.modal {
  background: var(--white); border-radius: var(--radius);
  padding: 1.5rem; max-width: 400px; width: 100%;
  box-shadow: var(--shadow); transform: scale(.95); transition: transform .2s;
}
.modal-backdrop.open .modal { transform: scale(1); }
.modal-title { font-size: 1.1rem; font-weight: 600; margin-bottom: .75rem; }
.modal-body  { font-size: .9rem; color: var(--sepia-light); margin-bottom: 1.25rem; }
.modal-actions { display: flex; gap: .75rem; justify-content: flex-end; }
