@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap');

:root {
  --c-bg: #0f0f0f;
  --c-surface: #1a1a1a;
  --c-surface2: #242424;
  --c-border: #2e2e2e;
  --c-border2: #3a3a3a;
  --c-text: #f0f0f0;
  --c-text2: #a0a0a0;
  --c-text3: #666;
  --c-accent: #ff4500;
  --c-accent2: #ff6a33;
  --c-blue: #0066ff;
  --c-green: #00c853;
  --c-yellow: #ffd600;
  --c-red: #ff1744;
  --font: 'Space Grotesk', sans-serif;
  --r: 6px;
  --r-lg: 10px;
  --sh: 0 2px 12px rgba(0, 0, 0, .4);
  --t: .15s ease;

  /* Aliases para compatibilidad */
  --teal-500: var(--c-accent);
  --teal-600: var(--c-accent);
  --orange-400: var(--c-accent);
  --color-text-mid: var(--c-text2);
  --color-text-soft: var(--c-text3);
  --color-bg: var(--c-bg);
  --color-border: var(--c-border);
  --color-border-mid: var(--c-border2);
  --color-text: var(--c-text);
  --color-primary: var(--c-accent);
  --color-success: var(--c-green);
  --color-success-bg: rgba(0, 200, 83, .1);
  --color-danger: var(--c-red);
  --color-danger-bg: rgba(255, 23, 68, .1);
  --color-warn: var(--c-yellow);
  --color-warn-bg: rgba(255, 214, 0, .1);
  --nav-h: 58px;
  --mobile-bar-h: 56px;
  --max-w: 1400px;
  --navy: var(--c-text);
  --navy-light: var(--c-surface2);
  --orange: var(--c-accent);
  --text: var(--c-text);
  --text-soft: var(--c-text3);
  --danger: var(--c-red);
  --border: var(--c-border);
  --success-bg: rgba(0, 200, 83, .1);
  --danger-bg: rgba(255, 23, 68, .1);
}

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

html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--c-text);
  background: var(--c-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--mobile-bar-h);
}

@media (min-width:768px) {
  body {
    padding-bottom: 0;
  }
}

main,
.orders-page,
.account-page,
.cart-page,
.product-page,
.admin-page {
  flex: 1;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

button {
  font-family: var(--font);
  cursor: pointer;
  border: none;
}

input,
textarea,
select {
  font-family: var(--font);
}

ul,
ol {
  list-style: none;
}

.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
}

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--r);
  border: 1px solid transparent;
  white-space: nowrap;
  transition: all var(--t);
  cursor: pointer;
}

.btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--c-accent);
  color: #fff;
}

.btn--primary:hover {
  background: var(--c-accent2);
  transform: translateY(-1px);
}

.btn--accent {
  background: var(--c-blue);
  color: #fff;
}

.btn--accent:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.btn--ghost {
  background: var(--c-surface2);
  color: var(--c-text2);
  border-color: var(--c-border2);
}

.btn--ghost:hover {
  background: var(--c-border);
  color: var(--c-text);
}

.btn--danger {
  background: var(--c-red);
  color: #fff;
}

.btn--danger:hover {
  filter: brightness(1.1);
}

.btn--outline {
  background: transparent;
  color: var(--c-accent);
  border-color: var(--c-accent);
}

.btn--outline:hover {
  background: rgba(255, 69, 0, .1);
}

.btn--full {
  width: 100%;
}

.btn--sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn--lg {
  padding: 12px 26px;
  font-size: 15px;
}

.btn--navy {
  background: var(--c-surface2);
  color: var(--c-text);
  border-color: var(--c-border2);
}

.btn--wave {
  background: var(--c-accent);
  color: #fff;
}

.btn--wave:hover {
  background: var(--c-accent2);
}

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}

.form-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--c-text3);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 9px 12px;
  font-family: var(--font);
  font-size: 14px;
  color: var(--c-text);
  background: var(--c-surface2);
  border: 1px solid var(--c-border2);
  border-radius: var(--r);
  outline: none;
  transition: border-color var(--t);
}

