/* Shared styles for all course pages */

/* Color variables */
:root {
  /* Base palette - Light mode */
  --color-blue-50: #eff6ff;
  --color-blue-600: #1d4ed8;
  --color-blue-200: #bfdbfe;

  --color-green-50: #f0fdf4;
  --color-green-700: #15803d;
  --color-green-200: #bbf7d0;

  --color-red-50: #fef2f2;
  --color-red-700: #b91c1c;
  --color-red-200: #fecaca;

  --color-gray-50: #f9fafb;
  --color-gray-600: #4b5563;
  --color-gray-200: #e5e7eb;

  /* Background colors */
  --color-bg: #ffffff;
  --color-bg-subtle: var(--color-gray-50);

  /* Text colors */
  --color-text: #1a1a1a;
  --color-text-subtle: var(--color-gray-600);

  /* Flash message colors */
  --flash-notice-bg: var(--color-blue-50);
  --flash-notice-text: var(--color-blue-600);
  --flash-notice-border: var(--color-blue-200);

  --flash-success-bg: var(--color-green-50);
  --flash-success-text: var(--color-green-700);
  --flash-success-border: var(--color-green-200);

  --flash-error-bg: var(--color-red-50);
  --flash-error-text: var(--color-red-700);
  --flash-error-border: var(--color-red-200);

  --flash-default-bg: var(--color-gray-50);
  --flash-default-text: var(--color-gray-600);
  --flash-default-border: var(--color-gray-200);

  /* Auth modal colors */
  --auth-modal-bg: var(--color-bg);
  --auth-input-border: var(--color-gray-200);
  --auth-input-bg: var(--color-bg);
  --auth-btn-bg: #1a1a1a;
  --auth-btn-text: #ffffff;
  --auth-btn-hover: #374151;

  /* Theme colors */
  --color-primary: #9333ea;
}

html.dark {
  /* Base palette - Dark mode */
  --color-blue-50: #1e3a5f;
  --color-blue-600: #93c5fd;
  --color-blue-200: #1e40af;

  --color-green-50: #14532d;
  --color-green-700: #86efac;
  --color-green-200: #166534;

  --color-red-50: #450a0a;
  --color-red-700: #fca5a5;
  --color-red-200: #7f1d1d;

  --color-gray-50: #374151;
  --color-gray-600: #d1d5db;
  --color-gray-200: #4b5563;

  /* Background colors */
  --color-bg: #1a1a1a;
  --color-bg-subtle: #262626;

  /* Text colors */
  --color-text: #e5e5e5;
  --color-text-subtle: #a3a3a3;

  /* Auth modal colors - dark mode */
  --auth-btn-bg: #e5e5e5;
  --auth-btn-text: #1a1a1a;
  --auth-btn-hover: #d1d5db;
}

/* Theme transition */
html {
  transition: background-color 0.3s ease;
}

body {
  transition: color 0.3s ease, background-color 0.3s ease;
}

section {
  margin: 25px 0px;
}

/* Dark theme base styles */
html.dark {
  background-color: #1a1a1a;
}

html.dark body {
  background-color: #1a1a1a;
  color: #e5e5e5;
}

/* Dark theme for headings */
html.dark h1,
html.dark h2,
html.dark h3,
html.dark h4,
html.dark h5,
html.dark h6 {
  color: #f5f5f5;
}

html.dark p {
  color: #d1d1d1;
}

/* Links - restore styling after Tailwind reset */
/* Exclude links inside headings */
a:not(h1 a):not(h2 a):not(h3 a):not(h4 a):not(h5 a):not(h6 a) {
  color: #2563eb;
}

/* Dark theme for links */
html.dark a:not(h1 a):not(h2 a):not(h3 a):not(h4 a):not(h5 a):not(h6 a) {
  color: #60a5fa;
}

/* Heading links inherit heading color */
h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {
  color: inherit;
}

html.dark h1 a, html.dark h2 a, html.dark h3 a, html.dark h4 a, html.dark h5 a, html.dark h6 a {
  color: inherit;
}

/* All links show underline and link color on hover */
a:hover {
  color: #2563eb;
  text-decoration: underline;
}

html.dark a:hover {
  color: #60a5fa;
  text-decoration: underline;
}

/* Theme toggle button */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: background-color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  background-color: rgba(0, 0, 0, 0.1);
}

html.dark .theme-toggle:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  transition: transform 0.2s ease;
}

.theme-toggle:hover svg {
  transform: scale(1.1);
}

/* Theme toggle icons */
.sun-icon {
  display: block;
  color: #f59e0b;
}

.moon-icon {
  display: none;
  color: #6366f1;
}

html.dark .sun-icon {
  display: none;
}

html.dark .moon-icon {
  display: block;
  color: #818cf8;
}

