/* ============================================
   TruffaClub - Main Stylesheet
   Version: 1.0.0
   Author: TruffaClub
   ============================================ */

/* ============================================
   CSS CUSTOM PROPERTIES / VARIABLES
   ============================================ */
:root {
  /* Colores principales */
  --color-forest-dark: #1a2f27;
  --color-forest: #2D4A3E;
  --color-forest-light: #3d5f50;
  --color-truffle-dark: #3d2b1f;
  --color-truffle: #5C4033;
  --color-truffle-light: #8b6f5c;
  --color-gold: #C9A962;
  --color-gold-light: #e0c98a;
  --color-gold-dark: #a68b4b;
  --color-cream: #FAF8F5;
  --color-cream-dark: #f0ebe3;
  --color-white: #FFFFFF;
  --color-text: #2C2C2C;
  --color-text-muted: #6B6B6B;
  --color-success: #4A7C59;
  --color-warning: #D4A03A;
  --color-error: #A94442;
  
  /* Tipografía */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  
  /* Espaciado */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  
  /* Bordes y sombras */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  --shadow-soft: 0 2px 8px rgba(45, 74, 62, 0.08);
  --shadow-medium: 0 4px 20px rgba(45, 74, 62, 0.12);
  --shadow-strong: 0 8px 40px rgba(45, 74, 62, 0.16);
  --shadow-glow-gold: 0 4px 30px rgba(201, 169, 98, 0.3);
  
  /* Transiciones */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s ease;
  
  /* Layout */
  --sidebar-width: 260px;
  --header-height: 60px;
  --bottom-nav-height: 70px;
}

/* ============================================
   RESET & BASE STYLES
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-cream);
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  color: var(--color-forest-dark);
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-gold);
}

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

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

input, select, textarea {
  font-family: var(--font-body);
  font-size: 1rem;
}

ul, ol {
  list-style: none;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.hidden { display: none !important; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.text-center { text-align: center; }
.text-muted { color: var(--color-text-muted); }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: all var(--transition-normal);
  cursor: pointer;
  text-decoration: none;
  border: none;
  outline: none;
}

.btn:focus-visible {
  outline: 2px solid var(--color-gold);
  outline-offset: 2px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-forest) 0%, var(--color-forest-dark) 100%);
  color: var(--color-white);
  box-shadow: 0 4px 15px rgba(45, 74, 62, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(45, 74, 62, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--color-cream);
  color: var(--color-forest);
  border: 1.5px solid var(--color-forest);
}

.btn-secondary:hover {
  background: var(--color-forest);
  color: var(--color-white);
}

.btn-gold {
  background: linear-gradient(135deg, var(--color-gold) 0%, var(--color-gold-light) 100%);
  color: var(--color-forest-dark);
  box-shadow: var(--shadow-glow-gold);
}

.btn-gold:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(201, 169, 98, 0.4);
}

.btn-sm {
  padding: var(--space-sm) var(--space-md);
  font-size: 0.8125rem;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* ============================================
   FORM ELEMENTS
   ============================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.form-group label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: var(--space-md);
  border: 1.5px solid var(--color-cream-dark);
  border-radius: var(--radius-md);
  background: var(--color-cream);
  transition: all var(--transition-fast);
  font-size: 1rem;
  width: 100%;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-forest);
  background: var(--color-white);
  box-shadow: 0 0 0 3px rgba(45, 74, 62, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--color-text-muted);
}

.form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B6B6B' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.form-description {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-lg);
}

/* ============================================
   AUTH SCREEN (LOGIN / REGISTER)
   ============================================ */
.auth-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(165deg, var(--color-forest-dark) 0%, var(--color-forest) 50%, var(--color-truffle-dark) 100%);
  position: relative;
  overflow: hidden;
}

.auth-screen::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    radial-gradient(ellipse at 20% 80%, rgba(201, 169, 98, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(201, 169, 98, 0.06) 0%, transparent 40%);
  pointer-events: none;
}

.auth-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  position: relative;
  z-index: 1;
}

.auth-logo {
  text-align: center;
  margin-bottom: var(--space-2xl);
  animation: fadeInDown 0.6s ease;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-logo-icon {
  width: 120px;
  height: 120px;
  margin: 0 auto var(--space-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 20px rgba(201, 169, 98, 0.4));
}

.auth-logo h1 {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 600;
  color: var(--color-white);
  letter-spacing: 0.02em;
}

.auth-logo p {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.7);
  margin-top: var(--space-xs);
  font-weight: 300;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--color-white);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  box-shadow: var(--shadow-strong);
  animation: fadeInUp 0.6s ease 0.2s both;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-tabs {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
  background: var(--color-cream);
  padding: var(--space-xs);
  border-radius: var(--radius-lg);
}

