@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #f4efe6;
  --surface: #fffaf1;
  --surface-strong: #ffffff;
  --text: #1f2937;
  --muted: #5b6472;
  --line: #1f2937;
  --accent: #ffb703;
  --accent-2: #3a86ff;
  --accent-3: #e63946;
  --shadow: 8px 8px 0 #1f2937;
  --shadow-soft: 0 14px 30px rgba(31, 41, 55, 0.12);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(
      circle at top left,
      rgba(255, 183, 3, 0.18),
      transparent 25%
    ),
    radial-gradient(
      circle at top right,
      rgba(58, 134, 255, 0.12),
      transparent 22%
    ),
    var(--bg);
  color: var(--text);
  overflow-x: hidden;
  line-height: 1.6;
}

a {
  color: inherit;
}

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 5%;
  background: rgba(255, 250, 241, 0.96);
  border-bottom: 4px solid var(--line);
  box-shadow: 0 6px 0 rgba(31, 41, 55, 0.08);
  backdrop-filter: blur(6px);
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.4px;
  color: var(--line);
  white-space: nowrap;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
  justify-content: center;
}

.nav a {
  position: relative;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  padding: 0.45rem 0.15rem;
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0.08rem;
  width: 100%;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease;
}

.nav a:hover::after,
.nav a:focus-visible::after {
  transform: scaleX(1);
}

.nav a:hover,
.nav a:focus-visible {
  color: var(--line);
}

.login-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: var(--accent-2);
  color: #fff;
  border: 3px solid var(--line);
  border-radius: 999px;
  padding: 0.75rem 1.2rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

.login-btn:hover,
.login-btn:focus-visible {
  transform: translate(-2px, -2px);
  box-shadow: 10px 10px 0 rgba(31, 41, 55, 0.95);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.username {
  color: var(--line);
  font-weight: 700;
  background: #fff;
  border: 2px solid var(--line);
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
}

.logout-btn {
  background: var(--accent-3);
}

.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 5rem 1.25rem 4rem;
  max-width: 1100px;
  margin: 0 auto;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 1.5rem;
  border: 4px solid var(--line);
  border-radius: 32px;
  background: rgba(255, 250, 241, 0.55);
  box-shadow: var(--shadow);
  z-index: -1;
}

.hero-title {
  max-width: 900px;
  font-size: clamp(2rem, 5vw, 4.2rem);
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--line);
}

.hero-desc {
  max-width: 700px;
  margin-top: 1rem;
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--muted);
}

.hero-btn {
  margin-top: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.95rem 1.5rem;
  border-radius: 999px;
  border: 3px solid var(--line);
  background: var(--accent);
  color: #1b1b1b;
  font-weight: 800;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease;
}

.hero-btn:hover,
.hero-btn:focus-visible {
  transform: translate(-2px, -2px);
  box-shadow: 10px 10px 0 rgba(31, 41, 55, 0.95);
}

.mata {
  padding: 1rem 5% 3rem;
  max-width: 1440px;
  margin: 0 auto;
}

.mata h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  margin-bottom: 1.5rem;
  color: var(--line);
}

.subjects {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.25rem;
}

.subject-card {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1.25rem;
  background: var(--surface-strong);
  border: 3px solid var(--line);
  border-radius: 24px;
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow-soft);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
  min-height: 100%;
}

.subject-card:hover,
.subject-card:focus-visible {
  transform: translate(-2px, -2px);
  box-shadow: 12px 12px 0 rgba(31, 41, 55, 0.95);
  border-color: var(--accent-2);
}

.subject-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 150px;
  border: 3px solid var(--line);
  border-radius: 18px;
  background: #f8f3ea;
  overflow: hidden;
  color: var(--line);
  font-size: 3rem;
  font-weight: 800;
}

.subject-icon img {
  display: block;
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.subject-card br {
  display: none;
}

.subject-card {
  font-size: 0.98rem;
  line-height: 1.55;
}

.subject-card strong,
.subject-card b {
  font-weight: 700;
}

.features {
  padding: 1rem 5% 3.5rem;
  max-width: 1440px;
  margin: 0 auto;
}

footer {
  margin-top: 2rem;
  padding: 1.4rem 1rem;
  text-align: center;
  background: #1f2937;
  color: #fff7e6;
  border-top: 4px solid var(--line);
}

footer p {
  font-weight: 600;
}

/* --- Admin & Form Styles --- */
.admin-container,
.container-materi {
  max-width: 1100px;
  margin: 40px auto;
  padding: 30px;
  background: var(--surface-strong);
  border: 4px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.container-materi {
  max-width: 700px;
}

.admin-title-area {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 15px;
}

.status-msg {
  font-weight: 700;
  margin-bottom: 20px;
  border: 3px solid var(--line);
  padding: 15px;
  border-radius: 12px;
  box-shadow: 4px 4px 0 var(--line);
}

.status-msg.success {
  background-color: #d1fae5;
  color: #065f46;
  border-color: #059669;
}
.status-msg.error {
  background-color: #fee2e2;
  color: #991b1b;
  border-color: #dc2626;
}

.table-responsive {
  overflow-x: auto;
  margin-top: 20px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 4px solid var(--line);
}

th,
td {
  padding: 15px;
  border: 2px solid var(--line);
  text-align: left;
}

th {
  background-color: var(--accent);
  color: var(--line);
  font-weight: 800;
  text-transform: uppercase;
}

.form-group {
  margin-bottom: 20px;
}
.form-group label {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--line);
}
.form-group input,
.form-group textarea {
  width: 100%;
  display: block;
  padding: 12px;
  border: 3px solid var(--line);
  border-radius: 12px;
  font-size: 1rem;
  font-family: inherit;
}

.btn-action {
  display: inline-block;
  padding: 8px 16px;
  text-decoration: none;
  font-weight: 700;
  border: 2px solid var(--line);
  border-radius: 8px;
  margin-right: 5px;
  transition: transform 0.1s;
  color: #fff;
}

.btn-edit {
  background: var(--accent-2);
}
.btn-delete {
  background: var(--accent-3);
}
.btn-action:hover {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 var(--line);
}

@media (max-width: 900px) {
  .header {
    flex-direction: column;
    align-items: stretch;
  }

  .nav {
    justify-content: flex-start;
  }

  .user-info {
    justify-content: flex-start;
  }

  .hero {
    padding-top: 3.5rem;
  }

  .hero::before {
    inset: 1rem;
  }
}

@media (max-width: 640px) {
  .header {
    padding: 0.9rem 1rem;
  }

  .logo {
    font-size: 1.25rem;
  }

  .nav {
    gap: 0.7rem 1rem;
  }

  .login-btn,
  .username {
    width: 100%;
    justify-content: center;
  }

  .hero {
    padding: 2.5rem 1rem 2rem;
  }

  .hero::before {
    inset: 0.5rem;
    border-radius: 24px;
  }

  .subjects {
    grid-template-columns: 1fr;
  }

  .subject-icon img {
    height: 160px;
  }
}
