/* ============================================
   Pen Cloud Academy — Global Styles
   Premium minimal design system
   ============================================ */

/* --- CSS Variables --- */
:root {
  --color-cream: #fef8e0;
  --color-orange: #fe5524;
  --color-orange-dark: #e04a1f;
  --color-orange-light: #ff7a52;
  --color-dark: #1a1a1a;
  --color-gray-900: #2d2d2d;
  --color-gray-700: #4a4a4a;
  --color-gray-500: #737373;
  --color-gray-300: #d4d4d4;
  --color-gray-100: #f5f5f5;
  --color-white: #ffffff;
  --color-success: #22c55e;
  --color-warning: #f59e0b;
  --color-error: #ef4444;
  --color-locked: #9ca3af;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.15);

  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  --sidebar-width: 280px;
  --header-height: 72px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-dark);
  background-color: var(--color-cream);
  min-height: 100vh;
}

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

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
}

ul, ol {
  list-style: none;
}

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

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); }
h3 { font-size: clamp(1.25rem, 2vw, 1.5rem); }
h4 { font-size: 1.125rem; }

p {
  color: var(--color-gray-700);
}

.text-muted {
  color: var(--color-gray-500);
}

.text-small {
  font-size: 0.875rem;
}

/* --- Layout Utilities --- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.container-wide {
  max-width: 1400px;
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-center {
  justify-content: center;
}

.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }
.gap-xl { gap: 32px; }

.grid {
  display: grid;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-orange);
  color: var(--color-white);
  box-shadow: 0 4px 14px rgba(254, 85, 36, 0.35);
}

.btn-primary:hover {
  background: var(--color-orange-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(254, 85, 36, 0.45);
}

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

.btn-secondary:hover {
  background: var(--color-gray-900);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--color-dark);
  border: 2px solid var(--color-gray-300);
}

.btn-outline:hover {
  border-color: var(--color-orange);
  color: var(--color-orange);
}

.btn-ghost {
  background: transparent;
  color: var(--color-gray-700);
}

.btn-ghost:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--color-dark);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.875rem;
}

.btn-lg {
  padding: 16px 32px;
  font-size: 1rem;
}

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

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* --- Cards --- */
.card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

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

.card-body {
  padding: 24px;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-gray-100);
}

/* --- Form Elements --- */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-dark);
  margin-bottom: 8px;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--color-gray-300);
  border-radius: var(--radius-md);
  background: var(--color-white);
  color: var(--color-dark);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--color-orange);
  box-shadow: 0 0 0 3px rgba(254, 85, 36, 0.15);
}

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

.form-error {
  color: var(--color-error);
  font-size: 0.8125rem;
  margin-top: 6px;
}

/* --- Progress Bar --- */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--color-gray-100);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-orange), var(--color-orange-light));
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

.progress-bar-lg {
  height: 12px;
}

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-success {
  background: rgba(34, 197, 94, 0.15);
  color: var(--color-success);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--color-warning);
}

.badge-premium {
  background: rgba(254, 85, 36, 0.15);
  color: var(--color-orange);
}

.badge-locked {
  background: rgba(156, 163, 175, 0.2);
  color: var(--color-locked);
}

.badge-completed {
  background: rgba(34, 197, 94, 0.15);
  color: var(--color-success);
}