.auth-tab {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  border-radius: var(--radius-md);
  transition: all var(--transition-normal);
}

.auth-tab.active {
  background: var(--color-white);
  color: var(--color-forest);
  box-shadow: var(--shadow-soft);
}

.auth-tab:hover:not(.active) {
  color: var(--color-forest);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.auth-footer {
  text-align: center;
  margin-top: var(--space-xl);
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.auth-footer a {
  color: var(--color-forest);
  font-weight: 500;
}

/* ============================================
   MAIN APP LAYOUT
   ============================================ */
.app-container {
  display: none;
  min-height: 100vh;
}

.app-container.active {
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--color-white);
  border-bottom: 1px solid var(--color-cream-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
  z-index: 100;
  box-shadow: var(--shadow-soft);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.header-logo-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.header-logo span {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-forest-dark);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.header-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-cream);
  color: var(--color-forest);
  transition: all var(--transition-fast);
  position: relative;
}

.header-btn:hover {
  background: var(--color-forest);
  color: var(--color-white);
}

.header-btn svg {
  width: 20px;
  height: 20px;
}

.cart-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  background: var(--color-gold);
  color: var(--color-forest-dark);
  font-size: 0.6875rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Sidebar (Desktop) */
.app-sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  background: var(--color-white);
  border-right: 1px solid var(--color-cream-dark);
  padding: var(--space-xl) 0;
  display: none;
  flex-direction: column;
  z-index: 90;
  overflow-y: auto;
}

.sidebar-nav {
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-xl);
  color: var(--color-text-muted);
  font-size: 0.9375rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  border-left: 3px solid transparent;
  cursor: pointer;
}

.nav-item:hover {
  color: var(--color-forest);
  background: var(--color-cream);
}

.nav-item.active {
  color: var(--color-forest);
  background: linear-gradient(90deg, rgba(45, 74, 62, 0.08) 0%, transparent 100%);
  border-left-color: var(--color-gold);
}

.nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: var(--space-lg) var(--space-xl);
  border-top: 1px solid var(--color-cream-dark);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.sidebar-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-forest) 0%, var(--color-forest-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-white);
  font-weight: 600;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-email {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Bottom Navigation (Mobile) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: var(--color-white);
  border-top: 1px solid var(--color-cream-dark);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 var(--space-sm);
  padding-bottom: env(safe-area-inset-bottom, 0);
  z-index: 100;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-sm);
  color: var(--color-text-muted);
  font-size: 0.625rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  cursor: pointer;
  min-width: 60px;
}

.bottom-nav-item svg {
  width: 22px;
  height: 22px;
  transition: all var(--transition-fast);
}

.bottom-nav-item.active {
  color: var(--color-forest);
}

.bottom-nav-item.active svg {
  transform: scale(1.1);
}

/* Main Content */
.app-main {
  flex: 1;
  margin-top: var(--header-height);
  margin-bottom: var(--bottom-nav-height);
  padding: var(--space-lg);
  background: var(--color-cream);
  min-height: calc(100vh - var(--header-height) - var(--bottom-nav-height));
}

.page-section {
  display: none;
  animation: fadeIn 0.3s ease;
}

.page-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ============================================
   DASHBOARD / HOME
   ============================================ */
.welcome-banner {
  background: linear-gradient(135deg, var(--color-forest) 0%, var(--color-forest-dark) 100%);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  color: var(--color-white);
  position: relative;
  overflow: hidden;
  margin-bottom: var(--space-xl);
}

.welcome-banner::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(201, 169, 98, 0.15) 0%, transparent 70%);
  border-radius: var(--radius-full);
}

.welcome-banner h2 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  color: var(--color-white);
  margin-bottom: var(--space-xs);
  position: relative;
}

.welcome-banner p {
  font-size: 0.9375rem;
  opacity: 0.85;
  position: relative;
}

.welcome-date {
  font-size: 0.8125rem;
  opacity: 0.7;
  margin-top: var(--space-sm);
  position: relative;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.stat-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-soft);
  transition: all var(--transition-normal);
}

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

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-md);
}

.stat-icon svg {
  width: 22px;
  height: 22px;
}

.stat-icon.green {
  background: rgba(45, 74, 62, 0.1);
  color: var(--color-forest);
}

.stat-icon.gold {
  background: rgba(201, 169, 98, 0.15);
  color: var(--color-gold);
}

.stat-icon.brown {
  background: rgba(92, 64, 51, 0.1);
  color: var(--color-truffle);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-forest-dark);
  line-height: 1;
  margin-bottom: var(--space-xs);
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.375rem;
  color: var(--color-forest-dark);
}

