/* =========================================================
   UNAMCA Utils — Estilo minimalista tipo Apple
   ========================================================= */

/* -------- Reset & base -------- */
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #f5f5f7;               /* gris Apple */
  color: #1d1d1f;                     /* casi negro */
  line-height: 1.6;
}
:root{
  --surface: #ffffff;
  --muted: #6e6e73;
  --hairline: #d2d2d7;
  --soft: #e8e8ed;
  --soft-2: #f2f2f7;
  --primary: #0071e3;                 /* blue Apple */
  --primary-hover: #0077ed;
  --ring: rgba(0,113,227,0.18);
  --shadow-1: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-2: 0 8px 24px rgba(0,0,0,0.08);
  --radius: 14px;
}
h1, h2 {
  margin: 0 0 .6rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* -------- Layout -------- */
header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: saturate(180%) blur(12px);
  background: rgba(245,245,247,0.75);
  border-bottom: 1px solid var(--hairline);
  padding: 0.8rem 1rem;
  display: flex;
  align-items: center;
  gap: 12px;
}
header h1 { margin-right: auto; font-size: 1.1rem; }
header .tabs { display: flex; gap: 8px; flex-wrap: wrap; }
header #logout { margin-left: auto; }

main {
  padding: 24px 16px 32px;
  max-width: 980px;
  margin: 0 auto;
}
footer {
  text-align: center;
  padding: 1.25rem;
  font-size: .9rem;
  color: var(--muted);
}

/* -------- Tabs -------- */
nav button {
  margin: 0;
  padding: .5rem .9rem;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  font-size: .95rem;
  border-radius: 999px;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .12s ease;
  color: #1d1d1f;
}
nav button:hover { background: var(--soft-2); }
nav button.active {
  background: var(--soft);
  border-color: var(--hairline);
}

/* -------- Cards -------- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-1), var(--shadow-2);
  border: 1px solid rgba(0,0,0,0.04);
  transition: transform .18s ease, box-shadow .2s ease;
}
.card:hover { transform: translateY(-2px); }

/* -------- Forms -------- */
label {
  display: block;
  margin-bottom: .65rem;
  font-weight: 500;
}
input, select, textarea, .btn, button {
  font: inherit;
}
input, select, textarea {
  width: 100%;
  padding: .6rem .7rem;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: #fff;
  color: #1d1d1f;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 6px var(--ring);
}
textarea { min-height: 76px; resize: vertical; }

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* -------- Buttons -------- */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .6rem 1rem;
  font-size: .95rem;
  border-radius: 12px;
  border: 1px solid var(--hairline);
  background: #fff;
  color: #1d1d1f;
  cursor: pointer;
  transition: background .18s ease, box-shadow .18s ease, transform .12s ease, border-color .18s ease, color .18s ease;
  text-decoration: none;
  user-select: none;
}
button:hover, .btn:hover { background: var(--soft-2); }
button:active, .btn:active { transform: translateY(1px); }

button.primary, .btn.primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 6px 14px rgba(0,113,227,0.25);
}
button.primary:hover, .btn.primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

a[data-del], button[data-del] {
  color: #ff3b30;                 /* red Apple */
  text-decoration: none;
  font-size: 1rem;
  margin-left: .5rem;
  transition: opacity .18s ease, transform .12s ease;
}
a[data-del]:hover { opacity: .8; }

/* -------- Tabs switching -------- */
.tab { animation: fade .22s ease; }
@keyframes fade { from {opacity:0; transform: translateY(4px)} to {opacity:1; transform: none} }

/* -------- Preview -------- */
.preview {
  text-align: center;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--hairline);
  background: #fff;
}
.preview img, .preview object {
  max-width: 100%;
  max-height: 320px;
}
.svgbox { width: 220px; height: 220px; }

/* -------- Pills -------- */
.pill {
  display: inline-block;
  padding: .24rem .62rem;
  border-radius: 999px;
  background: #e9e9ec;
  color: #1d1d1f;
  font-size: .8rem;
  font-weight: 500;
  border: 1px solid var(--hairline);
}

/* -------- Tables -------- */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .92rem;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
}
thead th {
  background: #fafafc;
  color: #1d1d1f;
  font-weight: 600;
  border-bottom: 1px solid var(--hairline);
}
th, td {
  padding: .7rem .9rem;
  text-align: left;
  border-bottom: 1px solid #efeff4;
}
tbody tr:hover { background: #fbfbfe; }

/* -------- Logout overlay -------- */
#logout-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(245,245,247,0.6);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
}
.logout-modal{
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 20px;
  padding: 24px 28px;
  min-width: 280px;
  box-shadow: var(--shadow-2);
  text-align: center;
}
.logout-modal p { margin: 10px 0 4px; font-weight: 600; }
.spinner{
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 3px solid #e5e5ea;
  border-top-color: var(--primary);
  animation: spin 0.9s linear infinite;
  margin: 0 auto 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* -------- Small screens -------- */
@media (max-width: 720px){
  .row { grid-template-columns: 1fr; }
  header { flex-wrap: wrap; gap: 10px; }
  header #logout { width: 100%; order: 3; }
}
