/* CLIMAXA - Dashboards (cliente, técnico, admin) */

.dash-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: calc(100vh - 73px);
  background: var(--bg);
}

.sidebar {
  background: white;
  border-right: 1px solid var(--border);
  padding: 28px 18px;
  position: sticky;
  top: 73px;
  height: calc(100vh - 73px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar-section { margin-bottom: 28px; }

.sidebar-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-soft);
  padding: 0 12px;
  margin-bottom: 8px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--t-fast);
  margin-bottom: 2px;
  text-decoration: none;
}

.sidebar-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: color var(--t-fast);
}

.sidebar-link:hover { background: var(--brand-50); color: var(--brand-700); }
.sidebar-link:hover svg { color: var(--brand-600); }

.sidebar-link.active {
  background: linear-gradient(135deg, var(--brand-700), var(--brand-500));
  color: white;
}
.sidebar-link.active svg { color: white; }

.sidebar-link .badge { margin-left: auto; font-size: 0.65rem; padding: 2px 8px; }

.dash-main { padding: 36px 40px; max-width: 100%; overflow-x: auto; }

.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 32px;
}

.dash-header h1 { font-size: 1.8rem; margin-bottom: 4px; }
.dash-header p { color: var(--text-muted); }

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

.stat-card {
  position: relative;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  overflow: hidden;
  transition: all var(--t);
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.stat-card-icon {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--brand-50);
  color: var(--brand-700);
}

.stat-card.accent .stat-card-icon { background: #fff4ed; color: var(--accent-500); }
.stat-card.success .stat-card-icon { background: #d1fae5; color: var(--success); }
.stat-card.warn .stat-card-icon { background: #fef3c7; color: var(--warning); }

.stat-card-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-card-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  color: var(--ink-900);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.stat-card-value small { font-size: 0.95rem; font-weight: 500; color: var(--text-muted); }
.stat-card-sub { margin-top: 8px; font-size: 0.82rem; color: var(--text-muted); }

.panel {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
}

.panel-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.panel-header h3 { font-size: 1.05rem; font-family: var(--font-display); }
.panel-body { padding: 24px; }

.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 24px; }

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.tab {
  padding: 12px 18px;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--t-fast);
  margin-bottom: -1px;
}

.tab:hover { color: var(--ink-900); }
.tab.active { color: var(--ink-900); border-bottom-color: var(--brand-500); font-weight: 600; }

.item-list { display: flex; flex-direction: column; gap: 10px; }

.item-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--t-fast);
}

.item-row:hover { border-color: var(--brand-200); box-shadow: var(--shadow-sm); }

.item-row-thumb {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: var(--radius);
  background: var(--brand-50);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.item-row-thumb svg { width: 70%; height: auto; }
.item-row-thumb img { width: 100%; height: 100%; object-fit: cover; }

.item-row-info { flex: 1; min-width: 0; }
.item-row-info strong {
  display: block;
  color: var(--ink-900);
  font-size: 0.95rem;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.item-row-info span { font-size: 0.82rem; color: var(--text-muted); }

.item-row-meta { display: flex; align-items: center; gap: 16px; font-size: 0.85rem; justify-content: space-between; }
.item-row-meta-info { display: flex; align-items: center; gap: 12px; }
.item-row-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 24px;
  margin-bottom: 20px;
}

.detail-item label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.detail-item .value { font-size: 0.95rem; color: var(--ink-900); font-weight: 500; }

/* ============ CART ============ */
.cart-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 100vw;
  height: 100vh;
  background: white;
  box-shadow: var(--shadow-xl);
  z-index: 1100;
  transform: translateX(100%);
  transition: transform var(--t-slow) cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.cart-sidebar.open { transform: translateX(0); }

.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 31, 51, 0.5);
  backdrop-filter: blur(2px);
  z-index: 1099;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t);
}

.cart-overlay.open { opacity: 1; pointer-events: auto; }

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

.cart-header h3 { font-size: 1.15rem; font-family: var(--font-display); }
.cart-body { flex: 1; overflow-y: auto; padding: 16px 24px; }

