/* ============ Variables ============ */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #a5b4fc;
  --secondary: #f1f5f9;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --text: #1e293b;
  --text-light: #64748b;
  --bg: #f8fafc;
  --white: #ffffff;
  --border: #e2e8f0;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius: 12px;
  --telegram: #0088cc;
}

/* ============ Reset & Base ============ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ============ Container ============ */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============ Header ============ */
.header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  font-size: 2.5rem;
  line-height: 1;
}

.logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.subtitle {
  font-size: 0.875rem;
  color: var(--text-light);
}

.nav-tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.tab-btn {
  padding: 0.5rem 1rem;
  border: none;
  background: var(--secondary);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.2s;
}

.tab-btn:hover {
  background: var(--primary-light);
}

.tab-btn.active {
  background: var(--primary);
  color: var(--white);
}

/* ============ Main Content ============ */
.main-content {
  flex: 1;
  padding: 1.5rem 0;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

/* ============ Calendar ============ */
.calendar-header,
.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.calendar-header h2,
.list-header h2 {
  font-size: 1.25rem;
  color: var(--text);
}

#calendario {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

/* FullCalendar customization */
.fc {
  font-family: inherit;
}

.fc .fc-toolbar-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.fc .fc-button-primary {
  background: var(--secondary);
  border-color: var(--border);
  color: var(--text);
}

.fc .fc-button-primary:hover {
  background: var(--primary-light);
  border-color: var(--primary-light);
  color: var(--primary-dark);
}

.fc .fc-button-primary:disabled {
  background: var(--primary-light);
  border-color: var(--primary-light);
}

.fc .fc-button-primary.fc-button-active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
}

.fc .fc-daygrid-day:hover {
  background: var(--secondary);
  cursor: pointer;
}

.fc .fc-event {
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 0.8rem;
  border: none;
}

.fc .fc-event-cumpleaños {
  background: #ec4899;
}

.fc .fc-event-aniversario {
  background: #f59e0b;
}

.fc .fc-event-santo {
  background: #8b5cf6;
}

.fc .fc-event-otro {
  background: var(--primary);
}

/* ============ Lista ============ */
.search-box {
  margin-bottom: 1rem;
}

.search-box input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
}

.lista-aniversarios,
.lista-suscriptores {
  display: grid;
  gap: 0.75rem;
}

.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

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

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

.card-name {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.card-details {
  font-size: 0.875rem;
  color: var(--text-light);
}

.card-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-right: 0.5rem;
}

.badge-cumpleaños { background: #fce7f3; color: #be185d; }
.badge-aniversario { background: #fef3c7; color: #b45309; }
.badge-santo { background: #ede9fe; color: #6d28d9; }
.badge-recordatorio { background: #fef9c3; color: #a16207; }
.badge-otro { background: #e0e7ff; color: #3730a3; }

.card-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.2s;
}

.btn-edit {
  background: var(--secondary);
  color: var(--text);
}

.btn-edit:hover {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.btn-delete {
  background: #fee2e2;
  color: var(--danger);
}

.btn-delete:hover {
  background: var(--danger);
  color: var(--white);
}

/* ============ Suscriptores ============ */
.info-text {
  color: var(--text-light);
  margin-bottom: 1.5rem;
}

.suscriptor-card {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--primary-dark);
}

.suscriptor-status {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-activo { background: var(--success); }
.status-inactivo { background: var(--text-light); }

/* ============ Manual ============ */
.manual {
  background: var(--white);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}

.manual h2 {
  margin-bottom: 1.5rem;
  color: var(--primary);
}

.manual-section {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.manual-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.manual-section h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--text);
}

.steps {
  display: grid;
  gap: 1rem;
}

.step {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.step-content {
  padding-top: 4px;
}

.bot-link {
  margin-top: 1.5rem;
}

.btn-telegram {
  background: var(--telegram);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-telegram:hover {
  background: #006699;
}

.commands {
  display: grid;
  gap: 0.75rem;
}

.command {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  background: var(--secondary);
  border-radius: 8px;
}

.command code {
  background: var(--white);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
  color: var(--primary);
  min-width: 100px;
}

.manual ol {
  padding-left: 1.5rem;
}

.manual li {
  margin-bottom: 0.5rem;
}

.tip {
  background: #fef3c7;
  padding: 1rem;
  border-radius: 8px;
  margin-top: 1rem;
  color: #92400e;
}

code {
  background: var(--secondary);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 0.875em;
}

/* ============ Buttons ============ */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--secondary);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
}

.btn-danger:hover {
  background: #dc2626;
}

/* ============ Modal ============ */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

.modal.active {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background: var(--white);
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-small {
  max-width: 400px;
}

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

.modal-header h3 {
  font-size: 1.25rem;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--secondary);
  border-radius: 8px;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--danger);
  color: var(--white);
}

.modal-content form,
.modal-content > p {
  padding: 1.5rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--white);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ============ Footer ============ */
.footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-light);
  font-size: 0.875rem;
}

/* ============ Empty State ============ */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-light);
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state p {
  margin-bottom: 1rem;
}

/* ============ Responsive ============ */
@media (min-width: 768px) {
  .header-content {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .logo h1 {
    font-size: 1.75rem;
  }

  .fc .fc-toolbar-title {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .card {
    flex-direction: column;
    align-items: flex-start;
  }

  .card-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .command {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}
