/* --- Variables & Theme --- */
:root {
  /* Palette - Formal & Professional (Navy & Gold) */
  --primary: #1B365D; /* Navy Blue (Vestidores Main) */
  --primary-hover: #102442; /* Darker Navy */
  
  --secondary: #C5A059; /* Muted Gold/Bronze (Virgen Touch) */
  --secondary-hover: #A68545; /* Darker Gold */

  --accent: #D97706; /* Burnt Amber (Highlights) */
  --danger: #991B1B; /* Dark Red (More formal than bright red) */

  --bg-body: #F9FAFB; /* Very light gray/white */
  --bg-card: #FFFFFF; /* Pure white */
  --bg-glass: rgba(255, 255, 255, 0.9);

  --text-main: #1F2937; /* Dark Gray (Softer than pure black) */
  --text-muted: #6B7280; /* Medium Gray */
  --text-light: #F3F4F6;

  /* Shadows - More subtle and refined */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08);

  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;

  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
}

/* --- Reset & Base --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-body);
  background-image:
    radial-gradient(at 0% 0%, rgba(27, 54, 93, 0.05) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(197, 160, 89, 0.1) 0px, transparent 50%);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  text-decoration: none;
  color: inherit;
}

input,
button,
textarea,
select {
  font: inherit;
  outline: none;
}

/* --- Layout utils --- */
.main-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
  min-height: 100vh;
  position: relative;
}

/* --- Typography --- */
h1,
h2,
h3 {
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-main);
}

/* --- Components: Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  box-shadow: var(--shadow-sm);
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled, .btn.btn-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  background-color: #f3f4f6 !important;
  color: #9ca3af !important;
  border-color: #e5e7eb !important;
  box-shadow: none !important;
}

.btn-primary {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-hover) 100%
  );
  color: white;
}

.btn-primary:hover {
  box-shadow: 0 0 15px rgba(79, 70, 229, 0.4);
}

.btn-secondary {
  background-color: white;
  color: var(--text-main);
  border: 1px solid #e5e7eb;
}

.btn-secondary:hover {
  background-color: #f9fafb;
  border-color: #d1d5db;
}

.btn-danger {
  background-color: var(--danger);
  color: white;
}

.btn-danger:hover {
  background-color: #dc2626;
}

.back-button {
  margin-bottom: 1rem;
  display: block;
}

/* --- Components: Cards --- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

/* --- Home Page Specifics --- */
.home-header {
  text-align: center;
  margin-bottom: 3rem;
  padding-top: 2rem;
}

.family-photo-container {
  width: 100%;
  max-width: 380px;
  height: auto;
  aspect-ratio: 16 / 10;
  margin: 0 auto 1.5rem;
  padding: 4px;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.family-photo {
  width: 100%;
  height: 100%;
  border-radius: calc(var(--radius-lg) - 4px);
  object-fit: cover;
}

.app-title {
  font-size: 2.5rem;
  background: linear-gradient(to right, var(--primary), var(--secondary)); /* Navy to Gold */
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
  text-transform: uppercase; /* More formal */
  letter-spacing: 2px;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  max-width: 900px;
  margin: 0 auto;
}

.menu-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2rem;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  cursor: pointer;
  border: 1px solid transparent;
}

.menu-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-xl);
  border-color: var(--primary);
}

.menu-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.menu-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.menu-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* --- Modal --- */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 100;
  padding: 2rem 1rem;
}

.modal.hidden {
  display: none;
}

.modal-content {
  width: 90%;
  max-width: 650px;
  background: var(--bg-card);
  padding: 2rem;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  animation: slideUp 0.3s ease-out;
  margin: auto;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: var(--radius-sm);
  transition: border-color 0.2s;
  background: #f9fafb;
  font-family: inherit;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 1.5rem;
}

/* Floating Action Button (FAB) - Enhanced */
.fab-btn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 70px; /* Larger */
  height: 70px; /* Larger */
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 2.5rem; /* Larger icon */
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.5); /* Stronger shadow */
  cursor: pointer;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  z-index: 1000;
}

.fab-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.7);
}

.fab-btn:active {
  transform: scale(0.95);
}

/* --- Sync Indicator --- */
.sync-indicator {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  padding: 8px 20px;
  border-radius: 30px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #e5e7eb;
  white-space: nowrap;
  transition: opacity 0.3s;
}

/* Mobile responsive */
@media (max-width: 600px) {
  .modal-content {
    width: 95vw !important;
    max-width: 95vw !important;
    min-width: 300px;
    padding: 1.25rem !important;
    max-height: 90vh;
    overflow-y: auto;
    margin: auto;
  }
}

