/* ==========================================================================
   THE CANDY POINT - DESIGN SYSTEM & BRAND STYLES
   Main Palette: Candy Pink #D81B60, Dark Wine #3A091F, Mint #00BCD4, Sun Yellow #FFC107
   ========================================================================== */

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

:root {
  --candy-primary: #D81B60;
  --candy-primary-hover: #C2185B;
  --candy-primary-light: #FCE4EC;
  --candy-dark-wine: #3A091F;
  --candy-sidebar-bg: #230513;
  --candy-accent-yellow: #FFC107;
  --candy-accent-mint: #00BCD4;
  --candy-accent-purple: #7B1FA2;
  --candy-bg-light: #FBF7F9;
  --candy-card-bg: #FFFFFF;
  --candy-text-dark: #2D1B25;
  --candy-text-muted: #8C7883;
  --candy-border-color: #F0E2E7;
  --candy-shadow: 0 10px 30px rgba(216, 27, 96, 0.08);
  --candy-shadow-hover: 0 15px 35px rgba(216, 27, 96, 0.16);
  --candy-radius-sm: 10px;
  --candy-radius-md: 16px;
  --candy-radius-lg: 24px;
}

/* Tema 2: Candy Neon (Modo Oscuro / Nocturno) */
body.theme-neon {
  --candy-primary: #FF4081;
  --candy-primary-hover: #F50057;
  --candy-primary-light: #3D1226;
  --candy-dark-wine: #120310;
  --candy-sidebar-bg: #0D020D;
  --candy-accent-yellow: #FFD600;
  --candy-accent-mint: #00E5FF;
  --candy-bg-light: #1A131B;
  --candy-card-bg: #271C29;
  --candy-text-dark: #F3E5F5;
  --candy-text-muted: #B39DDB;
  --candy-border-color: #3D2940;
}

/* Tema 3: Pastel Sweet Shop (Suave & Delicado) */
body.theme-pastel {
  --candy-primary: #EC407A;
  --candy-primary-hover: #D81B60;
  --candy-primary-light: #FCE4EC;
  --candy-dark-wine: #4A148C;
  --candy-sidebar-bg: #311B92;
  --candy-accent-yellow: #FFEE58;
  --candy-accent-mint: #26A69A;
  --candy-bg-light: #FFF9FA;
  --candy-card-bg: #FFFFFF;
  --candy-text-dark: #37474F;
  --candy-text-muted: #78909C;
  --candy-border-color: #F8BBD0;
}

/* Tema 4: Royal Ice Cream & Gold (Elegante Dorado & Vino) */
body.theme-gold {
  --candy-primary: #C2185B;
  --candy-primary-hover: #AD1457;
  --candy-primary-light: #F8BBD0;
  --candy-dark-wine: #1F0412;
  --candy-sidebar-bg: #14020B;
  --candy-accent-yellow: #FFD700;
  --candy-accent-mint: #00ACC1;
  --candy-bg-light: #FAF5F8;
  --candy-card-bg: #FFFFFF;
  --candy-text-dark: #2A0818;
  --candy-text-muted: #7E576B;
  --candy-border-color: #F3D2E2;
}

body {
  font-family: 'Poppins', sans-serif;
  background-color: var(--candy-bg-light);
  color: var(--candy-text-dark);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

/* Candy Typography Header */
.candy-brand-title {
  font-family: 'Fredoka', cursive;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #FFFFFF 0%, #FFE0B2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  background: linear-gradient(135deg, var(--candy-primary) 0%, #FF4081 100%);
  color: #fff;
  border-radius: 30px;
  padding: 4px 14px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Sidebar & Navigation */
.candy-sidebar {
  background: var(--candy-sidebar-bg);
  min-height: 100vh;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 4px 0 25px rgba(0,0,0,0.15);
}

/* Collapsed sidebar */
.candy-sidebar.collapsed {
  width: 0;
  padding: 0;
  overflow: hidden;
}

/* Adjust main content when sidebar collapsed */
#main-content {
  transition: margin-left 0.3s ease;
}
.candy-sidebar.collapsed + #main-content {
  margin-left: 0;
}


.candy-nav-link {
  color: rgba(255, 255, 255, 0.75);
  padding: 12px 18px;
  border-radius: var(--candy-radius-md);
  font-weight: 500;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
  text-decoration: none;
}

