/* ══════════════════════════════════════════════════════
   TWD ADMIN PANEL — Stylesheet
   Navy #1A2B4C  |  Gold #C5944E
   ══════════════════════════════════════════════════════ */

:root {
  --navy:       #1A2B4C;
  --gold:       #C5944E;
  --gold-soft:  rgba(197, 148, 78, 0.12);
  --red:        #c0392b;
  --green:      #27ae60;
  --bg:         #f0f2f7;
  --card-bg:    #ffffff;
  --border:     #dce3ef;
  --text:       #1e2535;
  --muted:      #6b7a99;
}

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

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}


/* ══════════════════════════════════════════════════════
   App bar
   ══════════════════════════════════════════════════════ */
#admin-bar {
  background: var(--navy);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
  position: sticky;
  top: 0;
  z-index: 100;
}

.bar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.admin-logo {
  height: 36px;
  width: auto;
  display: block;
}
.bar-divider {
  color: rgba(255,255,255,0.2);
  font-weight: 300;
}
.bar-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
}

.bar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bar-link {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gold);
  text-decoration: none;
  padding: 5px 14px;
  border: 1px solid rgba(197,148,78,0.4);
  border-radius: 5px;
  background: transparent;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
  white-space: nowrap;
}
.bar-link:hover {
  background: rgba(197,148,78,0.1);
  border-color: var(--gold);
}
.bar-link[hidden] { display: none; }


/* ══════════════════════════════════════════════════════
   Login screen
   ══════════════════════════════════════════════════════ */
.login-screen {
  min-height: calc(100vh - 61px); /* viewport minus #admin-bar */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-screen[hidden] { display: none; }

.login-card {
  width: 100%;
  max-width: 360px;
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.login-logo { height: 44px; width: auto; }
.login-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: 0.02em;
}
.login-sub {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  margin-top: -8px;
}
.login-card .field { width: 100%; }
.login-submit { width: 100%; justify-content: center; margin-top: 4px; }


/* ══════════════════════════════════════════════════════
   Layout
   ══════════════════════════════════════════════════════ */
.admin-main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 20px 56px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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


/* ══════════════════════════════════════════════════════
   Card
   ══════════════════════════════════════════════════════ */
.card {
  background: var(--card-bg);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.card--full { grid-column: 1 / -1; }

/* Navy header strip — mirrors .producto-header from style.css */
.card-head {
  background: var(--navy);
  padding: 9px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #fff;
  flex: 1;
}
.head-count {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.5);
  font-weight: 600;
  white-space: nowrap;
}
/* Gold accent — mirrors .gold-accent from style.css */
.head-accent {
  height: 4px;
  width: 32px;
  background: var(--gold);
  border-radius: 2px;
  flex: 0 0 auto;
}


/* ══════════════════════════════════════════════════════
   Form
   ══════════════════════════════════════════════════════ */
.form,
.iframe-section {
  padding: 20px 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: 0.02em;
}
.req { color: var(--gold); }

input[type="text"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 0.84rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(26,43,76,0.08);
}
input.invalid,
textarea.invalid {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(192,57,43,0.08);
}
textarea { resize: vertical; line-height: 1.5; }

input[type="file"] {
  width: 100%;
  padding: 7px 9px;
  border: 1.5px dashed var(--border);
  border-radius: 6px;
  font-size: 0.8rem;
  font-family: inherit;
  color: var(--muted);
  background: #f8f9fc;
  cursor: pointer;
}
input[type="file"].invalid { border-color: var(--red); }

.img-preview {
  width: 96px;
  height: 96px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
}
.img-preview[hidden] { display: none; }
.img-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Feedback messages */
.form-error,
.form-success {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 6px;
}
.form-error {
  color: var(--red);
  background: rgba(192,57,43,0.07);
  border: 1px solid rgba(192,57,43,0.2);
}
.form-success {
  color: var(--green);
  background: rgba(39,174,96,0.07);
  border: 1px solid rgba(39,174,96,0.25);
}
.form-error[hidden],
.form-success[hidden] { display: none; }


/* ══════════════════════════════════════════════════════
   Buttons
   ══════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 20px;
  border-radius: 6px;
  border: none;
  font-size: 0.84rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: opacity 0.18s, transform 0.1s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }

.btn-navy {
  background: var(--navy);
  color: #fff;
}
.btn-navy:hover { opacity: 0.85; }

.btn-gold {
  background: var(--gold);
  color: #fff;
}
.btn-gold:hover { opacity: 0.85; }


/* ══════════════════════════════════════════════════════
   iFrame section
   ══════════════════════════════════════════════════════ */
/* Monospace textarea for the embed code */
.code-box {
  font-family: 'Courier New', 'Consolas', monospace;
  font-size: 0.76rem;
  line-height: 1.6;
  background: #f5f7fc;
  color: var(--navy);
  border-color: #c8d0e0;
  resize: none;
  tab-size: 2;
}

.iframe-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* "✓ Copiado" toast */
.copy-toast {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--green);
  animation: toast-pop 0.22s ease;
}
.copy-toast[hidden] { display: none; }

@keyframes toast-pop {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

.iframe-hint {
  font-size: 0.74rem;
  color: var(--muted);
  line-height: 1.6;
  padding: 12px 14px;
  background: #f8f9fc;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.iframe-hint strong { color: var(--navy); }
.iframe-hint code {
  font-family: 'Courier New', monospace;
  font-size: 0.85em;
  background: rgba(26,43,76,0.06);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--navy);
}


/* ══════════════════════════════════════════════════════
   Products table
   ══════════════════════════════════════════════════════ */
.table-wrap {
  overflow-x: auto;
}

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

th {
  background: #f4f6fb;
  color: var(--navy);
  font-weight: 700;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8f9fc; }

.td-name {
  font-weight: 700;
  font-size: 0.74rem;
  color: var(--navy);
  text-transform: uppercase;
  max-width: 220px;
}
.td-price {
  font-weight: 600;
  color: var(--navy);
  white-space: nowrap;
  font-size: 0.76rem;
}
.td-img a {
  font-size: 0.72rem;
  color: var(--gold);
  text-decoration: none;
  font-weight: 600;
}
.td-img a:hover { text-decoration: underline; }
.td-none { color: #c0c8d8; }

/* Delete row button */
.btn-delete {
  padding: 3px 10px;
  font-size: 0.68rem;
  font-weight: 700;
  font-family: inherit;
  color: var(--red);
  background: rgba(192,57,43,0.07);
  border: 1px solid rgba(192,57,43,0.2);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.btn-delete:hover { background: rgba(192,57,43,0.14); }

.row-loading td {
  text-align: center;
  color: var(--muted);
  padding: 28px;
  font-style: italic;
  font-size: 0.82rem;
}


/* ══════════════════════════════════════════════════════
   Responsive
   ══════════════════════════════════════════════════════ */
@media (max-width: 720px) {
  .admin-grid { grid-template-columns: 1fr; }
  .card--full { grid-column: 1; }
  #admin-bar  { padding: 10px 16px; }
  .admin-main { padding: 18px 14px 40px; gap: 18px; }
}
