/* ============================================================
   Dulcería Vales — Estilos principales
   Fuentes: Sora (display) + DM Sans (body)
   Paleta: dulce-cálida con acentos coral
   ============================================================ */

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

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --candy-pink:   #FF6B9D;
  --candy-coral:  #FF4E6A;
  --candy-orange: #FF8C42;
  --candy-yellow: #FFD166;
  --candy-mint:   #06D6A0;
  --candy-blue:   #118AB2;

  --bg:       #F8F5F2;
  --surface:  #FFFFFF;
  --surface2: #FFF0F5;
  --border:   #EDD8E4;

  --text:     #2C1A2E;
  --text-2:   #6B4F72;
  --text-3:   #A987B0;

  --accent:   var(--candy-coral);
  --accent-2: var(--candy-pink);

  --shadow-sm:  0 2px 8px rgba(44,26,46,.07);
  --shadow-md:  0 4px 20px rgba(44,26,46,.12);
  --shadow-lg:  0 8px 40px rgba(44,26,46,.18);
  --radius:     16px;
  --radius-sm:  10px;

  --font-display: 'Sora', sans-serif;
  --font-body:    'DM Sans', sans-serif;
  --sidebar-w:    260px;
}

/* Modo oscuro */
[data-theme="dark"] {
  --bg:       #1A1024;
  --surface:  #251434;
  --surface2: #301848;
  --border:   #3D2250;
  --text:     #F0E6F6;
  --text-2:   #C4A8D4;
  --text-3:   #8A6A9A;
  --shadow-sm:  0 2px 8px rgba(0,0,0,.3);
  --shadow-md:  0 4px 20px rgba(0,0,0,.4);
}

/* ── Reset / base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  transition: background .3s, color .3s;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}

.sidebar-brand {
  padding: 28px 24px 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand .brand-icon {
  font-size: 2rem;
  line-height: 1;
}
.sidebar-brand h1 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.2;
  margin-top: 6px;
}
.sidebar-brand small {
  font-size: .7rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}
.nav-section-label {
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-3);
  padding: 12px 12px 4px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  text-decoration: none;
  font-size: .92rem;
  font-weight: 500;
  transition: background .15s, color .15s;
  margin-bottom: 2px;
}
.nav-link:hover {
  background: var(--surface2);
  color: var(--text);
}
.nav-link.active {
  background: linear-gradient(135deg, var(--candy-coral), var(--candy-pink));
  color: #fff;
  box-shadow: 0 4px 12px rgba(255,78,106,.35);
}
.nav-link .nav-icon { font-size: 1.15rem; width: 22px; text-align: center; }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}
.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
}
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--candy-coral), var(--candy-pink));
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: .85rem;
  flex-shrink: 0;
}
.user-info .user-name  { font-size: .85rem; font-weight: 600; color: var(--text); }
.user-info .user-role  { font-size: .7rem;  color: var(--text-3); }

/* ── Layout principal ───────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.topbar {
  position: sticky;
  top: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
}
.content-area { padding: 32px; flex: 1; }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}
.dashboard-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.dashboard-stat-column {
  display: flex;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 26px;
  position: relative;
  overflow: hidden;
  transition: transform .25s, box-shadow .25s;
  min-height: 180px;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card .stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}
.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 2.3rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 10px;
}
.stat-card .stat-label {
  font-size: .9rem;
  color: var(--text-3);
  font-weight: 600;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card .stat-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 16px;
}
.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}
.stat-card .stat-label { font-size: .8rem; color: var(--text-3); font-weight: 500; }

/* ── Botones ────────────────────────────────────────────────── */
.btn-candy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: .95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--candy-coral), var(--candy-pink));
  color: #fff;
  box-shadow: 0 4px 15px rgba(255,78,106,.4);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(255,78,106,.5);
  color: #fff;
}
.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); color: var(--text); }

.btn-lg { padding: 16px 32px; font-size: 1.1rem; border-radius: 14px; }
.btn-sm { padding: 8px 16px;  font-size: .82rem; border-radius: 8px; }