.form-input:focus,
.form-select:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 2px rgba(255, 69, 0, .15);
}

.form-input::placeholder {
  color: var(--c-text3);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 3px;
}

.badge--success {
  background: rgba(0, 200, 83, .12);
  color: var(--c-green);
}

.badge--danger {
  background: rgba(255, 23, 68, .12);
  color: var(--c-red);
}

.badge--warn {
  background: rgba(255, 214, 0, .12);
  color: var(--c-yellow);
}

.badge--neutral {
  background: var(--c-surface2);
  color: var(--c-text2);
}

.badge--primary {
  background: rgba(255, 69, 0, .12);
  color: var(--c-accent);
}

.badge--info {
  background: rgba(0, 102, 255, .12);
  color: var(--c-blue);
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  background: var(--c-surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--c-border);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--c-text3);
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface2);
  white-space: nowrap;
}

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

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

.table tbody tr:hover {
  background: var(--c-surface2);
}

/* Flash */
.flash-container {
  position: fixed;
  top: 68px;
  right: 16px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 320px;
}

.flash {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r-lg);
  font-size: 13px;
  box-shadow: var(--sh);
  animation: flashIn .15s ease;
  border-left: 3px solid;
}

@keyframes flashIn {
  from {
    opacity: 0;
    transform: translateX(10px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.flash--success {
  background: var(--c-surface);
  color: var(--c-green);
  border-color: var(--c-green);
}

.flash--error {
  background: var(--c-surface);
  color: var(--c-red);
  border-color: var(--c-red);
}

.flash--info {
  background: var(--c-surface);
  color: var(--c-blue);
  border-color: var(--c-blue);
}

.flash-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  opacity: .4;
  padding: 0;
}

.flash-close:hover {
  opacity: 1;
}

/* Modales */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 800;
  background: rgba(0, 0, 0, .7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal-content {
  background: var(--c-surface);
  border: 1px solid var(--c-border2);
  border-radius: var(--r-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-lg {
  max-width: 800px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--c-border);
}

.modal-header h3 {
  font-size: 15px;
  font-weight: 600;
}

.modal-close {
  background: var(--c-surface2);
  border: 1px solid var(--c-border);
  cursor: pointer;
  width: 26px;
  height: 26px;
  border-radius: var(--r);
  font-size: 13px;
  color: var(--c-text2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t);
}

.modal-close:hover {
  background: var(--c-border);
  color: var(--c-text);
}

.modal-body {
  padding: 20px;
}

/* Content box */
.content-box {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-bottom: 16px;
}

.box-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--c-border);
}

.box-title h3 {
  font-size: 14px;
  font-weight: 600;
}

.box-title i {
  color: var(--c-accent);
}

/* Admin */
.admin-page {
  padding: 28px 0 48px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--c-border);
}

.admin-header h1 {
  font-size: 22px;
  font-weight: 700;
}

.admin-header p {
  color: var(--c-text2);
  font-size: 13px;
  margin-top: 3px;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text2);
  background: var(--c-surface2);
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  transition: all var(--t);
  text-decoration: none;
}

.back-btn:hover {
  background: var(--c-border);
  color: var(--c-text);
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: border-color var(--t);
}

.stat-card:hover {
  border-color: var(--c-border2);
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r);
  background: rgba(255, 69, 0, .1);
  color: var(--c-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.stat-num {
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

.stat-label {
  font-size: 11px;
  color: var(--c-text3);
  margin-top: 3px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.admin-actions-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, 1fr);
}

.admin-action-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 20px;
  text-decoration: none;
  color: var(--c-text);
  transition: all var(--t);
  display: block;
}

.admin-action-card:hover {
  border-color: var(--c-accent);
  transform: translateY(-2px);
}

.admin-action-card i {
  font-size: 20px;
  color: var(--c-accent);
  margin-bottom: 10px;
  display: block;
}

.admin-action-card h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.admin-action-card p {
  font-size: 12px;
  color: var(--c-text3);
  line-height: 1.4;
}

@media (max-width:768px) {
  .admin-actions-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.admin-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}

