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

:root {
  /* Dark Mode Default */
  --bg: #000000;
  --surface: #1c1c1e;
  --surface-2: #2c2c2e;
  --border: rgba(255, 255, 255, 0.1);
  --text: #ffffff;
  --text-sub: #a1a1a6;
  --text-muted: #636366;

  /* Brand Colors from app_theme.dart */
  --primary: #1a3a5c;
  --primary-text: #ffffff;
  --primary-transparent: rgba(26, 58, 92, 0.2);

  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
  --radius: 24px;
  --radius-sm: 12px;

  --font-display:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  --font-body:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f5f7;
    --surface: #ffffff;
    --surface-2: #f2f2f7;
    --border: rgba(0, 0, 0, 0.08);
    --text: #000000;
    --text-sub: #6e6e73;
    --text-muted: #8e8e93;

    --primary: #1a3a5c;
    --primary-text: #ffffff;
    --primary-transparent: rgba(26, 58, 92, 0.08);

    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08);
  }
}

html,
body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  accent-color: var(--primary);
}

a {
  color: inherit;
  text-decoration: none;
}

/* === Layout === */
.container {
  max-width: 560px;
  margin: 0 auto;
  padding: 48px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}

/* === Landing Page Components === */
.app-icon {
  width: 96px;
  height: 96px;
  border-radius: 22.5%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  margin-bottom: 8px;
}
.app-icon-letter {
  font-family: var(--font-display);
  font-size: 52px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -2px;
}

.hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.app-name {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1.5px;
  color: var(--text);
  margin: 0;
  line-height: 1.1;
}

.tagline {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-sub);
}

.sub-tagline {
  font-size: 15px;
  color: var(--text-sub);
  max-width: 340px;
  line-height: 1.5;
  margin: 0 auto;
}

.store-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.store-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

/* Minimalist Button System */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 24px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  border: none;
  width: 100%;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-text);
  box-shadow: 0 4px 16px var(--primary-transparent);
}

.btn-primary:hover {
  background: #11263d; /* slightly darker navy */
  color: #fff;
}
@media (prefers-color-scheme: dark) {
  .btn-primary:hover {
    background: #265282;
  }
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--surface-2);
  border-color: transparent;
}

.store-logo {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}
.store-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0px;
  text-align: left;
}
.store-sub {
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 600;
  opacity: 0.7;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}
.store-main {
  font-size: 15px;
  letter-spacing: -0.3px;
  line-height: 1.1;
}

.btn.half {
  flex: 1;
  min-width: 160px;
}

/* === Material Page Components === */
.material-page {
  justify-content: flex-start;
  padding-top: 24px;
  padding-bottom: 24px;
}

.header-nav {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-sub);
  padding: 8px 12px 8px 4px;
  border-radius: 100px;
  transition: background 0.2s;
}
.back-link:hover {
  background: var(--surface-2);
  color: var(--text);
}
.back-icon {
  font-size: 16px;
  margin-bottom: 1px;
}

.course-badge {
  display: inline-flex;
  background: var(--surface-2);
  color: var(--text-sub);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 6px 12px;
  border-radius: 100px;
  margin-bottom: 16px;
}

.material-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.15;
  margin-bottom: 12px;
  color: var(--text);
}

.material-meta-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 32px;
}

.material-meta {
  font-size: 15px;
  color: var(--text-sub);
  line-height: 1.4;
}

.material-exam {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Document preview */
.doc-preview-wrap {
  width: 100%;
  margin-bottom: 32px;
}

.doc-preview {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 32px 0;
  height: 700px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.doc-line {
  height: 12px;
  border-radius: 6px;
  background: var(--surface-2);
}

.doc-fade {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 140px;
  background: linear-gradient(to bottom, transparent, var(--surface) 90%);
}

.doc-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--primary-transparent);
  color: var(--primary);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 4px 8px;
  border-radius: 6px;
}

.dark-mode .doc-badge {
  color: #8cbff4;
}

.planb-footer {
  margin-top: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}
.footer-logo {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--text-sub);
}

/* Error state */
.error-container {
  text-align: center;
  justify-content: center;
}
.error-icon {
  font-size: 48px;
  margin-bottom: 16px;
}
.error-container h2 {
  font-family: var(--font-display);
  font-size: 24px;
  margin-bottom: 8px;
}
.error-container p {
  color: var(--text-sub);
  margin-bottom: 24px;
}

/* Skeleton */
@keyframes pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
  100% {
    opacity: 1;
  }
}
.skeleton-box {
  background: var(--surface-2);
  border-radius: 8px;
  animation: pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
.sk-nav {
  width: 120px;
  height: 24px;
  margin-bottom: 24px;
}
.sk-badge {
  width: 80px;
  height: 24px;
  border-radius: 100px;
  margin-bottom: 16px;
}
.sk-title {
  width: 100%;
  height: 32px;
  margin-bottom: 8px;
}
.sk-title.short {
  width: 70%;
  margin-bottom: 12px;
}
.sk-meta {
  width: 60%;
  height: 20px;
  margin-bottom: 32px;
}
.sk-doc {
  width: 100%;
  height: 280px;
  border-radius: var(--radius);
  margin-bottom: 32px;
}
.sk-btn {
  width: 100%;
  height: 56px;
  border-radius: var(--radius-sm);
}