.btn-success { background: var(--candy-mint);   color: #fff; }
.btn-danger  { background: var(--candy-coral);  color: #fff; }
.btn-warning { background: var(--candy-yellow); color: var(--text); }

/* ── Formularios ────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: .95rem;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255,78,106,.15);
}
.form-control-lg { padding: 16px 20px; font-size: 1.4rem; font-weight: 700; }

/* ── Tablas ─────────────────────────────────────────────────── */
.table-candy {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .9rem;
}
.table-candy th {
  padding: 12px 16px;
  text-align: left;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-3);
  border-bottom: 2px solid var(--border);
}
.table-candy td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table-candy tbody tr:hover { background: var(--surface2); }
.table-candy tbody tr:last-child td { border-bottom: none; }

/* ── Badges ─────────────────────────────────────────────────── */
.badge-candy {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.badge-emitido   { background: rgba(255,209,102,.2); color: #B87D00; }
.badge-cobrado   { background: rgba(6,214,160,.15);  color: #04A57A; }
.badge-cancelado { background: rgba(255,78,106,.12); color: var(--candy-coral); }
.badge-root      { background: rgba(255,78,106,.12); color: var(--candy-coral); }
.badge-operador  { background: rgba(17,138,178,.12); color: var(--candy-blue);  }
.badge-activo    { background: rgba(6,214,160,.15);  color: #04A57A; }
.badge-inactivo  { background: #eee; color: #999; }

/* ── Alertas ────────────────────────────────────────────────── */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alert-success { background: rgba(6,214,160,.12);  border-left: 4px solid var(--candy-mint);  color: #047A5A; }
.alert-error   { background: rgba(255,78,106,.1);  border-left: 4px solid var(--candy-coral); color: var(--candy-coral); }
.alert-info    { background: rgba(17,138,178,.1);  border-left: 4px solid var(--candy-blue);  color: var(--candy-blue); }

/* ── Impresión ticket 58mm ──────────────────────────────────── */
@media print {
  body { background: #fff !important; }
  .no-print { display: none !important; }
  .ticket-wrapper { margin: 0 !important; box-shadow: none !important; }
}

/* ── Responsive ─────────────────────────────────────────────── */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text);
  padding: 4px 8px;
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .menu-toggle { display: block; }
  .content-area { padding: 16px; }
  .topbar { padding: 12px 16px; }
}
.dashboard-main-row {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 1rem;
}
@media (min-width: 900px) {
  .dashboard-main-row {
    grid-template-columns: 1.2fr 1fr;
  }
}
.dashboard-action-column,
.dashboard-recent-column {
  display: flex;
}
.dashboard-action-card {
  border: 2px dashed var(--candy-pink);
  text-align: center;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  min-height: 260px;
  width: 100%;
  background: linear-gradient(180deg, rgba(255,255,255,.97), var(--surface));
}
.dashboard-action-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}
.dashboard-action-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  margin-bottom: 8px;
}
.dashboard-action-text {
  color: var(--text-3);
  font-size: .97rem;
  line-height: 1.7;
  margin-bottom: 20px;
  max-width: 320px;
}
.dashboard-action-button {
  display: inline-flex;
  margin: 0 auto;
}
.dashboard-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.dashboard-card-header h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  margin: 0;
}
.dashboard-empty-state {
  text-align: center;
  padding: 24px;
  color: var(--text-3);
}
.dashboard-empty-state > div {
  font-size: 2rem;
  margin-bottom: 8px;
}
.table-responsive {
  overflow-x: auto;
}
.dashboard-recent-card {
  padding: 22px;
  width: 100%;
}
.dashboard-recent-card .table-responsive {
  margin-top: 12px;
}
@media (max-width: 576px) {
  .dashboard-action-card {
    min-height: auto;
    padding: 24px 18px;
  }
  .dashboard-card-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .dashboard-action-button {
    width: 100%;
    justify-content: center;
  }
}

/* ── Inputs de monto grande ─────────────────────────────────── */
.monto-display {
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--accent);
  text-align: center;
  letter-spacing: -.02em;
}

/* ── Animaciones de entrada ─────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp .35s ease-out both; }
.fade-up-1 { animation-delay: .05s; }
.fade-up-2 { animation-delay: .10s; }
.fade-up-3 { animation-delay: .15s; }
.fade-up-4 { animation-delay: .20s; }