/* --- Versión 0.4.0 Enhancements --- */
:root {
  --success: #10B981;
}

/* Form Layout in Grid */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.col-span-2 {
  grid-column: span 2;
}

@media (max-width: 600px) {
  .form-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .col-span-2 {
    grid-column: span 1;
  }
}

/* Stats Dashboard Card styles */
.stats-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1rem;
  text-align: center;
  border: 1px solid rgba(229, 231, 235, 0.5);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--primary);
  opacity: 0.7;
}

.stat-card.stat-primary::after { background: var(--primary); }
.stat-card.stat-secondary::after { background: var(--secondary); }
.stat-card.stat-success::after { background: var(--success); }
.stat-card.stat-neutral::after { background: #6B7280; }

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.stat-val {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.stat-lbl {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
}

@media (max-width: 768px) {
  .stats-container {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Search and Filters Bar */
.search-filter-bar {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border: 1px solid rgba(229, 231, 235, 0.5);
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border: 1px solid #d1d5db;
  border-radius: var(--radius-md);
  background: #f9fafb;
  font-size: 0.95rem;
  transition: all 0.2s;
}

.search-box input:focus {
  background: white;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27, 54, 93, 0.15);
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  color: var(--text-muted);
  font-size: 1.1rem;
  pointer-events: none;
}

.filter-tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.filter-tabs::-webkit-scrollbar {
  display: none;
}

.filter-tab {
  padding: 0.45rem 1.1rem;
  border-radius: 99px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  background: #f3f4f6;
  color: var(--text-muted);
  border: 1px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}

.filter-tab:hover {
  background: #e5e7eb;
  color: var(--text-main);
}

.filter-tab.active {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

.filter-tab.active.tab-vestidor {
  background: var(--primary);
}
.filter-tab.active.tab-voluntario {
  background: var(--secondary);
}
.filter-tab.active.tab-extra {
  background: #6B7280;
}

/* Enhanced Cards */
.person-card {
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border-left: 5px solid var(--primary);
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  animation: fadeInCard 0.35s ease-out;
  cursor: pointer;
}

.person-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  background: #fafbfc;
}

.person-card.category-Vestidor {
  border-left-color: var(--primary);
}
.person-card.category-Voluntario {
  border-left-color: var(--secondary);
}
.person-card.category-Extra {
  border-left-color: #6B7280;
}

.person-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.person-details-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-top: 1px solid #f3f4f6;
  padding-top: 0.75rem;
  margin-top: 0.25rem;
}

.detail-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-icon {
  font-size: 1rem;
  opacity: 0.85;
  flex-shrink: 0;
  display: inline-block;
  width: 1.2rem;
  text-align: center;
}

.person-collapsible-wrapper {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  margin-top: 0;
  transition: max-height 300ms cubic-bezier(0.16, 1, 0.3, 1),
              opacity 300ms cubic-bezier(0.16, 1, 0.3, 1),
              margin-top 300ms cubic-bezier(0.16, 1, 0.3, 1);
}

.person-card.expanded .person-collapsible-wrapper {
  max-height: 500px;
  opacity: 1;
  margin-top: 0.75rem;
}

.card-chevron {
  font-size: 0.7rem;
  color: var(--text-muted);
  transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1);
  margin-left: 0.5rem;
  align-self: center;
  pointer-events: none;
}

.person-card.expanded .card-chevron {
  transform: rotate(180deg);
}

.card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.75rem;
  border-top: 1px dashed #e5e7eb;
  padding-top: 0.75rem;
}

.card-actions .btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
}

@media (max-width: 600px) {
  .person-details-grid {
    grid-template-columns: 1fr;
  }
}

@keyframes fadeInCard {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Ofrenda Folders & Photo Gallery --- */
.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.folder-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.25rem 1rem;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(229, 231, 235, 0.5);
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
}

.folder-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.folder-card-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.folder-card-thumbnail {
  width: 70px;
  height: 70px;
  background-size: cover;
  background-position: center;
  border-radius: var(--radius-md);
  margin-bottom: 0.5rem;
  border: 1px solid rgba(229, 231, 235, 0.7);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease;
}

.folder-card:hover .folder-card-thumbnail {
  transform: scale(1.05);
}

.folder-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  word-break: break-word;
}

.folder-card-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.folder-delete-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(153, 27, 27, 0.1);
  color: var(--danger);
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.2s;
}

.folder-delete-btn:hover {
  background: rgba(153, 27, 27, 0.2);
}

/* Photo Gallery styling */
.photo-gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.75rem;
}