.cart-item { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.cart-item:last-child { border-bottom: none; }

.cart-item-thumb {
  width: 70px;
  height: 70px;
  flex-shrink: 0;
  background: var(--brand-50);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.cart-item-thumb svg { width: 75%; }
.cart-item-thumb img { width: 100%; height: 100%; object-fit: cover; }

.cart-item-info { flex: 1; min-width: 0; }
.cart-item-info strong {
  display: block;
  font-size: 0.9rem;
  color: var(--ink-900);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cart-item-info .marca {
  font-size: 0.72rem;
  color: var(--brand-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.cart-qty {
  display: inline-flex;
  align-items: center;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  margin-top: 6px;
}

.cart-qty button {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
}
.cart-qty button:hover { color: var(--brand-600); }
.cart-qty span { min-width: 24px; text-align: center; font-size: 0.85rem; font-weight: 600; }

.cart-item-price {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  color: var(--ink-900);
  white-space: nowrap;
}

.cart-item-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-soft);
  padding: 4px;
  transition: color var(--t-fast);
}
.cart-item-remove:hover { color: var(--danger); }

.cart-footer { padding: 20px 24px; border-top: 1px solid var(--border); background: var(--surface-2); }
.cart-total { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.cart-total-label { font-size: 0.9rem; color: var(--text-muted); }

.cart-total-amount {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--ink-900);
  letter-spacing: -0.02em;
}

/* ============ AUTH PAGES ============ */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.auth-side {
  background: linear-gradient(135deg, #0a3d7e 0%, #0e4d9e 50%, #1c7fc4 100%);
  color: white;
  padding: 60px 50px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.auth-side::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(109, 197, 232, 0.22) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255, 107, 53, 0.12) 0%, transparent 50%);
  pointer-events: none;
}

.auth-side > * { position: relative; z-index: 1; }
.auth-side .climaxa-text strong { color: white; }
.auth-side .climaxa-text span { color: rgba(255, 255, 255, 0.7); }

.auth-side h2 {
  color: white;
  font-size: 2.4rem;
  margin: 32px 0 18px;
  letter-spacing: -0.03em;
}

.auth-side p { color: rgba(255, 255, 255, 0.82); font-size: 1.05rem; line-height: 1.65; }

.auth-side ul {
  list-style: none;
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-side li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.88);
}

.auth-side li svg { width: 20px; height: 20px; color: #6dc5e8; flex-shrink: 0; }

.auth-form-side { display: grid; place-items: center; padding: 60px 32px; background: var(--bg); }
.auth-form { width: 100%; max-width: 420px; }
.auth-form h2 { font-size: 1.8rem; margin-bottom: 8px; }
.auth-form > p { color: var(--text-muted); margin-bottom: 32px; }
.auth-footer { margin-top: 24px; text-align: center; font-size: 0.9rem; color: var(--text-muted); }

@media (max-width: 880px) {
  .dash-layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 73px;
    left: 0;
    z-index: 90;
    width: 260px;
    transform: translateX(-100%);
    transition: transform var(--t);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .dash-main { padding: 24px 20px; }
  .panel-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { padding: 40px 30px; min-height: auto; }
  .auth-side ul { display: none; }
}

@media (max-width: 640px) {
  .dash-main { padding: 18px 14px; }

  /* Item rows stack: thumb+info on top, meta (price/buttons) below */
  .item-row {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
  }
  .item-row-info { flex: 1; min-width: 0; }
  .item-row-info span {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
  }
  .item-row-meta {
    width: 100%;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 8px;
    border-top: 1px solid var(--border);
    padding-top: 10px;
  }

  /* Stat cards: 2 columns */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-card { padding: 16px 14px; }
  .stat-card-value { font-size: 1.4rem; }

  /* Tabla overflow scroll */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table { min-width: 520px; }

  /* Form rows single column */
  .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 600px) { .cart-sidebar { width: 100vw; } }

.menu-toggle {
  display: none;
  background: var(--surface-2);
  border: none;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  cursor: pointer;
  padding: 0;
  align-items: center;
  justify-content: center;
}

@media (max-width: 880px) { .menu-toggle { display: inline-flex; } }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(13, 31, 51, 0.35);
  z-index: 89;
  cursor: pointer;
}
@media (max-width: 880px) {
  .sidebar-overlay.open { display: block; }
  .dash-header { gap: 12px; }
}