.section-link {
  font-size: 0.8125rem;
  color: var(--color-forest);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.section-link:hover {
  color: var(--color-gold);
}

.upcoming-appointment {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-soft);
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.no-appointment {
  text-align: center;
  width: 100%;
  padding: var(--space-lg);
  color: var(--color-text-muted);
}

.no-appointment p {
  margin-bottom: var(--space-md);
}

.appointment-date-box {
  width: 60px;
  height: 70px;
  background: linear-gradient(135deg, var(--color-gold) 0%, var(--color-gold-light) 100%);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.appointment-day {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-forest-dark);
  line-height: 1;
}

.appointment-month {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--color-forest-dark);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.appointment-info {
  flex: 1;
  min-width: 0;
}

.appointment-title {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--color-text);
  margin-bottom: var(--space-xs);
}

.appointment-detail {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.appointment-detail svg {
  width: 14px;
  height: 14px;
}

.appointment-status {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: var(--space-xs);
}

.appointment-status.confirmed {
  background: rgba(74, 124, 89, 0.12);
  color: var(--color-success);
}

.appointment-status.pending {
  background: rgba(212, 160, 58, 0.12);
  color: var(--color-warning);
}

/* ============================================
   MIS ENCINAS
   ============================================ */
.encinas-grid {
  display: grid;
  gap: var(--space-md);
}

.encinas-empty {
  text-align: center;
  padding: var(--space-3xl);
  color: var(--color-text-muted);
}

.encina-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  transition: all var(--transition-normal);
  cursor: pointer;
}

.encina-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-medium);
}

.encina-card-header {
  height: 120px;
  background: linear-gradient(135deg, var(--color-forest-light) 0%, var(--color-forest) 100%);
  position: relative;
  overflow: hidden;
}

.encina-card-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 10 C20 25, 10 30, 30 50 C50 30, 40 25, 30 10' fill='rgba(255,255,255,0.05)'/%3E%3C/svg%3E");
  background-size: 60px;
  opacity: 0.3;
}

.encina-card-icon {
  position: absolute;
  bottom: -15px;
  right: var(--space-md);
  width: 50px;
  height: 50px;
  background: var(--color-gold);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-medium);
}

.encina-card-icon svg {
  width: 24px;
  height: 24px;
  fill: var(--color-forest-dark);
}

.encina-card-body {
  padding: var(--space-lg);
  padding-top: var(--space-xl);
}

.encina-name {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-forest-dark);
  margin-bottom: var(--space-xs);
}

.encina-location {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
}

.encina-location svg {
  width: 12px;
  height: 12px;
}

.encina-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.encina-status {
  display: inline-block;
  padding: 4px 10px;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: rgba(45, 74, 62, 0.1);
  color: var(--color-forest);
}

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

/* ============================================
   DETAIL PANEL (Encina Detail)
   ============================================ */
.detail-panel {
  position: fixed;
  top: 0;
  right: -100%;
  width: 100%;
  max-width: 450px;
  height: 100%;
  background: var(--color-white);
  z-index: 200;
  transition: right var(--transition-slow);
  display: flex;
  flex-direction: column;
  box-shadow: -5px 0 30px rgba(0, 0, 0, 0.15);
}

.detail-panel.open {
  right: 0;
}

.detail-panel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 199;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.detail-panel-overlay.open {
  opacity: 1;
  visibility: visible;
}

.detail-panel-header {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--color-cream-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.detail-panel-header h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
}

.detail-panel-close {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-cream);
  color: var(--color-text);
  transition: all var(--transition-fast);
}

.detail-panel-close:hover {
  background: var(--color-forest);
  color: var(--color-white);
}

.detail-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-xl);
}

.detail-hero {
  height: 180px;
  background: linear-gradient(135deg, var(--color-forest) 0%, var(--color-forest-dark) 100%);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.detail-hero::before {
  content: '';
  position: absolute;
  width: 200%;
  height: 200%;
  background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M50 15 C35 40, 20 50, 50 85 C80 50, 65 40, 50 15' fill='rgba(255,255,255,0.03)'/%3E%3C/svg%3E");
  background-size: 80px;
  animation: float 20s linear infinite;
}

@keyframes float {
  0% { transform: translate(0, 0); }
  100% { transform: translate(-50px, -50px); }
}

.detail-hero-icon {
  width: 80px;
  height: 80px;
  background: var(--color-gold);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.detail-hero-icon svg {
  width: 40px;
  height: 40px;
  fill: var(--color-forest-dark);
}

.detail-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--color-forest-dark);
  margin-bottom: var(--space-xs);
}