.photo-card {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid #e5e7eb;
}

.photo-card:hover {
  transform: scale(1.03);
  box-shadow: var(--shadow-md);
}

.photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-delete-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s;
}

.photo-delete-btn:hover {
  background: var(--danger);
}

/* --- Vestidor Photo Styles (v0.5.0) --- */
.person-main-row {
  display: flex;
  gap: 1rem;
  align-items: center;
  width: 100%;
}

.vestidor-photo-container {
  width: 60px;
  height: 80px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  border: 1px solid #e5e7eb;
  background-color: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.vestidor-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.vestidor-photo-placeholder {
  font-size: 2.2rem;
  color: var(--text-muted);
  user-select: none;
}

/* Hover overlay for admin photo upload */
.vestidor-photo-container.admin-editable {
  cursor: pointer;
}

.vestidor-photo-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(27, 54, 93, 0.6); /* Navy with opacity */
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.vestidor-photo-container.admin-editable:hover .vestidor-photo-overlay {
  opacity: 1;
}

/* Quick delete button on photo */
.vestidor-photo-delete-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  background: rgba(153, 27, 27, 0.9);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
  cursor: pointer;
  z-index: 10;
  border: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  transition: background 0.2s;
}

.vestidor-photo-delete-badge:hover {
  background: #dc2626;
}

/* --- Posiciones Manto Styles (v0.6.0) --- */
.posiciones-layout {
  display: flex;
  gap: 1.5rem;
  margin-top: 1rem;
  min-height: 600px;
}

@media (max-width: 768px) {
  .posiciones-layout {
    flex-direction: column-reverse;
    min-height: auto;
  }
}

.manto-viewport {
  flex: 3;
  position: relative;
  background-color: #0c1524;
  border-radius: var(--radius-lg);
  border: 1px solid #1e293b;
  overflow: hidden;
  height: 600px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 768px) {
  .manto-viewport {
    height: 400px;
  }
}

.manto-zoom-container {
  position: relative;
  transform-origin: center center;
  transition: transform 0.15s ease-out;
  cursor: grab;
  user-select: none;
  display: inline-block;
}

.manto-zoom-container:active {
  cursor: grabbing;
}

#manto-image {
  max-width: 100%;
  max-height: 580px;
  display: block;
  pointer-events: none; /* Let drag events pass through to container */
  border-radius: var(--radius-md);
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

@media (max-width: 768px) {
  #manto-image {
    max-height: 380px;
  }
}

.pins-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.manto-pin {
  position: absolute;
  transform: translate(-50%, -50%); /* Center pin on coordinate */
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid #c5a059; /* Gold border */
  background: var(--bg-card);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s;
  cursor: grab;
  user-select: none;
}

.manto-pin:hover, .manto-pin.active {
  transform: translate(-50%, -50%) scale(1.18);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4);
  z-index: 105;
}

.manto-pin:active {
  cursor: grabbing;
}

.manto-pin.read-only {
  cursor: pointer;
}

/* Avatar image styles inside pin */
.manto-pin-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.manto-pin-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Initials placeholder when no photo exists */
.manto-pin-initials {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #818cf8);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
}

/* Tooltip style */
.manto-pin-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) scale(0.8);
  background: rgba(15, 23, 42, 0.95);
  color: #f8fafc;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 110;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Arrow indicator for tooltip */
.manto-pin-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: rgba(15, 23, 42, 0.95) transparent transparent transparent;
}

.manto-pin.active .manto-pin-tooltip {
  opacity: 1;
  transform: translateX(-50%) scale(1);
  pointer-events: auto;
}

/* Remove button badge position adjusted for circular pin */
.manto-pin .pin-remove-btn {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: white;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 0.8rem;
  font-weight: bold;
  border: 1.5px solid white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  z-index: 102;
  transition: background-color 0.2s, transform 0.1s;
}

.manto-pin .pin-remove-btn:hover {
  background: #dc2626;
  transform: scale(1.1);
  color: white;
}

.posiciones-sidebar {
  flex: 1;
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid #e5e7eb;
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  max-height: 600px;
}

@media (max-width: 768px) {
  .posiciones-sidebar {
    max-height: 300px;
  }
}

.unpositioned-list-container {
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding-right: 0.25rem;
}

.unpositioned-item {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-main);
  cursor: grab;
  transition: background-color 0.2s, border-color 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  user-select: none;
}

.unpositioned-item:active {
  cursor: grabbing;
}

.unpositioned-item:hover {
  background: #f1f5f9;
  border-color: var(--primary);
}

