/* ═══════════════════════════════════════════════════════════════
   FRONTAL — Admin Module Styles
   ───────────────────────────────────────────────────────────────
   Specific styles for the admin panel layout and views.
   Requires tokens.css and components.css to be loaded first.
═══════════════════════════════════════════════════════════════ */

/* ── LOGIN SCREEN ────────────────────────────────────────── */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-box {
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-logo {
  width: 220px;
  max-width: 100%;
  height: auto;
  margin-bottom: 48px;
  display: inline-block;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 28px;
}

@media (max-width: 480px) {
  .login-card {
    padding: 24px 18px;
  }
}

.login-card h2 {
  font-size: 1.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 28px;
  color: var(--text);
}

.login-error {
  color: var(--reservado);
  font-size: .85rem;
  min-height: 22px;
  margin-bottom: 12px;
}


/* ── ADMIN LAYOUT & HEADER ────────────────────────────────── */
#admin-app {
  display: none;
}

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8, 8, 8, .85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-logo {
  height: 22px;
}

.badge-admin {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  background: var(--accent);
  color: #000;
  padding: 3px 10px;
  border-radius: 4px;
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 7px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-logout:hover {
  border-color: var(--reservado);
  color: var(--reservado);
}

.main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

.main > h1 {
  font-size: 1.6rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 24px;
  color: var(--text);
}


/* ── DAYS GRID & CARDS ────────────────────────────────────── */
.days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 14px;
}

@media (max-width: 1300px) {
  .days-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    padding-bottom: 0;
    overflow-x: visible;
  }
}

.day-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
  min-height: 290px;
  transition: border-color var(--transition), transform var(--transition), opacity var(--transition);
}

@media (max-width: 1300px) {
  .day-card {
    flex: 0 0 220px;
    scroll-snap-align: start;
  }
}

.day-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

.day-card.inactive {
  opacity: .45;
}

.day-card.inactive:hover {
  opacity: .6;
}

.day-card-left {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: 100%;
}

.day-info {
  width: 100%;
}

