/* ========================================
   iFlip — Design System & Styles
   ======================================== */

:root {
  --bg-base: #0a0a0f;
  --bg-surface: #12121a;
  --bg-card: #1a1a26;
  --bg-card-hover: #1f1f2e;
  --bg-glass: rgba(255, 255, 255, 0.04);
  --bg-glass-hover: rgba(255, 255, 255, 0.07);

  --accent-purple: #7c5cfc;
  --accent-blue: #4f8aff;
  --accent-cyan: #22d3ee;
  --accent-green: #22c55e;
  --accent-red: #ef4444;
  --accent-orange: #f97316;
  --accent-yellow: #eab308;

  --gradient-primary: linear-gradient(135deg, #7c5cfc, #4f8aff);
  --gradient-success: linear-gradient(135deg, #22c55e, #16a34a);
  --gradient-danger: linear-gradient(135deg, #ef4444, #dc2626);
  --gradient-warn: linear-gradient(135deg, #f97316, #ea580c);
  --gradient-gold: linear-gradient(135deg, #eab308, #ca8a04);

  --text-primary: #f1f1f8;
  --text-secondary: #9090b0;
  --text-muted: #5a5a78;

  --border: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(124, 92, 252, 0.4);

  --sidebar-w: 220px;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;

  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-modal: 0 20px 60px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 30px rgba(124, 92, 252, 0.25);
}

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

html {
  font-size: 15px;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ========================================
   SIDEBAR
   ======================================== */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 28px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.logo-icon {
  font-size: 22px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-text {
  font-size: 1.4rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  text-align: left;
  width: 100%;
}

.nav-btn:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
  transform: translateX(2px);
}

.nav-btn.active {
  background: linear-gradient(135deg, rgba(124, 92, 252, 0.2), rgba(79, 138, 255, 0.15));
  color: #a78bfa;
  border: 1px solid rgba(124, 92, 252, 0.25);
}

.nav-icon {
  font-size: 1.1rem;
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-stats {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-pill {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
}

/* ========================================
   MAIN CONTENT
   ======================================== */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 36px 40px;
  overflow-y: auto;
}

.page {
  display: none;
  animation: fadeSlideIn 0.3s ease;
}

.page.active {
  display: block;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.page-title {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

/* ========================================
   BUTTONS
   ======================================== */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: 0 4px 16px rgba(124, 92, 252, 0.4);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(124, 92, 252, 0.55);
}

.btn-secondary {
  background: var(--bg-glass);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--gradient-success);
  color: #fff;
}

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

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

/* ========================================
   PHONE CARDS (Inventario)
   ======================================== */
.grid-phones {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.phone-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
}

.phone-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
  background: var(--bg-card-hover);
}

.phone-card-img {
  background: linear-gradient(135deg, #1e1a2e, #12111e);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 180px;
  padding: 20px;
  position: relative;
}

.phone-card-img img {
  height: 140px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.5));
  transition: transform 0.3s ease;
}

.phone-card:hover .phone-card-img img {
  transform: scale(1.05);
}

.phone-card-img .sold-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--gradient-success);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
}

.phone-card-body {
  padding: 16px;
}

.phone-model {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.phone-specs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.spec-tag {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.spec-tag.battery-good {
  border-color: rgba(34, 197, 94, 0.35);
  color: #4ade80;
}

.spec-tag.battery-ok {
  border-color: rgba(234, 179, 8, 0.35);
  color: #facc15;
}

.spec-tag.battery-bad {
  border-color: rgba(239, 68, 68, 0.35);
  color: #f87171;
}

.phone-prices {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.price-buy {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.price-sell {
  font-size: 1rem;
  font-weight: 700;
  color: #4ade80;
}

.phone-parts-status {
  margin-top: 10px;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.parts-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
}

.parts-badge.needs {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.parts-badge.has {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.parts-badge.none {
  background: rgba(90, 90, 120, 0.15);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

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

.part-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.2s ease;
}

.part-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.part-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.part-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, rgba(124, 92, 252, 0.2), rgba(79, 138, 255, 0.15));
  border: 1px solid rgba(124, 92, 252, 0.25);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.part-quality-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
}

.quality-original {
  background: rgba(234, 179, 8, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(234, 179, 8, 0.3);
}

.quality-oem {
  background: rgba(124, 92, 252, 0.15);
  color: #a78bfa;
  border: 1px solid rgba(124, 92, 252, 0.3);
}

.quality-compatible {
  background: rgba(90, 90, 120, 0.2);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.part-name {
  font-weight: 700;
  font-size: 1rem;
}

.part-model {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.part-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.part-cost {
  font-size: 1.1rem;
  font-weight: 700;
  color: #4f8aff;
}

.part-assigned {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.part-assigned.is-assigned {
  color: #4ade80;
}

/* ========================================
   ALMACÉN
   ======================================== */
.almacen-section {
  margin-bottom: 36px;
}

.almacen-section h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.almacen-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  transition: all 0.2s ease;
}

.almacen-row:hover {
  border-color: var(--border-accent);
}

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

.almacen-phone-thumb {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.almacen-row-info {}

.almacen-row-title {
  font-weight: 600;
  font-size: 0.9rem;
}

.almacen-row-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.almacen-row-right {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* ========================================
   BENEFICIOS
   ======================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.stat-card.purple::before {
  background: var(--gradient-primary);
}

.stat-card.green::before {
  background: var(--gradient-success);
}

.stat-card.red::before {
  background: var(--gradient-danger);
}

.stat-card.blue::before {
  background: linear-gradient(135deg, #4f8aff, #22d3ee);
}

.stat-card.gold::before {
  background: var(--gradient-gold);
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -1px;
}

.stat-value.positive {
  color: #4ade80;
}

.stat-value.negative {
  color: #f87171;
}

.stat-value.neutral {
  color: var(--text-primary);
}

.stat-value.blue {
  color: #60a5fa;
}

.stat-value.gold {
  color: #fbbf24;
}

.stat-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.profit-table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.profit-table-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 1rem;
}

.profit-table {
  width: 100%;
  border-collapse: collapse;
}

.profit-table th {
  padding: 12px 20px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.profit-table td {
  padding: 14px 20px;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border);
}

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

.profit-table tr:hover td {
  background: var(--bg-glass);
}

.profit-positive {
  color: #4ade80;
  font-weight: 700;
}

.profit-negative {
  color: #f87171;
  font-weight: 700;
}

.profit-neutral {
  color: var(--text-muted);
}

/* ========================================
   MODALS
   ======================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-modal);
  animation: slideUp 0.25s ease;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-wide {
  max-width: 700px;
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

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

.modal-title {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.modal-close {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.modal-close:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
}

.modal-body {
  padding: 24px 28px;
}

.modal-footer {
  padding: 16px 28px 24px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--border);
}

/* ========================================
   FORM ELEMENTS
   ======================================== */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 16px;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.form-control {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease;
  width: 100%;
}

.form-control:focus {
  border-color: var(--accent-purple);
}

.form-control option {
  background: var(--bg-surface);
  color: var(--text-primary);
}

textarea.form-control {
  resize: vertical;
}

/* ========================================
   DETAIL MODAL CONTENT
   ======================================== */
.detail-hero {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
  padding: 20px;
  background: linear-gradient(135deg, #1e1a2e, #12111e);
  border-radius: var(--radius-sm);
}

.detail-hero img {
  height: 100px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
}

.detail-hero-info h3 {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.detail-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-section {
  margin-bottom: 20px;
}

.detail-section h4 {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.detail-parts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-part-item {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.detail-part-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
}

.detail-part-cost {
  font-weight: 700;
  color: #4f8aff;
  font-size: 0.875rem;
}

/* ========================================
   EMPTY STATE
   ======================================== */
.empty-state {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  text-align: center;
  gap: 12px;
}

.empty-state.visible {
  display: flex;
}

.empty-icon {
  font-size: 3.5rem;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.empty-state p {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Repair status badge */
.repair-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  letter-spacing: 0.2px;
}

/* ========================================
   ASSIGN INFO
   ======================================== */
.assign-info {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 12px 16px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* ========================================
   SCROLLBAR
   ======================================== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 900px) {
  :root {
    --sidebar-w: 70px;
  }

  .nav-label,
  .logo-text,
  .sidebar-footer {
    display: none;
  }

  .sidebar-logo {
    justify-content: center;
    padding-bottom: 20px;
  }

  .nav-btn {
    justify-content: center;
    padding: 12px;
  }

  .main-content {
    padding: 24px 20px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .page-header {
    flex-direction: column;
    gap: 16px;
  }

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

/* ========================================
   INLINE PARTS EDITOR (in iPhone modal)
   ======================================== */
.inline-parts-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-top: 4px;
}

.inline-parts-header {
  background: var(--bg-glass);
  padding: 10px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border);
}

.inline-needed-list {
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 36px;
}

.inline-no-parts {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 4px 2px;
}

.inline-part-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 6px 10px;
  font-size: 0.8rem;
}

.inline-part-item span:first-child {
  flex: 1;
}

.inline-part-cost {
  color: #4f8aff;
  font-weight: 600;
  min-width: 50px;
  text-align: right;
}

.inline-parts-add {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  background: var(--bg-surface);
}

.inline-parts-add .form-control {
  flex: 1;
  min-width: 100px;
  font-size: 0.8rem;
  padding: 7px 10px;
}

.inline-parts-add input.form-control {
  max-width: 100px;
}

/* ========================================
   LISTA DE LA COMPRA
   ======================================== */
.compra-header {
  margin-bottom: 20px;
}

.compra-total {
  background: linear-gradient(135deg, rgba(124, 92, 252, 0.12), rgba(79, 138, 255, 0.08));
  border: 1px solid rgba(124, 92, 252, 0.25);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.compra-total-price strong {
  color: #a78bfa;
  font-size: 1.1rem;
}

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

.compra-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
}

.compra-item:hover {
  border-color: var(--border-accent);
}

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

.compra-item-name {
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.compra-item-phone {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.compra-item-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.compra-item-cost {
  font-weight: 700;
  color: #4f8aff;
  font-size: 1rem;
}

/* ========================================
   DRAG & DROP
   ======================================== */
.almacen-row[draggable="true"] {
  cursor: grab;
}

.almacen-row[draggable="true"]:active {
  cursor: grabbing;
}

.almacen-row.dragging {
  opacity: 0.5;
  border-color: var(--accent-purple);
}

.drag-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

.almacen-drop-phone {
  transition: all 0.2s ease;
}

.almacen-drop-phone.drop-ready {
  border-color: rgba(124, 92, 252, 0.4);
  background: rgba(124, 92, 252, 0.05);
}

.almacen-drop-phone.drop-over {
  border-color: #a78bfa;
  background: rgba(124, 92, 252, 0.15);
  box-shadow: 0 0 20px rgba(124, 92, 252, 0.3);
  transform: scale(1.01);
}

.drop-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.almacen-drop-phone.drop-ready .drop-label {
  opacity: 1;
  color: var(--accent-purple);
}

.almacen-drop-phone.drop-over .drop-label {
  opacity: 1;
  color: #a78bfa;
}

/* ========================================
   AUTH SCREEN
   ======================================== */
.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(124, 92, 252, 0.15) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(79, 138, 255, 0.12) 0%, transparent 60%);
  padding: 20px;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 60px rgba(124, 92, 252, 0.1);
  animation: slideUp 0.3s ease;
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 32px;
}

.auth-logo-icon {
  font-size: 2rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-logo-text {
  font-size: 2rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -1px;
}

.auth-title {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
  text-align: center;
}

.auth-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 24px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.auth-btn {
  width: 100%;
  padding: 13px;
  font-size: 1rem;
  margin-top: 8px;
  justify-content: center;
}

.auth-switch {
  text-align: center;
  font-size: 0.83rem;
  color: var(--text-muted);
  margin-top: 16px;
}

.auth-switch a {
  color: #a78bfa;
  text-decoration: none;
  font-weight: 600;
}

.auth-switch a:hover {
  text-decoration: underline;
}

.auth-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-xs);
  padding: 10px 14px;
  font-size: 0.83rem;
  color: #f87171;
  margin-bottom: 8px;
}

.auth-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

/* Sidebar user section */
.sidebar-user {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.sidebar-user-email {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  margin-bottom: 6px;
  padding: 0 2px;
}

/* ========================================
   OFERTAS / DEAL SEARCH
   ======================================== */
.ofertas-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ofertas-form-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.ofertas-form-row .form-group {
  margin-bottom: 0;
  flex: 1;
  min-width: 120px;
}

.ofertas-platforms {
  display: flex;
  gap: 10px;
  align-items: center;
  padding-bottom: 2px;
}

.platform-toggle {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.platform-toggle input[type="checkbox"] {
  display: none;
}

.platform-badge {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 2px solid transparent;
  transition: all 0.15s ease;
  cursor: pointer;
  user-select: none;
}

.platform-badge.wallapop {
  background: rgba(124, 92, 252, 0.12);
  border-color: rgba(124, 92, 252, 0.3);
  color: #c4b5fd;
}

.platform-badge.vinted {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.25);
  color: #86efac;
}

.platform-toggle input:not(:checked)+.platform-badge {
  opacity: 0.35;
  border-color: transparent;
}

/* Results */
.ofertas-section {
  margin-bottom: 32px;
}

.ofertas-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ofertas-section-title span {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-glass);
  padding: 2px 10px;
  border-radius: 20px;
}

.ofertas-loading {
  text-align: center;
  padding: 48px;
  color: var(--text-muted);
  font-size: 0.95rem;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.ofertas-error {
  color: #f87171;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-xs);
  padding: 14px 16px;
  font-size: 0.875rem;
}

.ofertas-empty {
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 14px 0;
}

.ofertas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.oferta-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
}

.oferta-card:hover {
  border-color: var(--accent-purple);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.oferta-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: var(--bg-surface);
  overflow: hidden;
}

.oferta-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.oferta-card:hover .oferta-img-wrap img {
  transform: scale(1.05);
}

.oferta-img-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 2.5rem;
  color: var(--text-muted);
}

.oferta-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 10px;
  text-transform: uppercase;
}

.oferta-badge.reserved {
  background: rgba(234, 179, 8, 0.9);
  color: #000;
}

.oferta-info {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.oferta-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.oferta-price {
  font-size: 1rem;
  font-weight: 800;
  color: #60a5fa;
  margin-top: 4px;
}

.oferta-location {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Vinted CTA block */
.vinted-cta {
  background: rgba(34, 197, 94, 0.06);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.vinted-cta p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
}

.vinted-exclude {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 !important;
}

/* ========================================
   PLAN BADGES
   ======================================== */
.sidebar-plan-badge {
  margin-bottom: 6px;
  display: flex;
  justify-content: center;
}

.plan-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.plan-free {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #86efac;
}

.plan-premium {
  background: rgba(234, 179, 8, 0.15);
  border: 1px solid rgba(234, 179, 8, 0.4);
  color: #fde68a;
}

.plan-admin {
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: #c4b5fd;
}

.plan-badge-free {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #86efac;
}

/* ========================================
   FEATURE LOCK OVERLAY
   ======================================== */
.feature-locked {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: rgba(10, 10, 15, 0.82);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}

#page-ofertas {
  position: relative;
}

.lock-content {
  text-align: center;
  padding: 40px 32px;
  max-width: 380px;
}

.lock-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  animation: lock-pulse 2s ease-in-out infinite;
}

@keyframes lock-pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }
}

.lock-content h3 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 12px;
}

.lock-content p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 8px;
}

.lock-limits {
  margin-top: 16px !important;
  font-size: 0.8rem !important;
  color: var(--text-muted) !important;
}

/* ========================================
   ADMIN PAGE
   ======================================== */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.admin-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.admin-table thead tr {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.admin-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  vertical-align: middle;
}

.admin-table tbody tr:hover {
  background: var(--bg-glass);
}

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

/* ========================================
   LIGHT MODE
   ======================================== */
body.light {
  --bg-base: #f0f0f8;
  --bg-surface: #e8e8f4;
  --bg-card: #ffffff;
  --bg-card-hover: #f5f5ff;
  --bg-glass: rgba(0, 0, 0, 0.03);
  --bg-glass-hover: rgba(0, 0, 0, 0.06);
  --text-primary: #1a1a2e;
  --text-secondary: #44446a;
  --text-muted: #9090b0;
  --border: rgba(0, 0, 0, 0.1);
  --border-accent: rgba(124, 92, 252, 0.35);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.12);
  --shadow-modal: 0 20px 60px rgba(0, 0, 0, 0.25);
  --shadow-glow: 0 0 30px rgba(124, 92, 252, 0.15);
}

/* ========================================
   STATUS TABS
   ======================================== */
.status-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.status-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-glass);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s;
}

.status-tab:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
}

.status-tab.active {
  background: rgba(124, 92, 252, 0.15);
  border-color: rgba(124, 92, 252, 0.4);
  color: #a78bfa;
  font-weight: 600;
}

.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.1);
  color: inherit;
}

.status-tab.active .tab-count {
  background: rgba(124, 92, 252, 0.3);
}

/* ========================================
   INVENTORY AGE BADGE
   ======================================== */
.phone-status-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.inv-age {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
}

.age-fresh {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #86efac;
}

.age-ok {
  background: rgba(79, 138, 255, 0.12);
  border: 1px solid rgba(79, 138, 255, 0.3);
  color: #93c5fd;
}

.age-warn {
  background: rgba(249, 115, 22, 0.12);
  border: 1px solid rgba(249, 115, 22, 0.3);
  color: #fdba74;
}

.age-danger {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

/* ========================================
   CHARTS PAGE
   ======================================== */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 8px;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.chart-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ========================================
   SIDEBAR ACTION BUTTONS
   ======================================== */
.sidebar-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-glass);
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.18s, border-color 0.18s;
  line-height: 1;
}

.btn-icon:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-accent);
}

