@import url("home.css");

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #9a623a;
  --ink: #202124;
  --muted: #6d7280;
  --line: #e7e1dc;
  --paper: #fffaf5;
  --surface: #ffffff;
  --blue: #3467d6;
  --cyan: #039bb8;
  --orange: #d88718;
  --green: #25845a;
  --gold: #b88311;
  --red: #cf4242;
  --shadow: 0 14px 35px rgba(51, 37, 26, 0.12);
  --radius: 8px;
}

body.dark-theme {
  --primary: #d69871;
  --ink: #e8eaed;
  --muted: #9aa0a6;
  --line: #44474a;
  --paper: #202124;
  --surface: #2d2e31;
  --shadow: 0 14px 35px rgba(0, 0, 0, 0.6);
  background:
    linear-gradient(180deg, rgba(154, 98, 58, 0.05), rgba(3, 155, 184, 0.03)),
    #121212;
}

body {
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(154, 98, 58, 0.05), rgba(3, 155, 184, 0.03)),
    #f4f6f8;
  color: var(--ink);
  display: flex;
  justify-content: center;
  padding: 20px;
  font-family: "Kantumruy Pro", Arial, sans-serif;
}

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

button,
input {
  font: inherit;
}

.app-shell {
  width: 100%;
  max-width: 390px;
  min-height: calc(100vh - 40px);
  background: var(--paper);
  border: 1px solid rgba(154, 98, 58, 0.16);
  border-radius: 12px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  margin-bottom: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
}

.brand img {
  width: 68px;
  height: auto;
  display: block;
}

.brand.compact img {
  width: 56px;
}

.topbar-spacer {
  width: 42px;
  height: 42px;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mobile-menu {
  display: none;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 18px;
}

.mobile-menu.is-open {
  display: flex;
}

.mobile-menu a {
  border-radius: 6px;
  color: var(--ink);
  font-weight: 600;
  padding: 10px 12px;
}

.mobile-menu a:hover {
  background: #f5eee7;
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 20px 0 24px;
}

.hero img {
  width: 80px;
  height: auto;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
  100% {
    transform: translateY(0px);
  }
}

.hero h1 {
  margin: 0;
  line-height: 1.3;
}

.hero p {
  margin: 0;
  line-height: 1.5;
}

.primary-action,
.secondary-action {
  min-height: 48px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  cursor: pointer;
  font-weight: 700;
}

.primary-action {
  width: 100%;
  background: var(--primary);
  color: #fff;
}

.secondary-action {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--primary);
  padding: 0 14px;
}

/* --- Animation ពេលបង្ហាញកាត --- */
@keyframes fadeSlideUp {
  0% {
    opacity: 0;
    transform: translateY(15px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.animate-enter {
  opacity: 0; /* លាក់ជាបណ្តោះអាសន្នមុនពេល Animation ដើរ */
  animation: fadeSlideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@media (min-width: 768px) {
  body {
    align-items: center;
    padding: 32px;
  }

  .app-shell {
    max-width: 860px;
    min-height: auto;
    padding: 28px;
  }

  .topbar {
    margin-bottom: 24px;
  }

  .brand img {
    width: 88px;
  }

  .brand.compact img {
    width: 76px;
  }

  .hero {
    padding: 32px 20px 40px;
    gap: 10px;
  }

  .hero img {
    width: 90px;
  }

  .hero h1 {
    font-size: 36px;
  }

  .hero p {
    max-width: 620px;
    font-size: 15px;
  }

  .hero .primary-action {
    width: auto;
    padding: 0 40px;
  }

  .category-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .category-card {
    min-height: 126px;
    grid-template-columns: 78px 1fr 22px;
    padding: 18px;
  }

  .category-card img {
    width: 78px;
    height: 78px;
  }

  .category-card h3 {
    font-size: 17px;
  }

  .compact-detail {
    grid-template-columns: 112px 1fr;
    gap: 22px;
    padding: 22px;
  }

  .compact-detail img {
    width: 112px;
    height: 112px;
  }

  .compact-detail h1 {
    font-size: 23px;
  }

  .compact-detail p {
    font-size: 14px;
  }

  .exam-type-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }

  .exam-type-card {
    min-height: 194px;
    grid-template-columns: 1fr;
    align-content: start;
    padding: 18px;
  }

  .exam-type-card > i {
    justify-self: end;
  }

  .exam-type-icon {
    width: 54px;
    height: 54px;
  }

  .result-card {
    padding: 32px;
  }

  .result-actions {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1100px) {
  .app-shell {
    max-width: 1040px;
  }

  .category-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  body {
    padding: 0;
  }

  .app-shell {
    max-width: none;
    min-height: 100vh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
}

@media (max-width: 340px) {
  .app-shell {
    padding: 14px;
  }

  .category-card {
    grid-template-columns: 52px 1fr 18px;
    padding: 10px;
  }

  .category-card img {
    width: 52px;
    height: 52px;
  }

  .hero h1 {
    font-size: 24px;
  }

  .compact-detail {
    grid-template-columns: 64px 1fr;
  }

  .compact-detail img {
    width: 64px;
    height: 64px;
  }

  .exam-type-card {
    grid-template-columns: 40px 1fr 16px;
    padding: 12px;
  }

  .exam-type-icon {
    width: 40px;
    height: 40px;
  }

  .quiz-actions,
  .result-stats {
    grid-template-columns: 1fr;
  }
}