.candy-nav-link:hover, .candy-nav-link.active {
  background: linear-gradient(135deg, var(--candy-primary) 0%, #E91E63 100%);
  color: #FFFFFF;
  box-shadow: 0 8px 20px rgba(216, 27, 96, 0.4);
  transform: translateX(4px);
}

/* Category Filter Pills */
.category-pill {
  background: #FFFFFF;
  border: 2px solid var(--candy-border-color);
  color: var(--candy-text-dark);
  border-radius: 30px;
  padding: 8px 20px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.25s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

.category-pill:hover, .category-pill.active {
  background: var(--candy-primary);
  color: #FFFFFF;
  border-color: var(--candy-primary);
  box-shadow: 0 8px 20px rgba(216, 27, 96, 0.25);
  transform: translateY(-2px);
}

/* Product Card */
.product-card {
  background: var(--candy-card-bg);
  border-radius: var(--candy-radius-md);
  border: 1px solid var(--candy-border-color);
  box-shadow: var(--candy-shadow);
  transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.product-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 14px 30px rgba(216, 27, 96, 0.22);
  border-color: var(--candy-primary);
}

.product-img-wrapper {
  height: 110px;
  background: radial-gradient(circle, #FFF0F5 0%, #FCE4EC 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-size: 2.8rem;
}

.product-badge-type {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--candy-primary);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.product-title {
  font-weight: 700;
  font-size: 0.84rem;
  color: var(--candy-text-dark);
  margin-bottom: 6px;
  line-height: 1.25;
  word-break: break-word;
  display: block;
  transition: color 0.2s ease;
  min-height: 2.2rem;
}

.product-card:hover .product-title {
  color: var(--candy-primary);
}

.product-price {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--candy-primary);
}

.product-stock {
  font-size: 0.75rem;
  color: var(--candy-text-muted);
}

/* Cart Container */
.cart-container {
  background: #FFFFFF;
  border-radius: var(--candy-radius-lg);
  border: 1px solid var(--candy-border-color);
  box-shadow: var(--candy-shadow);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 100px);
  max-height: calc(100vh - 100px);
  position: sticky;
  top: 10px;
}

.cart-header {
  background: linear-gradient(135deg, var(--candy-dark-wine) 0%, #4A0E2E 100%);
  color: #fff;
  padding: 18px 24px;
  border-top-left-radius: var(--candy-radius-lg);
  border-top-right-radius: var(--candy-radius-lg);
}

.cart-items-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.cart-item {
  background: #FAFAFA;
  border: 1px solid var(--candy-border-color);
  border-radius: var(--candy-radius-sm);
  padding: 12px 14px;
  margin-bottom: 10px;
  transition: all 0.2s ease;
}

.cart-item:hover {
  background: #FFF5F8;
  border-color: var(--candy-primary-light);
}

.cart-footer {
  background: #FDF8F9;
  border-top: 1px solid var(--candy-border-color);
  padding: 20px;
  border-bottom-left-radius: var(--candy-radius-lg);
  border-bottom-right-radius: var(--candy-radius-lg);
}

/* Metric Cards for Dashboard */
.metric-card {
  background: #FFFFFF;
  border-radius: var(--candy-radius-md);
  padding: 20px 24px;
  border: 1px solid var(--candy-border-color);
  box-shadow: var(--candy-shadow);
  position: relative;
  overflow: hidden;
}

.metric-icon-bg {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.metric-card.primary .metric-icon-bg { background: rgba(216, 27, 96, 0.12); color: var(--candy-primary); }
.metric-card.success .metric-icon-bg { background: rgba(0, 200, 83, 0.12); color: #00C853; }
.metric-card.warning .metric-icon-bg { background: rgba(255, 193, 7, 0.15); color: #FF8F00; }
.metric-card.info .metric-icon-bg { background: rgba(0, 188, 212, 0.12); color: var(--candy-accent-mint); }

/* Buttons */
.btn-candy-primary {
  background: linear-gradient(135deg, var(--candy-primary) 0%, #E91E63 100%);
  color: #FFFFFF;
  border: none;
  font-weight: 700;
  border-radius: var(--candy-radius-md);
  padding: 12px 24px;
  box-shadow: 0 8px 20px rgba(216, 27, 96, 0.3);
  transition: all 0.25s ease;
}

.btn-candy-primary:hover {
  background: linear-gradient(135deg, #C2185B 0%, #D81B60 100%);
  color: #FFFFFF;
  transform: translateY(-2px);
  box-shadow: 0 12px 25px rgba(216, 27, 96, 0.4);
}

.btn-candy-dark {
  background: var(--candy-dark-wine);
  color: #FFFFFF;
  border: none;
  font-weight: 600;
  border-radius: var(--candy-radius-md);
  padding: 10px 20px;
}

.btn-candy-dark:hover {
  background: #230513;
  color: #FFFFFF;
}

/* Receipt Modal Styles */
.thermal-receipt {
  font-family: 'Courier New', Courier, monospace;
  background: #FFF;
  color: #000;
  padding: 20px;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  border: 1px dashed #ccc;
}

.receipt-dashed-line {
  border-top: 1px dashed #000;
  margin: 10px 0;
}

/* ==========================================================================
   SIDEBAR COLLAPSE & CONTENT EXPANSION
   ========================================================================== */
#main-sidebar {
  transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

#main-content {
  transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

#main-sidebar.collapsed {
  flex: 0 0 78px !important;
  max-width: 78px !important;
  width: 78px !important;
  padding: 14px 8px !important;
}

#main-sidebar.collapsed .sidebar-brand-wrapper,
#main-sidebar.collapsed .candy-nav-link span,
#main-sidebar.collapsed nav > div.text-uppercase,
#main-sidebar.collapsed .user-info-text,
#main-sidebar.collapsed #theme-selector,
#main-sidebar.collapsed small {
  display: none !important;
}

#main-sidebar.collapsed .candy-nav-link {
  justify-content: center;
  padding: 12px 0;
  margin-bottom: 8px;
}

#main-sidebar.collapsed .candy-nav-link i {
  font-size: 1.4rem;
  margin: 0;
}

#main-content.expanded {
  flex: 0 0 calc(100% - 78px) !important;
  max-width: calc(100% - 78px) !important;
  width: calc(100% - 78px) !important;
}

/* ==========================================================================
   CATEGORÍAS COLAPSABLES & EXPANSIÓN DE PRODUCTOS
   ========================================================================== */
#categories-column {
  transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

#products-column {
  transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

/* POS FLEXBOX LAYOUT & COLLAPSIBLE CATEGORIES */
#view-pos.d-none {
  display: none !important;
}

#view-pos:not(.d-none) {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: flex-start !important;
  gap: 15px !important;
}