.detail-subtitle {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-xl);
}

.detail-section {
  margin-bottom: var(--space-xl);
}

.detail-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-md);
}

.detail-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

.detail-info-item {
  background: var(--color-cream);
  padding: var(--space-md);
  border-radius: var(--radius-md);
}

.detail-info-label {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.detail-info-value {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--color-text);
}

.detail-description {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--color-text);
}

.detail-panel-footer {
  padding: var(--space-lg);
  border-top: 1px solid var(--color-cream-dark);
}

/* ============================================
   TRUFFACOIN
   ============================================ */
.truffacoin-balance {
  background: linear-gradient(135deg, var(--color-gold) 0%, var(--color-gold-light) 100%);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  text-align: center;
  margin-bottom: var(--space-xl);
  position: relative;
  overflow: hidden;
}

.truffacoin-balance::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='30' cy='30' r='20' fill='none' stroke='rgba(255,255,255,0.1)' stroke-width='2'/%3E%3C/svg%3E");
  background-size: 60px;
}

.truffacoin-icon {
  width: 70px;
  height: 70px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-md);
  position: relative;
}

.truffacoin-icon img {
  width: 40px;
  height: 40px;
}

.truffacoin-amount {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 700;
  color: var(--color-forest-dark);
  line-height: 1;
  position: relative;
}

.truffacoin-label {
  font-size: 0.875rem;
  color: var(--color-truffle);
  font-weight: 500;
  margin-top: var(--space-xs);
  position: relative;
}

.truffacoin-info {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-xl);
  box-shadow: var(--shadow-soft);
}

.truffacoin-info h3 {
  font-family: var(--font-display);
  font-size: 1.125rem;
  color: var(--color-forest-dark);
  margin-bottom: var(--space-sm);
}

.truffacoin-info p {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  line-height: 1.6;
}

.movements-list {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.movements-empty {
  padding: var(--space-2xl);
  text-align: center;
  color: var(--color-text-muted);
}

.movement-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-cream);
}

.movement-item:last-child {
  border-bottom: none;
}

.movement-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.movement-icon.positive {
  background: rgba(74, 124, 89, 0.12);
  color: var(--color-success);
}

.movement-icon.negative {
  background: rgba(169, 68, 66, 0.1);
  color: var(--color-error);
}

.movement-icon svg {
  width: 18px;
  height: 18px;
}

.movement-info {
  flex: 1;
  min-width: 0;
}

.movement-description {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 2px;
}

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

.movement-amount {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
}

.movement-amount.positive {
  color: var(--color-success);
}

.movement-amount.negative {
  color: var(--color-error);
}

/* ============================================
   TIENDA / PRODUCTOS
   ============================================ */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-md);
}

.products-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-3xl);
  color: var(--color-text-muted);
}

.product-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  transition: all var(--transition-normal);
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-medium);
}

.product-image {
  width: 100%;
  height: 140px;
  background: var(--color-cream);
  position: relative;
  overflow: hidden;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

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

.product-badge {
  position: absolute;
  top: var(--space-sm);
  left: var(--space-sm);
  padding: 3px 8px;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: var(--radius-sm);
  background: var(--color-gold);
  color: var(--color-forest-dark);
}

.product-body {
  padding: var(--space-md);
}

.product-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--color-text);
  margin-bottom: var(--space-xs);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.5em;
}

.product-prices {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.product-price-club {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-forest);
}

.product-price-original {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  text-decoration: line-through;
}

.product-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.product-btn {
  width: 100%;
  padding: var(--space-sm);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.product-btn-cart {
  background: var(--color-forest);
  color: var(--color-white);
}

.product-btn-cart:hover {
  background: var(--color-forest-dark);
}

.product-btn-coin {
  background: transparent;
  color: var(--color-gold-dark);
  border: 1px solid var(--color-gold);
}

.product-btn-coin:hover {
  background: var(--color-gold);
  color: var(--color-forest-dark);
}

/* ============================================
   CART PANEL
   ============================================ */
.cart-panel {
  position: fixed;
  top: 0;
  right: -100%;
  width: 100%;
  max-width: 380px;
  height: 100%;
  background: var(--color-white);
  z-index: 200;
  transition: right var(--transition-slow);
  display: flex;
  flex-direction: column;
  box-shadow: -5px 0 30px rgba(0, 0, 0, 0.15);
}

.cart-panel.open {
  right: 0;
}

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

.cart-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--color-forest-dark);
}

.cart-close {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-cream);
  color: var(--color-text);
  transition: all var(--transition-fast);
}

