:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #a5b4fc;
  --secondary: #f8fafc;
  --accent: #e879f9;
  --accent-light: #f0abfc;
  --text: #1e293b;
  --text-light: #64748b;
  --text-muted: #94a3b8;
  --bg: #ffffff;
  --bg-light: #f8fafc;
  --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 20px 40px rgba(0, 0, 0, 0.15);
  --border-radius: 16px;
  --border-radius-large: 24px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html, body {
  min-height: 100vh;
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg-gradient);
  background-attachment: fixed;
}

body {
  overflow-x: hidden;
}

.page-shell {
  min-height: 100vh;
  max-width: 1400px; /* Increased from 1200px for 16:9 aspect */
  margin: 0 auto;
  padding: 2rem 1.5rem; /* Increased padding for better use of space */
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.hero {
  text-align: center;
  padding: 4rem 2rem;
  border-radius: var(--border-radius-large);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  margin-bottom: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.eyebrow {
  display: inline-block;
  margin-bottom: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.875rem;
  color: var(--primary);
  background: var(--primary-light);
  padding: 0.5rem 1rem;
  border-radius: 2rem;
}

.hero h1 {
  margin: 0 0 1rem;
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-dark), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  margin: 0;
  max-width: 600px;
  margin: 0 auto;
  color: var(--text-light);
  font-size: 1.125rem;
  line-height: 1.7;
}

.card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: var(--border-radius-large);
  padding: 2rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: var(--transition);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.form-card h2,
.result-card h2 {
  margin-top: 0;
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1.5rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

label {
  display: block;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

input,
select {
  width: 100%;
  padding: 1rem 1.25rem;
  border: 2px solid #e2e8f0;
  border-radius: var(--border-radius);
  font-size: 1rem;
  outline: none;
  transition: var(--transition);
  background: var(--bg);
  color: var(--text);
}

input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
  transform: translateY(-1px);
}

.books-section {
  margin-top: 2rem;
}

.api-note {
  margin-top: 1rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  background: var(--bg-light);
  padding: 1rem;
  border-radius: var(--border-radius);
  border-left: 4px solid var(--accent);
}

.sync-status {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-radius: var(--border-radius);
  font-size: 0.9rem;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.sync-status.error {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.book-groups {
  display: grid;
  gap: 2rem;
  margin-top: 2rem;
}

.book-group {
  background: var(--bg-light);
  border: 1px solid #e2e8f0;
  border-radius: var(--border-radius);
  padding: 1.5rem;
  transition: var(--transition);
}

.book-group:hover {
  background: var(--bg);
  border-color: var(--primary-light);
}

.notification-controls {
  margin-top: 2rem;
  padding: 1.5rem;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.notification-settings {
  margin-bottom: 1rem;
}

.setting-group {
  margin-bottom: 1rem;
}

.setting-group label {
  display: block;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.setting-group input[type="time"],
.setting-group input[type="email"] {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 0.875rem;
}

.setting-group input[type="time"]:focus,
.setting-group input[type="email"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.setting-group input[type="checkbox"] {
  margin-right: 0.5rem;
}

.notification-controls .button {
  width: 100%;
  margin-bottom: 0.5rem;
}

.notification-status {
  display: block;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-style: italic;
}

/* Sistema Pagar pra Ler */
.pay-to-read-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  text-align: center;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-content h3 {
  color: var(--primary);
  margin-bottom: 1rem;
}

.exercise-card {
  background: #f8fafc;
  padding: 1.5rem;
  border-radius: 8px;
  margin: 1.5rem 0;
  border: 2px solid #e2e8f0;
  text-align: left;
}

.exercise-card h4 {
  color: var(--primary);
  margin-bottom: 1rem;
  text-align: center;
  font-size: 1.2rem;
}

.exercise-meta {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.exercise-meta span {
  background: var(--primary);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

.exercise-muscles {
  background: #e0f2fe;
  padding: 0.75rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.exercise-video {
  text-align: center;
  margin: 1rem 0;
}

.exercise-video video {
  border-radius: 8px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.exercise-video-links {
  background: #eff6ff;
  padding: 1rem;
  border-radius: 6px;
  margin-top: 1rem;
}

.exercise-video-links h5 {
  margin: 0 0 0.75rem;
  color: #1d4ed8;
  font-size: 1rem;
}

.exercise-video-link-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.exercise-video-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  background: #2563eb;
  color: #fff;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  transition: var(--transition);
}

.exercise-video-link:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.exercise-steps {
  background: #fef3c7;
  padding: 1rem;
  border-radius: 6px;
  margin-top: 1rem;
}

.exercise-steps h5 {
  margin-bottom: 0.5rem;
  color: #92400e;
  font-size: 1rem;
}

.exercise-steps ol {
  margin: 0;
  padding-left: 1.5rem;
}

.exercise-steps li {
  margin-bottom: 0.25rem;
  line-height: 1.4;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 1rem auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 1.5rem;
}

.modal-actions .button {
  flex: 1;
  min-width: 120px;
}

/* Estilos para dias do plano */
.plan-day.today {
  border: 2px solid var(--primary);
  background: #fef3c7;
}

.plan-day.completed {
  background: #d1fae5;
  border-color: #10b981;
}

.plan-day.completed h3::after {
  content: " ✅";
}

.mark-complete-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.875rem;
  margin-top: 0.5rem;
  transition: all 0.2s;
}

.mark-complete-btn:hover {
  background: var(--primary-dark);
}

.mark-complete-btn.completed {
  background: #10b981;
  cursor: default;
}

.mark-complete-btn.completed:hover {
  background: #10b981;
}

.book-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e2e8f0;
}

.select-all-btn {
  background: var(--bg);
  border: 2px solid var(--primary);
  color: var(--primary);
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.select-all-btn:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.select-all-btn.all-selected {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.select-all-btn.all-selected:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.book-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e2e8f0;
}

.select-all-btn {
  background: var(--bg);
  border: 2px solid var(--primary);
  color: var(--primary);
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.select-all-btn:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.select-all-btn.all-selected {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.select-all-btn.all-selected:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.book-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); /* Increased from 200px for better use of wider space */
  gap: 0.75rem;
}

.book-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius);
  background: var(--bg);
  border: 1px solid #e2e8f0;
  transition: var(--transition);
  cursor: pointer;
}

.book-item:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.book-item input {
  accent-color: var(--primary);
  width: 1.25rem;
  height: 1.25rem;
}

.book-item label {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
  flex: 1;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2rem;
  justify-content: center;
}

.button {
  border: none;
  border-radius: var(--border-radius);
  padding: 1rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  min-width: 160px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.primary:hover {
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.secondary {
  background: var(--bg);
  color: var(--primary);
  border: 2px solid var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.secondary:hover {
  background: var(--primary);
  color: white;
}

.danger {
  background: #fff1f2;
  color: #be123c;
  border: 2px solid #fecdd3;
  box-shadow: 0 2px 8px rgba(190, 18, 60, 0.12);
}

.danger:hover {
  background: #e11d48;
  color: white;
}

.reminder {
  border-left: 4px solid var(--accent);
  background: linear-gradient(90deg, rgba(232, 121, 249, 0.1), transparent);
}

.reminder p {
  margin: 0;
  font-size: 1rem;
  color: var(--text);
  font-weight: 500;
}

.hidden {
  display: none;
}

.plan-output {
  display: grid;
  gap: 1.5rem;
}

.plan-day {
  padding: 2rem;
  border-radius: var(--border-radius-large);
  background: var(--bg);
  border: 1px solid #e2e8f0;
  transition: var(--transition);
}

.plan-locked-state {
  padding: 2rem;
  border-radius: var(--border-radius-large);
  background: linear-gradient(135deg, #fff7ed, #ffedd5);
  border: 1px solid #fdba74;
  text-align: center;
}

.plan-locked-state h3 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  color: #9a3412;
}

.plan-locked-state p {
  margin: 0 auto 1.5rem;
  max-width: 42rem;
  color: #7c2d12;
}

.plan-day:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--primary-light);
}

.plan-day h3 {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary-dark);
}

.plan-day p {
  margin: 0 0 1.5rem;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.6;
}

.day-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.day-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--border-radius);
  background: linear-gradient(135deg, var(--accent-light), var(--accent));
  color: white;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(232, 121, 249, 0.2);
}

.day-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(232, 121, 249, 0.3);
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
}

.day-link::before {
  content: '📖';
  font-size: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .page-shell {
    padding: 1rem 0.5rem;
    gap: 1rem;
    max-width: 100vw; /* Full width on mobile */
  }

  .hero {
    padding: 2rem 1rem;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .card {
    padding: 1.5rem;
  }

  .grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .book-list {
    grid-template-columns: 1fr;
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .button {
    width: 100%;
    min-width: auto;
  }

  .plan-day {
    padding: 1.5rem;
  }

  .day-links {
    flex-direction: column;
  }

  .day-link {
    justify-content: center;
  }

  .book-group-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .select-all-btn {
    align-self: flex-end;
  }
}

@media (max-width: 480px) {
  .hero {
    padding: 1.5rem 0.75rem;
  }

  .card {
    padding: 1rem;
    border-radius: var(--border-radius);
  }

  .book-group {
    padding: 1rem;
  }

  .plan-day {
    padding: 1rem;
  }
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb {
  background: var(--primary-light);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Focus states for accessibility */
input:focus,
select:focus,
.book-item:focus-within {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Loading animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  animation: fadeIn 0.6s ease-out;
}

.plan-day {
  animation: fadeIn 0.4s ease-out;
  animation-fill-mode: both;
}

.plan-day:nth-child(1) { animation-delay: 0.1s; }
.plan-day:nth-child(2) { animation-delay: 0.2s; }
.plan-day:nth-child(3) { animation-delay: 0.3s; }
.plan-day:nth-child(4) { animation-delay: 0.4s; }
.plan-day:nth-child(5) { animation-delay: 0.5s; }
.plan-day:nth-child(6) { animation-delay: 0.6s; }
.plan-day:nth-child(7) { animation-delay: 0.7s; }