/* ========================================
   PREMIUM MODAL
   ======================================== */
.premium-modal {
  max-width: 560px;
  width: 95%;
  padding: 0;
  overflow: hidden;
}

.premium-modal-header {
  background: linear-gradient(135deg, #7c5cfc 0%, #4f8aff 50%, #eab308 100%);
  padding: 32px 28px 24px;
  text-align: center;
  position: relative;
}

.premium-icon-wrap {
  font-size: 2.8rem;
  margin-bottom: 10px;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
  animation: premium-star 2s ease-in-out infinite;
}

@keyframes premium-star {

  0%,
  100% {
    transform: scale(1) rotate(-3deg);
  }

  50% {
    transform: scale(1.12) rotate(3deg);
  }
}

.premium-modal-header h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  margin: 0 0 6px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.premium-modal-header p {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.85);
  margin: 0;
}

.premium-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 24px 20px 16px;
}

.compare-col {
  padding: 16px;
  border-radius: var(--radius-sm);
}

.compare-free {
  background: var(--bg-glass);
  margin-right: 8px;
}

.compare-premium {
  background: rgba(124, 92, 252, 0.1);
  border: 1px solid rgba(124, 92, 252, 0.3);
  margin-left: 8px;
}

.compare-plan-name {
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.compare-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.compare-list li {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.compare-list li.inc {
  color: #86efac;
}

.compare-list li.exc {
  color: #9090b0;
  text-decoration: line-through;
}

.premium-cta {
  padding: 4px 20px 24px;
  text-align: center;
}

.premium-cta-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
  line-height: 1.5;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
}

/* ========================================
   UPGRADE BANNER (sidebar)
   ======================================== */
.upgrade-banner {
  background: linear-gradient(135deg, rgba(124, 92, 252, 0.18), rgba(234, 179, 8, 0.12));
  border: 1px solid rgba(124, 92, 252, 0.3);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.upgrade-banner-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.upgrade-banner-text strong {
  font-size: 0.8rem;
  color: #fde68a;
}

.upgrade-banner-text span {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.upgrade-banner-btn {
  background: linear-gradient(135deg, #7c5cfc, #eab308);
  border: none;
  border-radius: var(--radius-xs);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 6px 12px;
  cursor: pointer;
  transition: opacity 0.18s;
  width: 100%;
}

.upgrade-banner-btn:hover {
  opacity: 0.85;
}