.unpositioned-item::before {
  content: "☰";
  color: #94a3b8;
  font-size: 0.75rem;
}

.unpositioned-item.selected-for-placement {
  background: rgba(197, 160, 89, 0.15) !important;
  border: 1.5px solid var(--secondary) !important;
  animation: pulse-border 1.5s infinite alternate;
}

@keyframes pulse-border {
  0% {
    box-shadow: 0 0 0 0px rgba(197, 160, 89, 0.4);
  }
  100% {
    box-shadow: 0 0 0 6px rgba(197, 160, 89, 0);
  }
}

/* ==========================================================================
   --- CALENDAR & EVENTS STYLES (v0.6.5) ---
   ========================================================================== */

.cal-section-container {
  max-width: 1000px;
  margin: 0 auto;
}

/* Calendar Header & Controls */
.cal-header-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 1.5rem;
  border: 1px solid rgba(27, 54, 93, 0.08);
}

.cal-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.cal-month-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.cal-month-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary);
  min-width: 180px;
  text-align: center;
  text-transform: capitalize;
}

.cal-nav-btn {
  background: #F3F4F6;
  border: 1px solid #E5E7EB;
  border-radius: var(--radius-md);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-main);
}

.cal-nav-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Calendar Layout Grid (Main Calendar on Left / Top, Events on Right / Bottom) */
.cal-main-layout {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 850px) {
  .cal-main-layout {
    grid-template-columns: 1fr;
  }
}

/* Calendar Grid Container */
.cal-grid-wrapper {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(27, 54, 93, 0.08);
}

.cal-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 0.5rem;
}

.cal-weekday-header {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 0.4rem 0;
  letter-spacing: 0.05em;
}

.cal-day-cell {
  aspect-ratio: 1;
  min-height: 48px;
  background: #F9FAFB;
  border: 1px solid #F3F4F6;
  border-radius: var(--radius-md);
  padding: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  user-select: none;
}

.cal-day-cell:hover {
  background: #EEF2F6;
  border-color: #CBD5E1;
  transform: translateY(-2px);
}

.cal-day-number {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1;
  margin-top: 2px;
}

.cal-day-cell.cal-day-other-month {
  opacity: 0.35;
  background: transparent;
}

.cal-day-cell.is-today {
  border: 2px solid var(--secondary);
  background: rgba(197, 160, 89, 0.08);
}

.cal-day-cell.is-today .cal-day-number {
  color: var(--secondary-hover);
  font-weight: 700;
}

.cal-day-cell.is-selected {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: white !important;
  box-shadow: 0 4px 10px rgba(27, 54, 93, 0.3);
}

.cal-day-cell.is-selected .cal-day-number {
  color: white !important;
}

.cal-day-cell.is-selected .cal-event-dot-more {
  color: white !important;
}

/* Event Indicator Dots in Calendar Cell */
.cal-event-dots {
  display: flex;
  gap: 3px;
  align-items: center;
  justify-content: center;
  margin-top: auto;
  margin-bottom: 2px;
  flex-wrap: wrap;
  max-width: 100%;
}

.cal-event-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cal-event-dot-more {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}

/* Calendar Right Panel (Selected Day & Upcoming Events) */
.cal-events-panel {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(27, 54, 93, 0.08);
  min-height: 380px;
  display: flex;
  flex-direction: column;
}

.cal-panel-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid #E5E7EB;
  padding-bottom: 0.75rem;
}

.cal-panel-tab {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  background: transparent;
  border: none;
  transition: all 0.2s;
}

.cal-panel-tab:hover {
  color: var(--text-main);
  background: #F3F4F6;
}

.cal-panel-tab.active {
  color: white;
  background: var(--primary);
}

.cal-events-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  max-height: 550px;
  padding-right: 4px;
}

/* Event Card */
.cal-event-card {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-left: 5px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}

.cal-event-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #D1D5DB;
}

.cal-event-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
  gap: 0.75rem;
}

.cal-event-date-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  background: rgba(27, 54, 93, 0.08);
  padding: 0.2rem 0.5rem;
  border-radius: 99px;
  margin-bottom: 0.35rem;
}

.cal-event-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}

.cal-event-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.btn-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  opacity: 0.7;
  transition: opacity 0.2s, background-color 0.2s;
}

.btn-icon:hover {
  opacity: 1;
  background: #F3F4F6;
}

.btn-icon-danger:hover {
  background: #FEE2E2;
}

.cal-event-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 1rem;
  font-size: 0.85rem;
  color: var(--text-main);
  margin-bottom: 0.75rem;
}