.cart-close:hover {
  background: var(--color-forest);
  color: var(--color-white);
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md);
}

.cart-item {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--color-cream);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
}

.cart-item-image {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-sm);
  background: var(--color-white);
  overflow: hidden;
  flex-shrink: 0;
}

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

.cart-item-info {
  flex: 1;
  min-width: 0;
}

.cart-item-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 2px;
}

.cart-item-price {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-forest);
}

.cart-item-remove {
  color: var(--color-text-muted);
  padding: var(--space-xs);
  transition: color var(--transition-fast);
  align-self: flex-start;
}

.cart-item-remove:hover {
  color: var(--color-error);
}

.cart-item-remove svg {
  width: 18px;
  height: 18px;
}

.cart-empty {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--color-text-muted);
}

.cart-empty svg {
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.cart-footer {
  padding: var(--space-lg);
  border-top: 1px solid var(--color-cream-dark);
}

.cart-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.cart-total-label {
  font-weight: 500;
  color: var(--color-text);
}

.cart-total-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-forest-dark);
}

/* ============================================
   CITAS / APPOINTMENTS
   ============================================ */
.appointment-form {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin-bottom: var(--space-xl);
  box-shadow: var(--shadow-soft);
}

.appointment-form h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--color-forest-dark);
  margin-bottom: var(--space-sm);
}

.appointments-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.appointments-empty {
  text-align: center;
  padding: var(--space-2xl);
  background: var(--color-white);
  border-radius: var(--radius-lg);
  color: var(--color-text-muted);
}

.appointment-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-soft);
  display: flex;
  align-items: flex-start;
  gap: var(--space-lg);
}

.appointment-card .appointment-info {
  flex: 1;
}

.appointment-card .appointment-title {
  margin-bottom: var(--space-sm);
}

.appointment-details {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  align-items: center;
}

.appointment-note {
  margin-top: var(--space-md);
  padding: var(--space-md);
  background: var(--color-cream);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
}

.appointment-note svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-top: 2px;
}

/* ============================================
   PERFIL / PROFILE
   ============================================ */
.profile-header {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.profile-avatar {
  width: 100px;
  height: 100px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-forest) 0%, var(--color-forest-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-md);
  color: var(--color-white);
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 600;
  box-shadow: var(--shadow-medium);
}

.profile-name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--color-forest-dark);
  margin-bottom: var(--space-xs);
}

.profile-email {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.profile-section {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  margin-bottom: var(--space-lg);
}

.profile-section-header {
  padding: var(--space-md) var(--space-lg);
  background: var(--color-cream);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
}

.profile-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-cream);
}

.profile-item:last-child {
  border-bottom: none;
}

.profile-item-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.profile-item-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--color-cream);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-forest);
  flex-shrink: 0;
}

.profile-item-icon svg {
  width: 18px;
  height: 18px;
}

.profile-item-label {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.profile-item-value {
  font-weight: 500;
  font-size: 0.9375rem;
  color: var(--color-text);
}

.profile-item-action {
  color: var(--color-text-muted);
}

.profile-item-action svg {
  width: 16px;
  height: 16px;
}

.profile-item.clickable {
  cursor: pointer;
  transition: background var(--transition-fast);
}

.profile-item.clickable:hover {
  background: var(--color-cream);
}

.profile-logout {
  width: 100%;
  margin-top: var(--space-xl);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + var(--space-md));
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  width: calc(100% - var(--space-xl) * 2);
  max-width: 400px;
  pointer-events: none;
}

.toast {
  background: var(--color-forest-dark);
  color: var(--color-white);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  box-shadow: var(--shadow-strong);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  pointer-events: auto;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(20px);
  }
}

.toast svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.toast.success {
  background: var(--color-success);
}

.toast.error {
  background: var(--color-error);
}

.toast.warning {
  background: var(--color-warning);
  color: var(--color-forest-dark);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (min-width: 768px) {
  .app-sidebar {
    display: flex;
  }

  .app-main {
    margin-left: var(--sidebar-width);
    margin-bottom: 0;
    padding: var(--space-2xl);
  }

  .bottom-nav {
    display: none;
  }

  .toast-container {
    bottom: var(--space-xl);
  }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .encinas-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .products-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .form-row {
    grid-template-columns: repeat(3, 1fr);
  }

  .detail-info-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .encinas-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .products-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .appointments-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1280px) {
  .encinas-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .products-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
  .app-header,
  .app-sidebar,
  .bottom-nav,
  .cart-panel,
  .detail-panel,
  .toast-container {
    display: none !important;
  }

  .app-main {
    margin: 0;
    padding: var(--space-lg);
  }
}