/* --- Header / Navbar --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(254, 248, 224, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  height: var(--header-height);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--color-dark);
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--color-orange);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 0.875rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-links a {
  font-weight: 500;
  color: var(--color-gray-700);
  transition: color var(--transition-fast);
}

.nav-links a:hover {
  color: var(--color-orange);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
}

.menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-dark);
  border-radius: 2px;
  transition: all var(--transition-base);
}

.menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* --- Hero Section --- */
.hero {
  padding: 80px 0 100px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(254, 85, 36, 0.08) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero-content {
  max-width: 640px;
  position: relative;
  z-index: 1;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(254, 85, 36, 0.1);
  color: var(--color-orange);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 24px;
}

.hero h1 {
  margin-bottom: 20px;
}

.hero h1 span {
  color: var(--color-orange);
}

.hero p {
  font-size: 1.125rem;
  margin-bottom: 32px;
  max-width: 520px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.hero-stats {
  display: flex;
  gap: 48px;
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.hero-stat strong {
  display: block;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--color-dark);
}

.hero-stat span {
  font-size: 0.875rem;
  color: var(--color-gray-500);
}

/* --- Features Section --- */
.features {
  padding: 80px 0;
  background: var(--color-white);
}

.section-header {
  text-align: center;
  max-width: 600px;
  margin: 0 auto 56px;
}

.section-header h2 {
  margin-bottom: 16px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.feature-card {
  padding: 32px;
  background: var(--color-cream);
  border-radius: var(--radius-lg);
  transition: transform var(--transition-base);
}

.feature-card:hover {
  transform: translateY(-4px);
}

.feature-icon {
  width: 48px;
  height: 48px;
  background: var(--color-orange);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.25rem;
  margin-bottom: 20px;
}

.feature-card h3 {
  margin-bottom: 12px;
  font-size: 1.125rem;
}

/* --- Course Preview --- */
.courses-preview {
  padding: 80px 0;
}

.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 28px;
}

.course-card-preview {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-base);
}

.course-card-preview:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

.course-thumbnail {
  position: relative;
  height: 180px;
  background: linear-gradient(135deg, var(--color-dark) 0%, var(--color-gray-900) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 3rem;
}

.course-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.course-card-content {
  padding: 24px;
}

.course-card-content h3 {
  margin-bottom: 8px;
}

.course-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.875rem;
  color: var(--color-gray-500);
  margin-top: 12px;
}

/* --- Footer --- */
.site-footer {
  background: var(--color-dark);
  color: var(--color-gray-300);
  padding: 64px 0 32px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 48px;
}

.footer-brand .logo {
  color: var(--color-white);
  margin-bottom: 16px;
}

.footer-brand p {
  color: var(--color-gray-500);
  font-size: 0.9375rem;
}

.footer-col h4 {
  color: var(--color-white);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 20px;
}

.footer-col a {
  display: block;
  color: var(--color-gray-500);
  font-size: 0.9375rem;
  padding: 6px 0;
  transition: color var(--transition-fast);
}

.footer-col a:hover {
  color: var(--color-orange);
}

.footer-bottom {
  padding-top: 32px;
  border-top: 1px solid var(--color-gray-900);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  color: var(--color-gray-500);
}

/* --- Toast Notifications --- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--color-dark);
  color: var(--color-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  animation: toastIn var(--transition-slow) ease;
  min-width: 280px;
  max-width: 400px;
}

.toast.success { border-left: 4px solid var(--color-success); }
.toast.error { border-left: 4px solid var(--color-error); }
.toast.warning { border-left: 4px solid var(--color-warning); }
.toast.info { border-left: 4px solid var(--color-orange); }

.toast.hiding {
  animation: toastOut var(--transition-base) ease forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(100%); }
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--color-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition-base);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px;
  border-bottom: 1px solid var(--color-gray-100);
}

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

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-gray-500);
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--color-gray-100);
  color: var(--color-dark);
}

.modal-body {
  padding: 28px;
}

.modal-footer {
  padding: 20px 28px;
  border-top: 1px solid var(--color-gray-100);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* --- Loading States --- */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-gray-100);
  border-top-color: var(--color-orange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-spinner.sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(254, 248, 224, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 9998;
}

.loading-overlay p {
  font-weight: 500;
  color: var(--color-gray-700);
}

.page-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  gap: 16px;
}

/* --- Empty States --- */
.empty-state {
  text-align: center;
  padding: 64px 24px;
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  background: var(--color-gray-100);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--color-gray-500);
}

.empty-state h3 {
  margin-bottom: 8px;
}

.empty-state p {
  max-width: 360px;
  margin: 0 auto 24px;
}

/* --- Locked Premium UI --- */
.locked-overlay {
  position: relative;
}

.locked-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(254, 248, 224, 0.85);
  backdrop-filter: blur(2px);
  border-radius: inherit;
  z-index: 1;
}

.locked-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  background: var(--color-white);
  padding: 16px 24px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.locked-badge svg,
.locked-badge .lock-icon {
  font-size: 1.5rem;
  margin-bottom: 8px;
  color: var(--color-orange);
}

/* --- Resource Cards --- */
.resource-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--color-cream);
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}

.resource-card:hover {
  background: rgba(254, 85, 36, 0.08);
}

.resource-icon {
  width: 44px;
  height: 44px;
  background: var(--color-white);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--color-orange);
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

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

.resource-info h4 {
  font-size: 0.9375rem;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.resource-info span {
  font-size: 0.8125rem;
  color: var(--color-gray-500);
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--color-cream);
    padding: 24px;
    gap: 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: var(--shadow-md);
  }

  .nav-links.open {
    display: flex;
  }

  .menu-toggle {
    display: flex;
  }

  .hero {
    padding: 48px 0 64px;
  }

  .hero-stats {
    flex-wrap: wrap;
    gap: 24px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }

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

  .hero-actions .btn {
    width: 100%;
  }
}