.admin-search {
  padding: 8px 12px;
  border: 1px solid var(--c-border2);
  border-radius: var(--r);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  min-width: 200px;
  background: var(--c-surface2);
  color: var(--c-text);
  transition: border-color var(--t);
}

.admin-search:focus {
  border-color: var(--c-accent);
}

.admin-select,
.admin-select-small {
  padding: 8px 12px;
  border: 1px solid var(--c-border2);
  border-radius: var(--r);
  font-size: 13px;
  font-family: var(--font);
  background: var(--c-surface2);
  color: var(--c-text);
  cursor: pointer;
  outline: none;
}

.admin-select-small {
  padding: 5px 9px;
  font-size: 12px;
}

.actions-cell {
  display: flex;
  gap: 5px;
  align-items: center;
}

.btn-action {
  width: 28px;
  height: 28px;
  border-radius: var(--r);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  border: 1px solid var(--c-border);
  background: var(--c-surface2);
  color: var(--c-text2);
  cursor: pointer;
  transition: all var(--t);
}

.btn-action:hover {
  transform: translateY(-1px);
}

.btn-edit:hover {
  background: rgba(0, 102, 255, .1);
  color: var(--c-blue);
  border-color: var(--c-blue);
}

.btn-enable:hover {
  background: rgba(0, 200, 83, .1);
  color: var(--c-green);
  border-color: var(--c-green);
}

.btn-disable:hover {
  background: rgba(255, 214, 0, .1);
  color: var(--c-yellow);
  border-color: var(--c-yellow);
}

.btn-delete:hover {
  background: rgba(255, 23, 68, .1);
  color: var(--c-red);
  border-color: var(--c-red);
}

/* Planes */
.planes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.plan-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 18px;
}

.plan-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.plan-card-header h3 {
  font-size: 15px;
  font-weight: 600;
}

.form-row-inline {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

.btn-guardar {
  padding: 8px 18px;
  background: var(--c-accent);
  color: #fff;
  border: none;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t);
  font-family: var(--font);
}

.btn-guardar:hover {
  background: var(--c-accent2);
}

/* Account */
.account-page {
  padding: 28px 0 48px;
}

.account-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--c-border);
}

.account-header h1 {
  font-size: clamp(18px, 2vw, 24px);
  font-weight: 700;
}

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

.account-sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 70px;
}

.account-sidebar a {
  padding: 8px 12px;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text2);
  text-decoration: none;
  transition: all var(--t);
  display: block;
}

.account-sidebar a:hover {
  background: var(--c-surface2);
  color: var(--c-text);
}

.account-sidebar a.active {
  background: rgba(255, 69, 0, .12);
  color: var(--c-accent);
  font-weight: 600;
  border-left: 2px solid var(--c-accent);
}

.logout-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--c-text2);
  font-size: 13px;
  transition: color var(--t);
  text-decoration: none;
}

.logout-link:hover {
  color: var(--c-red);
}

@media (max-width:768px) {
  .account-layout {
    grid-template-columns: 1fr;
  }

  .account-sidebar nav {
    flex-direction: row;
    overflow-x: auto;
    gap: 4px;
  }

  .account-sidebar a {
    white-space: nowrap;
  }
}

/* Summary extras */
.summary-extra-box {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: var(--r);
  margin: 6px 0;
  font-size: 13px;
  border: 1px solid;
}

.summary-extra--warn {
  background: rgba(255, 214, 0, .06);
  border-color: rgba(255, 214, 0, .2);
}

.summary-extra--info {
  background: rgba(255, 69, 0, .06);
  border-color: rgba(255, 69, 0, .2);
}

.summary-extra--success {
  background: rgba(0, 200, 83, .06);
  border-color: rgba(0, 200, 83, .2);
}

.extra-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 2px;
}

.extra-text {
  font-size: 12px;
  color: var(--c-text2);
  line-height: 1.5;
}

.extra-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--c-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  margin-top: 3px;
  display: inline-block;
}

/* Utils */
.desktop-only {
  display: block;
}

.mobile-only {
  display: none;
}

@media (max-width:768px) {
  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: block !important;
  }
}