#categories-column {
  flex: 0 0 220px !important;
  max-width: 220px !important;
  width: 220px !important;
  transition: all 0.3s ease-in-out !important;
}

#categories-column.collapsed {
  flex: 0 0 72px !important;
  max-width: 72px !important;
  width: 72px !important;
  padding-left: 4px !important;
  padding-right: 4px !important;
}

#categories-column.collapsed .categories-title-text,
#categories-column.collapsed .cat-label {
  display: none !important;
}

#categories-column.collapsed .category-pill {
  justify-content: center !important;
  padding: 10px 0 !important;
  text-align: center !important;
}

#categories-column.collapsed .category-pill i,
#categories-column.collapsed .category-pill .cat-icon {
  margin: 0 !important;
  font-size: 1.3rem !important;
}

#products-column {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  max-width: none !important;
  transition: all 0.3s ease-in-out !important;
}

#cart-column {
  flex: 0 0 360px !important;
  max-width: 360px !important;
  width: 360px !important;
  transition: all 0.3s ease-in-out !important;
}

/* ESTILOS DE IMPRESIÓN PARA IMPRESORA TÉRMICA DE TICKETS (58mm / 80mm) */
@media print {
  body * {
    visibility: hidden !important;
  }
  #printable-thermal-area, #printable-thermal-area * {
    visibility: visible !important;
  }
  #printable-thermal-area {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
  }
  .modal, .modal-backdrop {
    position: static !important;
    background: none !important;
  }
}

/* MODAL POPUP PERSONALIZADO SWEET CANDY (CENTRADITO CON CARAMELITO 🍬) */
.modal-sweet-alert {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(0, 0, 0, 0.45) !important;
  backdrop-filter: blur(5px) !important;
  -webkit-backdrop-filter: blur(5px) !important;
  z-index: 9999999 !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 15px !important;
}

.modal-sweet-alert.show {
  display: flex !important;
}

.modal-sweet-card {
  width: 100% !important;
  max-width: 380px !important;
  background: linear-gradient(145deg, #ffffff 0%, #fff4f8 100%) !important;
  border: 3px solid var(--candy-primary) !important;
  animation: sweetPopIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards !important;
}

@keyframes sweetPopIn {
  0% { transform: scale(0.7); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* PROTECCIÓN ANTI-BLOQUEO: PREVIENE PANTALLAS GRISES U OPACAS RESIDUALES EN TODAS LAS VISTAS */
body:not(.modal-open) .modal-backdrop {
  display: none !important;
  pointer-events: none !important;
}
