/* ============================================================
   Gift Cards Manager — Tema PREMIUM (Negro + Dorado)
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600;700&family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* Dorados */
  --gold:        #c9a24b;
  --gold-bright: #e7c977;
  --gold-soft:   #f4e3b8;
  --gold-deep:   #a07d2e;
  --gold-grad:   linear-gradient(135deg, #e7c977 0%, #c9a24b 45%, #a07d2e 100%);

  /* Negros / superficies */
  --ink:         #0a0a0c;   /* fondo más profundo */
  --ink-2:       #111114;   /* fondo app */
  --panel:       #16161a;   /* superficie de tarjetas */
  --panel-2:     #1c1c22;   /* superficie elevada */
  --panel-3:     #232329;   /* hover / inputs */
  --line:        rgba(201,162,75,.16);   /* bordes dorados sutiles */
  --line-soft:   rgba(255,255,255,.07);

  /* Texto */
  --text:        #f4f1ea;
  --text-muted:  #9a958c;
  --text-dim:    #6f6a61;

  --sidebar-w: 264px;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 10px 30px rgba(0,0,0,.45), 0 2px 8px rgba(0,0,0,.35);
  --shadow-gold: 0 8px 26px rgba(201,162,75,.28);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(1100px 600px at 85% -5%, rgba(201,162,75,.10), transparent 60%),
    radial-gradient(900px 500px at -5% 110%, rgba(201,162,75,.06), transparent 55%),
    var(--ink-2);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3,h4 { font-family: 'Cormorant Garamond', Georgia, serif; letter-spacing: .3px; }
a { color: var(--gold-bright); text-decoration: none; transition: color .15s; }
a:hover { color: var(--gold-soft); text-decoration: none; }

::selection { background: rgba(201,162,75,.3); color: #fff; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb { background: #2c2c33; border-radius: 8px; border: 2px solid var(--ink); }
::-webkit-scrollbar-thumb:hover { background: var(--gold-deep); }

/* ===== Layout ===== */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(185deg, #0d0d10 0%, #08080a 100%);
  border-right: 1px solid var(--line);
  color: var(--text);
  display: flex; flex-direction: column;
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 40;
  transition: transform .28s cubic-bezier(.4,0,.2,1);
}
.sidebar__brand {
  padding: 26px 22px 22px;
  display: flex; align-items: center; justify-content: center; gap: 13px;
  border-bottom: 1px solid var(--line);
}
.sidebar__brand img { max-height: 48px; max-width: 180px; filter: drop-shadow(0 2px 8px rgba(0,0,0,.6)); }
.sidebar__brand-name {
  font-family: 'Cormorant Garamond', serif; font-weight: 700; font-size: 20px;
  background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sidebar__nav { padding: 16px 14px; flex: 1; overflow-y: auto; }
.sidebar__section { font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--text-dim); padding: 14px 14px 8px; }
.nav-link {
  display: flex; align-items: center; gap: 13px;
  padding: 11px 14px; margin-bottom: 3px;
  border-radius: var(--radius-sm); color: var(--text-muted); font-weight: 500; font-size: 14.5px;
  position: relative; transition: all .18s;
}
.nav-link:hover { background: rgba(255,255,255,.04); color: var(--text); }
.nav-link.active {
  background: linear-gradient(90deg, rgba(201,162,75,.18), rgba(201,162,75,.04));
  color: var(--gold-soft);
}
.nav-link.active::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  background: var(--gold-grad); border-radius: 0 4px 4px 0;
}
.nav-link .ico { width: 22px; text-align: center; font-size: 16px; opacity: .9; }
.sidebar__footer { padding: 14px; border-top: 1px solid var(--line); }
.sidebar__user { font-size: 13px; color: var(--text-muted); padding: 6px 12px 12px; }
.sidebar__user b { color: var(--text); font-weight: 600; }

.content { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }
.topbar {
  display: none; align-items: center; gap: 12px;
  padding: 12px 16px; background: rgba(13,13,16,.85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30;
}
.topbar__toggle { background: var(--gold-grad); color: #1a1407; border: 0; width: 42px; height: 42px; border-radius: 11px; font-size: 18px; cursor: pointer; font-weight: 700; }
.main { padding: 32px; max-width: 1240px; width: 100%; margin: 0 auto; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head h1 { font-size: 34px; margin: 0; font-weight: 700; line-height: 1.1; }
.page-head .subtitle { color: var(--text-muted); margin: 6px 0 0; font-size: 14.5px; }

/* Hairline dorada decorativa bajo títulos de página */
.page-head h1::after {
  content: ''; display: block; width: 54px; height: 2px; margin-top: 10px;
  background: var(--gold-grad); border-radius: 2px;
}

/* ===== Cards ===== */
.card {
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card__body { padding: 22px; }
.card__header {
  padding: 16px 22px; border-bottom: 1px solid var(--line);
  font-family: 'Cormorant Garamond', serif; font-weight: 600; font-size: 19px; color: var(--gold-soft);
}

.grid { display: grid; gap: 18px; }
.grid-stats { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

/* ===== Stats ===== */
.stat {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow); transition: transform .2s, border-color .2s;
}
.stat:hover { transform: translateY(-3px); border-color: rgba(201,162,75,.4); }
.stat::after {
  content: ''; position: absolute; top: -40px; right: -40px; width: 120px; height: 120px;
  background: radial-gradient(circle, rgba(201,162,75,.12), transparent 70%);
}
.stat__label { color: var(--text-muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.stat__value { font-family: 'Cormorant Garamond', serif; font-size: 36px; font-weight: 700; margin-top: 4px; color: var(--text); line-height: 1; }
.stat--accent .stat__value { background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat--money .stat__value { color: var(--gold-bright); }

/* ===== Badges ===== */
.badge {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .03em; white-space: nowrap;
  border: 1px solid transparent;
}
.badge-active    { background: rgba(34,197,94,.14);  color: #6ee79f; border-color: rgba(34,197,94,.3); }
.badge-pending   { background: rgba(234,179,8,.14);  color: #f5d469; border-color: rgba(234,179,8,.3); }
.badge-partial   { background: rgba(59,130,246,.14); color: #80b3ff; border-color: rgba(59,130,246,.3); }
.badge-used      { background: rgba(255,255,255,.07); color: #b9b4aa; border-color: rgba(255,255,255,.14); }
.badge-expired   { background: rgba(239,68,68,.14);  color: #ff9d9d; border-color: rgba(239,68,68,.3); }
.badge-cancelled { background: rgba(0,0,0,.5);       color: #8a8580; border-color: rgba(255,255,255,.12); }

/* ===== Botones ===== */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 11px 18px; border-radius: var(--radius-sm); font-weight: 600; font-size: 14px;
  border: 1px solid transparent; cursor: pointer; transition: all .18s; font-family: 'Inter', sans-serif;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--gold-grad); color: #1a1407; box-shadow: var(--shadow-gold); }
.btn-primary:hover { color: #1a1407; box-shadow: 0 10px 30px rgba(201,162,75,.42); }
.btn-accent { background: var(--gold-grad); color: #1a1407; }
.btn-success { background: linear-gradient(135deg, #1f9d57, #14823f); color: #fff; }
.btn-danger { background: linear-gradient(135deg, #d6453f, #b3322d); color: #fff; }
.btn-dark { background: var(--panel-3); color: var(--text); border-color: var(--line); }
.btn-outline { background: rgba(255,255,255,.02); color: var(--text); border-color: var(--line); }
.btn-outline:hover { background: rgba(201,162,75,.1); border-color: var(--gold-deep); color: var(--gold-soft); }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ===== Formularios ===== */
.form-group { margin-bottom: 17px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 7px; font-size: 13px; color: var(--text-muted); letter-spacing: .02em; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); font-size: 14.5px; background: var(--panel-3); color: var(--text);
  font-family: inherit; transition: all .18s;
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-dim); }
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--gold-deep); background: #26262d;
  box-shadow: 0 0 0 3px rgba(201,162,75,.16);
}
.form-select option { background: var(--panel-2); color: var(--text); }
.form-color { width: 58px; height: 42px; padding: 3px; border: 1px solid var(--line-soft); border-radius: 9px; background: var(--panel-3); cursor: pointer; }
.form-help { color: var(--text-dim); font-size: 12px; margin-top: 5px; }
.form-error { color: #ff9d9d; font-size: 13px; margin-top: 5px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ===== Tablas ===== */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { padding: 13px 14px; text-align: left; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
table.data th { background: rgba(0,0,0,.25); font-weight: 700; color: var(--text-dim); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
table.data tbody tr { transition: background .15s; }
table.data tbody tr:hover { background: rgba(201,162,75,.05); }
table.data tbody tr:last-child td { border-bottom: none; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-weight: 700; color: var(--gold-bright); letter-spacing: .5px; }

/* Fechas apiladas (creación + vencimiento) */
.col-dates { line-height: 1.3; }
.col-dates .date-main { display: block; color: var(--text); }
.col-dates .date-exp { display: block; font-size: 11.5px; color: var(--text-dim); }

/* Columna de acciones fija a la derecha (no se corta nunca) */
.col-actions { position: sticky; right: 0; text-align: right; padding-left: 18px; }
table.data td.col-actions {
  background: linear-gradient(90deg, transparent, var(--panel) 18%);
}
table.data tbody tr:hover td.col-actions {
  background: linear-gradient(90deg, transparent, #1a1a1f 18%);
}
table.data th.col-actions { background: var(--ink); }
.actions { display: inline-flex; gap: 7px; justify-content: flex-end; }
.actions form { display: inline-flex; margin: 0; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 9px; font-size: 15px;
  border: 1px solid var(--line); background: var(--panel-3); color: var(--text);
  cursor: pointer; transition: all .15s; line-height: 1; padding: 0;
}
.icon-btn:hover { transform: translateY(-1px); border-color: var(--gold-deep); background: rgba(201,162,75,.12); color: var(--gold-soft); text-decoration: none; }
.icon-success { color: #6ee79f; }
.icon-success:hover { background: rgba(34,197,94,.16); border-color: rgba(34,197,94,.5); color: #8af0b3; }
.icon-danger { color: #ff9d9d; }
.icon-danger:hover { background: rgba(239,68,68,.16); border-color: rgba(239,68,68,.5); color: #ffb8b8; }

/* ===== Filtros ===== */
.filters { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: 12px; align-items: end; }

/* ===== Mensajes ===== */
.messages { margin-bottom: 20px; display: flex; flex-direction: column; gap: 10px; }
.alert { padding: 13px 17px; border-radius: var(--radius-sm); font-weight: 500; border: 1px solid transparent; backdrop-filter: blur(4px); }
.alert-success { background: rgba(34,197,94,.12); color: #7eeaa9; border-color: rgba(34,197,94,.3); }
.alert-error, .alert-danger { background: rgba(239,68,68,.12); color: #ffa3a3; border-color: rgba(239,68,68,.3); }
.alert-warning { background: rgba(234,179,8,.12); color: #f3d572; border-color: rgba(234,179,8,.3); }
.alert-info { background: rgba(201,162,75,.1); color: var(--gold-soft); border-color: var(--line); }

/* ===== Code display ===== */
.code-display {
  font-family: ui-monospace, monospace; font-size: 34px; font-weight: 800;
  letter-spacing: 3px; color: var(--gold-bright);
  background: linear-gradient(180deg, #0d0d10, #131316);
  padding: 20px 24px; border-radius: 14px; border: 1.5px dashed var(--gold-deep);
  text-align: center; word-break: break-all; box-shadow: inset 0 0 30px rgba(201,162,75,.06);
}

/* ===== Detalle ===== */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 16px; }
.detail-item .k { color: var(--text-dim); font-size: 11px; text-transform: uppercase; font-weight: 700; letter-spacing: .06em; }
.detail-item .v { font-size: 16px; margin-top: 3px; color: var(--text); }

/* ===== Pagination ===== */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: 8px 13px; border-radius: 9px; border: 1px solid var(--line-soft); background: var(--panel-2); font-size: 14px; color: var(--text-muted);
}
.pagination a:hover { border-color: var(--gold-deep); color: var(--gold-soft); }
.pagination .current { background: var(--gold-grad); color: #1a1407; border-color: transparent; font-weight: 700; }

/* ===== Login ===== */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background:
    radial-gradient(900px 500px at 50% -10%, rgba(201,162,75,.18), transparent 60%),
    radial-gradient(700px 500px at 50% 120%, rgba(201,162,75,.08), transparent 60%),
    var(--ink);
}
.login-card {
  background: linear-gradient(180deg, var(--panel) 0%, #0e0e11 100%);
  border: 1px solid var(--line);
  border-radius: 22px; padding: 38px; width: 100%; max-width: 410px;
  box-shadow: 0 30px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(201,162,75,.05), inset 0 1px 0 rgba(255,255,255,.04);
  position: relative;
}
.login-card::before {
  content: ''; position: absolute; inset: 0; border-radius: 22px; padding: 1px;
  background: linear-gradient(160deg, rgba(201,162,75,.5), transparent 40%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none;
}
.login-card h1 { margin: 0 0 6px; font-size: 28px; text-align: center; color: var(--gold-soft); }
.login-card .sub { color: var(--text-muted); text-align: center; margin: 0 0 26px; font-size: 13.5px; letter-spacing: .04em; }
.login-logo {
  text-align: center; margin: 0 0 24px; padding: 26px;
  background: radial-gradient(circle at 50% 0%, rgba(201,162,75,.14), transparent 70%), linear-gradient(180deg,#0d0d10,#08080a);
  border: 1px solid var(--line); border-radius: 16px;
}
.login-logo img { max-height: 66px; max-width: 210px; filter: drop-shadow(0 4px 12px rgba(0,0,0,.6)); }

.empty { text-align: center; color: var(--text-dim); padding: 46px 20px; font-style: italic; }

.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; } .mt-4 { margin-top: 26px; }
.mb-0 { margin-bottom: 0; }
.flex { display: flex; gap: 10px; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 60px rgba(0,0,0,.7); }
  .content { margin-left: 0; }
  .topbar { display: flex; }
  .main { padding: 22px 18px; }
  .page-head h1 { font-size: 28px; }
  .filters { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .sidebar-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 35; display: none; }
  .sidebar-backdrop.show { display: block; }
}