/* Basic typography reset for unstyled elements */
h1 {
  font-size: 2.25rem;
  line-height: 2.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

h2 {
  font-size: 1.5rem;
  line-height: 2.5rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: #1f2937;
}

h3 {
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

p {
  margin-top: 0.5rem;
  margin-bottom: 0.75rem;
}

ul {
  list-style-type: none;
  padding-left: 0;
  margin-top: 0.5rem;
  margin-bottom: 0.75rem;
}

li {
  padding-left: 1.5rem;
  margin-bottom: 0.25rem;
}

/* Pro badge styling */
.pro-badge {
  display: inline-block;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  vertical-align: middle;
  margin-left: 0.35rem;
}

html.dark .pro-badge {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
}

/* Pro locked content styling */
.pro-locked-content {
  background-color: #fef3c7;
  border: 2px solid #f59e0b;
  border-radius: 0.5rem;
  padding: 2rem;
  text-align: center;
  margin: 2rem 0;
}

html.dark .pro-locked-content {
  background-color: #292524;
  border-color: #d97706;
}

.pro-locked-message h2 {
  color: #92400e;
  margin-top: 0;
  margin-bottom: 1rem;
}

html.dark .pro-locked-message h2 {
  color: #fbbf24;
}

.pro-locked-message p {
  color: #78350f;
  margin-bottom: 1.5rem;
}

html.dark .pro-locked-message p {
  color: #fde68a;
}

.pro-upgrade-button {
  display: inline-block;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: 0.375rem;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pro-upgrade-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
  color: white;
}

/* Flash message styles */
.flash-notice {
  background-color: var(--flash-notice-bg);
  color: var(--flash-notice-text);
  border: 1px solid var(--flash-notice-border);
}

.flash-success {
  background-color: var(--flash-success-bg);
  color: var(--flash-success-text);
  border: 1px solid var(--flash-success-border);
}

.flash-error {
  background-color: var(--flash-error-bg);
  color: var(--flash-error-text);
  border: 1px solid var(--flash-error-border);
}

.flash-default {
  background-color: var(--flash-default-bg);
  color: var(--flash-default-text);
  border: 1px solid var(--flash-default-border);
}

/* Auth modal styles */
.auth-modal-container {
  background-color: var(--auth-modal-bg);
  color: var(--color-text);
}

.auth-input {
  background-color: var(--auth-input-bg);
  border: 1px solid var(--auth-input-border);
  color: var(--color-text);
  width: 100%;
  border-radius: 0.25rem;
  padding: 0.5rem 0.75rem;
}

.auth-input:focus {
  outline: none;
  border-color: var(--color-blue-600);
}

.auth-btn {
  background-color: var(--auth-btn-bg);
  color: var(--auth-btn-text);
  width: 100%;
  padding: 0.5rem 1rem;
  border-radius: 0.25rem;
  border: none;
  cursor: pointer;
  font-weight: 500;
}

.auth-btn:hover {
  background-color: var(--auth-btn-hover);
}

.auth-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-link {
  color: var(--color-text-subtle);
}

.auth-link:hover {
  color: var(--color-text);
}

.auth-close-btn {
  color: var(--color-text-subtle);
}

.auth-close-btn:hover {
  color: var(--color-text);
}

/* Lesson cards grid - responsive layout */
.lesson-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (min-width: 768px) {
  .lesson-cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}


/* Lesson thumbnail hover/scroll animation */
.lesson-thumbnail-wrapper {
  display: inline-block;
  position: relative;
  width: 80px;
  height: 45px;
  vertical-align: middle;
  margin-right: 8px;
}

.lesson-thumbnail-wrapper .lesson-thumbnail,
.lesson-thumbnail-wrapper .lesson-thumbnail-animation {
  position: absolute;
  top: 0;
  left: 0;
  width: 80px;
  height: 45px;
  object-fit: cover;
  border-radius: 4px;
  transition: opacity 0.2s ease;
}

.lesson-thumbnail-wrapper .lesson-thumbnail {
  opacity: 1;
}

.lesson-thumbnail-wrapper .lesson-thumbnail-animation {
  opacity: 0;
}

/* Show animation on hover (desktop) or when .active class is added (mobile scroll) */
.lesson-thumbnail-wrapper:hover .lesson-thumbnail,
.lesson-thumbnail-wrapper.active .lesson-thumbnail {
  opacity: 0;
}

.lesson-thumbnail-wrapper:hover .lesson-thumbnail-animation,
.lesson-thumbnail-wrapper.active .lesson-thumbnail-animation {
  opacity: 1;
}

/* Lesson card thumbnail/animation swap on hover */
.lesson-card-thumbnail {
  opacity: 1;
}

.lesson-card-animation {
  opacity: 0;
}

.lesson-card:hover .lesson-card-thumbnail {
  opacity: 0;
}

.lesson-card:hover .lesson-card-animation {
  opacity: 1;
}

/* Lesson card play icon */
.lesson-card-play-icon {
  display: none;
}

/* Lesson card hover effect */
.lesson-card:hover {
  outline: 3px solid var(--color-primary);
}

/* Inline code styling (single backticks) - matches Monokai theme */
:not(pre) > code {
  background-color: #272822;
  color: #f8f8f2;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: 0.875em;
}