.day-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.badge-hoy {
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .1em;
  background: var(--accent);
  color: #000;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.day-meta {
  font-size: .8rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.day-card-right {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin-top: auto;
  width: 100%;
}

.day-card-right .btn {
  width: 100%;
  justify-content: center;
  text-align: center;
  padding: 8px 12px;
  font-size: .78rem;
}

.day-card-right .toggle {
  align-self: center;
  margin-top: 6px;
}


/* ── TEMPLATE MODAL OPTIONS ──────────────────────────────── */
.template-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.template-opt {
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  cursor: pointer;
  transition: all var(--transition);
}

.template-opt:hover {
  border-color: var(--text-muted);
}

.template-opt.selected {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.template-opt-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.template-opt-desc {
  font-size: .8rem;
  color: var(--text-dim);
  margin-top: 3px;
}

.template-preview {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .85rem;
  color: var(--accent);
  margin-top: 6px;
}

.custom-fields {
  display: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin-bottom: 20px;
}

.custom-fields.active {
  display: block;
}

.custom-fields .field {
  margin-bottom: 14px;
}

.custom-fields .field:last-child {
  margin-bottom: 0;
}

.custom-fields input {
  padding: 10px 12px;
}

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

.custom-grid .field {
  margin-bottom: 0;
}

.modal-warning {
  font-size: .8rem;
  color: var(--senado);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}


/* ── SLOTS EDITOR (DRAWER MODAL) ────────────────────────── */
.slots-drawer {
  max-width: 680px !important;
  width: 90% !important;
  background: var(--surface) !important;
  border-left: 1px solid var(--border) !important;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
  animation: drawerIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes drawerIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.slots-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-top: 10px;
}

.slots-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.slots-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.slots-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

.slots-table th {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.slots-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.slots-table tr:last-child td {
  border-bottom: none;
}

.slot-hora {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
}

.slot-hora .fin {
  color: var(--text-dim);
  font-weight: 400;
}

.estado-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.slots-table select,
.slots-table input[type="number"] {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: .85rem;
  padding: 7px 10px;
  outline: none;
  transition: border-color var(--transition);
}

.slots-table select {
  min-width: 140px;
  cursor: pointer;
}

.slots-table select:focus,
.slots-table input[type="number"]:focus {
  border-color: var(--accent);
}

.slots-table input[type="number"] {
  width: 100px;
}


/* ── RESPONSIVE OVERRIDES ────────────────────────────────── */
@media (max-width: 640px) {
  .header { padding: 0 14px; }
  .main { padding: 20px 14px 80px; }

  .day-card {
    flex-direction: column;
    align-items: stretch;
    padding: 16px 18px;
  }

  .day-card-left { flex-direction: column; gap: 6px; }

  .day-card-right {
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .modal { padding: 24px 18px; }

  .custom-grid {
    grid-template-columns: 1fr;
  }
}

/* Custom Modal/Drawer Overlays and content height */
#slots-editor-overlay .slots-drawer {
  display: flex;
  flex-direction: column;
  height: 95vh;
  max-height: 750px;
}

#slots-editor-content {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

@media (max-width: 600px) {
  #slots-editor-overlay {
    padding: 0 !important;
  }
  .slots-drawer {
    width: 100% !important;
    max-width: 100% !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    border-left: none !important;
  }
  #slots-editor-content {
    overflow-x: hidden !important;
  }
  .modal {
    padding: 16px 12px !important;
  }
  .slots-table-wrap {
    border: none;
    background: transparent;
    overflow-x: hidden !important;
  }
  .slots-table, 
  .slots-table tbody, 
  .slots-table tr {
    display: block;
    width: 100%;
    min-width: 0 !important;
  }
  .slots-table thead {
    display: none;
  }
  .slots-table tr {
    margin-bottom: 12px;
    padding: 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  }
  .slots-table td {
    display: flex !important;
    width: 100% !important;
    justify-content: space-between;
    align-items: center;
    border: none !important;
    padding: 8px 0 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03) !important;
  }
  .slots-table td:last-child {
    border-bottom: none !important;
  }
  .slots-table td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }
  .slot-hora {
    font-size: 0.95rem;
  }
  .slots-table select {
    min-width: 130px;
    padding: 6px 10px;
    font-size: 0.82rem;
  }
  .slots-table input[type="number"] {
    width: 90px;
    padding: 6px 10px;
    font-size: 0.82rem;
  }
}

/* ─── TEMPLATES MANAGER STYLES ─── */
.templates-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.tpl-card {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.tpl-card:hover {
  border-color: rgba(206, 220, 61, 0.4);
  background: rgba(255, 255, 255, 0.02);
  transform: translateY(-2px);
}

.tpl-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.tpl-card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: 0.02em;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tpl-tag-builtin {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
  padding: 2px 6px;
  border-radius: 4px;
}

.tpl-tag-custom {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(206, 220, 61, 0.15);
  color: var(--accent);
  border: 1px solid rgba(206, 220, 61, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
}

.tpl-card-desc {
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.4;
  margin: 4px 0 0 0;
}

.tpl-card-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  margin-top: 4px;
}

.tpl-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 12px;
  margin-top: auto;
}

.btn-tpl-apply-all {
  background: rgba(206, 220, 61, 0.12);
  color: var(--accent);
  border: 1px solid rgba(206, 220, 61, 0.3);
  padding: 6px 12px;
  border-radius: 5px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 5px;
}

.btn-tpl-apply-all:hover {
  background: var(--accent);
  color: #000;
}

.btn-tpl-delete {
  background: transparent;
  color: rgba(255, 255, 255, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 5px;
  padding: 6px 10px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-tpl-delete:hover {
  color: #ff4757;
  border-color: #ff4757;
  background: rgba(255, 71, 87, 0.1);
}