@media (max-width: 500px) {
  .cal-event-details-grid {
    grid-template-columns: 1fr;
  }
}

.col-span-full {
  grid-column: 1 / -1;
}

.cal-detail-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  line-height: 1.4;
}

.cal-detail-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.cal-detail-text {
  word-break: break-word;
}

.cal-maps-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  background: rgba(27, 54, 93, 0.08);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  margin-left: 0.35rem;
  text-decoration: none;
  transition: all 0.2s;
}

.cal-maps-link:hover {
  background: var(--primary);
  color: white;
}

.cal-event-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  background: #F9FAFB;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
  border-left: 3px solid #D1D5DB;
  line-height: 1.4;
}

.cal-event-footer {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  border-top: 1px solid #F3F4F6;
  padding-top: 0.75rem;
  flex-wrap: wrap;
}

.cal-empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  background: #F9FAFB;
  border-radius: var(--radius-lg);
  border: 1px dashed #CBD5E1;
  margin: auto 0;
}

/* Home Screen Upcoming Events Widget */
.upcoming-widget-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(27, 54, 93, 0.08);
  margin-top: 2rem;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.upcoming-events-mini-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.upcoming-mini-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-lg);
  background: #F9FAFB;
  border: 1px solid #F3F4F6;
  cursor: pointer;
  transition: all 0.2s;
}

.upcoming-mini-item:hover {
  background: #EEF2F6;
  border-color: #CBD5E1;
  transform: translateX(3px);
}

.upcoming-mini-item.is-today-mini {
  border-left: 4px solid var(--secondary);
  background: rgba(197, 160, 89, 0.08);
}

.upcoming-mini-date-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: white;
  border-radius: var(--radius-md);
  padding: 0.35rem 0.6rem;
  min-width: 48px;
  text-align: center;
}

.upcoming-mini-date-badge .day-num {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
}

.upcoming-mini-date-badge .month-name {
  font-size: 0.65rem;
  font-weight: 600;
  opacity: 0.85;
  text-transform: uppercase;
}

.upcoming-mini-content {
  flex-grow: 1;
}

.upcoming-mini-title {
  font-weight: 600;
  color: var(--text-main);
  font-size: 0.95rem;
  margin-bottom: 0.15rem;
}

.upcoming-mini-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.cal-today-alert {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: linear-gradient(135deg, rgba(197, 160, 89, 0.15) 0%, rgba(27, 54, 93, 0.08) 100%);
  border: 2px solid var(--secondary);
  border-radius: var(--radius-xl);
  padding: 1rem 1.25rem;
  margin-top: 1.5rem;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  cursor: pointer;
  transition: transform 0.2s;
}

.cal-today-alert:hover {
  transform: translateY(-2px);
}

/* Color Swatches for Modal */
.color-swatch-picker {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.35rem;
  flex-wrap: wrap;
}

.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 0 0 1px #D1D5DB;
  transition: transform 0.2s, box-shadow 0.2s;
}

.color-swatch:hover {
  transform: scale(1.15);
}

.color-swatch.selected {
  box-shadow: 0 0 0 3px var(--primary);
  transform: scale(1.1);
}

/* --- Authentication & Session Styles (v1.0.02) --- */
.auth-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: white;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-lg);
  margin: 0 auto 1.5rem auto;
  max-width: 600px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0, 0, 0, 0.06);
  transition: all 0.3s ease;
}

.auth-status-bar.auth-editor {
  border-left: 4px solid var(--secondary);
  background: linear-gradient(to right, #FFFDF8, #FFFFFF);
}

.auth-status-bar.auth-reader {
  border-left: 4px solid #94A3B8;
  background: #FFFFFF;
}

.auth-status-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
}

.auth-role-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.auth-role-pill.role-editor {
  background: rgba(197, 160, 89, 0.2);
  color: #8C6A23;
  border: 1px solid rgba(197, 160, 89, 0.4);
}

.auth-role-pill.role-reader {
  background: #F1F5F9;
  color: #64748B;
  border: 1px solid #CBD5E1;
}

.auth-user-name {
  font-weight: 600;
  color: var(--text-main);
}

.auth-action-btn {
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.15);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.auth-action-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Modal styles for initial login */
.login-welcome-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(27, 54, 93, 0.08);
  color: var(--primary);
  padding: 0.3rem 0.8rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.login-box-card {
  border: 1px solid #E2E8F0;
  border-radius: var(--radius-lg);
  padding: 1rem;
  background: #F8FAFC;
  transition: border-color 0.2s;
}

.login-box-card:focus-within {
  border-color: var(--primary);
}

