:root {
  --primary: #27ae60;
  --dark: #2c3e50;
  --light: #ecf0f1;
  --danger: #c0392b;
  --info: #2980b9;
  --warn: #f39c12;
}

body {
  font-family: 'Segoe UI', sans-serif;
  background: var(--light);
  margin: 0;
  padding: 15px;
  color: #333;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn {
  padding: 8px 15px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  color: white;
  font-weight: bold;
  font-size: 0.9em;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  justify-content: center;
}

.btn:hover {
  opacity: 0.9;
}

.btn-green {
  background: var(--primary);
}

.btn-red {
  background: var(--danger);
}

.btn-blue {
  background: var(--info);
}

.btn-orange {
  background: var(--warn);
}

.btn:disabled {
  background: #95a5a6;
  cursor: not-allowed;
  opacity: 0.7;
}

input,
select,
textarea {
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 5px;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 12px;
}

.spinner {
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top: 3px solid #fff;
  width: 16px;
  height: 16px;
  animation: spin 1s linear infinite;
  display: inline-block;
  margin-right: 8px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.tabs {
  display: flex;
  border-bottom: 2px solid #ddd;
  margin-bottom: 20px;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}

.tab {
  padding: 12px 20px;
  cursor: pointer;
  color: #777;
  font-weight: bold;
  text-decoration: none;
}

.tab.active {
  color: var(--primary);
  border-bottom: 3px solid var(--primary);
  background: #f9f9f9;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.4s;
}

@keyframes fadeIn {
  from {
    opacity: 0
  }

  to {
    opacity: 1
  }
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 10px;
  box-sizing: border-box;
}

.modal-content {
  background: white;
  padding: 25px;
  border-radius: 8px;
  width: 600px;
  max-width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.table-wrap {
  overflow-x: auto;
  margin-top: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95em;
  min-width: 600px;
}

th {
  background: var(--dark);
  color: white;
  padding: 10px;
  text-align: left;
}

td {
  border-bottom: 1px solid #eee;
  padding: 10px;
  vertical-align: top;
}

.badge {
  background: #eee;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.8em;
}

.game-grid {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  justify-content: center;
}

.g-card {
  background: white;
  padding: 20px;
  width: 140px;
  text-align: center;
  border-radius: 8px;
  border-bottom: 4px solid var(--primary);
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s;
}

.g-card:hover {
  transform: translateY(-5px);
}

.thumb-img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
  cursor: pointer;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.header-user {
  display: flex;
  gap: 10px;
  align-items: center;
}

.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 85vh;
  background: linear-gradient(135deg, #27ae60 0%, #2c3e50 100%);
  padding: 20px;
  border-radius: 10px;
}

.login-card {
  background: white;
  padding: 30px;
  border-radius: 15px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 400px;
}

.login-tabs {
  display: flex;
  margin-bottom: 20px;
  border-bottom: 1px solid #eee;
}

.l-tab {
  flex: 1;
  text-align: center;
  padding: 10px;
  cursor: pointer;
  font-size: 0.9em;
  color: #777;
  border-bottom: 2px solid transparent;
}

.l-tab.active {
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
  font-weight: bold;
}

.login-form {
  display: none;
}

.login-form.active {
  display: block;
}

#student_list label {
  display: flex !important;
  align-items: center !important;
  gap: 10px;
  cursor: pointer;
}

#student_list input[type="checkbox"] {
  margin: 0 !important;
  margin-right: 10px !important;
  width: 18px;
  height: 18px;
}

.responsive-header {
  background: linear-gradient(135deg, var(--primary) 0%, #2c3e50 100%);
  padding: 15px 25px;
  border-radius: 10px;
  margin-bottom: 25px;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.header-right {
  display: flex;
  gap: 10px;
  align-items: center;
}

@media (max-width: 768px) {
  .responsive-header {
    flex-direction: column;
    text-align: center;
    padding: 20px 15px;
    gap: 15px;
  }

  .header-left {
    flex-direction: column;
    margin-bottom: 5px;

  }

  .header-right {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .header-right .btn {
    flex: 1 1 auto;
    min-width: 100px;
    font-size: 0.85em;
    padding: 10px;
    justify-content: center;
  }
}

.footer-wrapper {
  margin-top: 40px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  background: white;
}

.footer-sponsor-container {
  background: #ffffff;
  padding: 20px 0;
  border-bottom: 1px solid #eee;
  position: relative;
}

.sponsor-title {
  text-align: center;
  font-weight: bold;
  color: var(--dark);
  font-size: 0.9em;
  margin-bottom: 15px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sponsor-scroller {
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  width: 100%;
}

.sponsor-scroller::-webkit-scrollbar {
  display: none;
}

.sponsor-track {
  display: inline-flex;
  gap: 40px;
  padding: 0 20px;
}

.sponsor-logo {
  height: 45px;
  width: auto;
  object-fit: contain;
  filter: grayscale(100%);
  opacity: 0.6;
  transition: all 0.3s;
  cursor: pointer;
  user-select: none;
  -webkit-user-drag: none;
}

.sponsor-logo:hover {
  filter: grayscale(0%);
  opacity: 1;
  transform: scale(1.1);
}

@keyframes scrollSponsor {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

.main-footer {
  background: linear-gradient(135deg, var(--primary) 0%, #2c3e50 100%);
  color: white;
  text-align: center;
  padding: 15px;
  font-size: 0.9em;
  font-weight: 500;
margin-top: 15px;
}

.slot-drop-zone {
  display: inline-block;
  min-width: 80px;
  height: 30px;
  border-bottom: 2px solid var(--primary);
  background: #f0f0f0;
  margin: 0 5px;
  vertical-align: middle;
  text-align: center;
  line-height: 30px;
  cursor: pointer;
  padding: 0 5px;
  color: var(--dark);
  font-weight: bold;
  border-radius: 4px;
}

.slot-filled {
  background: var(--info);
  color: white;
  border: none;
}

.word-drag {
  display: inline-block;
  padding: 8px 15px;
  background: white;
  border: 1px solid var(--primary);
  color: var(--primary);
  border-radius: 20px;
  cursor: grab;
  font-weight: bold;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  user-select: none;
}

.word-drag:active {
  cursor: grabbing;
}

.word-used {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

.word-selected {
  background: var(--warn);
  color: white;
  border-color: var(--warn);
  transform: scale(1.1);
}

.jodoh-container {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 20px;
  user-select: none;
}

.j-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.j-item {
  background: white;
  border: 2px solid #ddd;
  padding: 15px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  font-weight: bold;
  color: #555;
  position: relative;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.j-item:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

.j-item.selected {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: scale(1.05);
  box-shadow: 0 5px 15px rgba(39, 174, 96, 0.4);
  z-index: 2;
}

.j-item.matched {
  background: #ecf0f1;
  color: #bdc3c7;
  border-color: #eee;
  cursor: default;
  pointer-events: none;
  opacity: 0.6;
  transform: scale(0.95);
  text-decoration: line-through;
}

.j-item.wrong-anim {
  animation: shake 0.4s ease-in-out;
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

.pair-row {
  display: flex;
  gap: 5px;
  margin-bottom: 5px;
}

.pair-row input {
  margin-bottom: 0 !important;
}

.pkg-card {
  border: 2px solid #ddd;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.pkg-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.pkg-card.selected {
  border-color: #27ae60;
  background: #f0fdf4;
}

.pkg-check {
  display: none;
  position: absolute;
  top: 10px;
  right: 10px;
  color: #27ae60;
  font-size: 1.2em;
}

.pkg-card.selected .pkg-check {
  display: block;
}

.pkg-price {
  font-size: 1.2em;
  font-weight: bold;
  color: #27ae60;
  margin: 10px 0;
}

.exam-nav-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  padding: 15px;
  background: #f8f9fa;
  border: 1px solid #ddd;
  border-radius: 8px;
  justify-content: center;
}

.exam-nav-item {
  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9em;
  font-weight: bold;
  transition: all 0.2s;
}

.exam-nav-item:hover {
  background: #eee;
  transform: scale(1.1);
}

.exam-nav-item.active {
  border-color: #2980b9;
  box-shadow: 0 0 0 2px #2980b9 inset;
  font-weight: bold;
}

.exam-nav-item.filled {
  background: #27ae60;
  color: white;
  border-color: #27ae60;
}

.exam-nav-item.flagged {
  background: #f39c12;
  color: white;
  border-color: #f39c12;
}

.exam-controls {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid #eee;
}

.ans-selected {
  background-color: #d4edda !important;
  border-color: #27ae60 !important;
  color: #155724 !important;
  font-weight: bold;
}

.exam-nav-container {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 20px;
  padding: 10px;
  background: #f8f9fa;
  border: 1px solid #ddd;
  border-radius: 8px;
  justify-content: center;
}

.exam-nav-item {
  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}

.exam-nav-item.active {
  border-color: #2980b9;
  box-shadow: 0 0 0 2px #2980b9 inset;
}

.exam-nav-item.filled {
  background: #27ae60;
  color: white;
  border-color: #27ae60;
}

.exam-nav-item.flagged {
  background: #f39c12;
  color: white;
  border-color: #f39c12;
}

.ans-selected {
  background-color: #d4edda !important;
  border-color: #27ae60 !important;
  font-weight: bold;
}

.exam-controls {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid #eee;
}

.fab-donate {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #ec4899;
  color: white;
  padding: 12px 25px;
  border-radius: 50px;
  box-shadow: 0 4px 15px rgba(236, 72, 153, 0.4);
  cursor: pointer;
  z-index: 9999;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.2s;
}

.fab-donate:hover {
  transform: scale(1.05);
}

.don-hist-item {
  padding: 10px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
}

.site-title {
  font-size: 22px;
}

@media only screen and (max-width: 600px) {
  .site-title {
    font-size: 35px !important;
    letter-spacing: -0.5px;
  }
  .header-left {
    gap: 10px;
  }
}

@media (max-width: 600px) {
  #g-topics.game-grid {
    display: block !important;
    width: 100% !important;
    padding: 0 5px;
  }
  #g-menu.game-grid,
  #g-topics-list.game-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    justify-content: stretch !important;
  }
  .g-card {
    width: 100% !important;
    box-sizing: border-box;
    padding: 10px !important;
    margin: 0 !important;
    min-height: 110px;
  }
  #g-menu .g-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
  }
  #g-topics-list .g-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: left !important;
  }
  .g-card div[style*="font-weight:bold"] {
    font-size: 0.9em !important;
    line-height: 1.3;
  }
  .g-card span[style*="background:rgba"] {
    display: none;
  }
  #g-topics>div:first-child {
    display: flex !important;
    gap: 10px;
    margin-bottom: 15px !important;
    width: 100%;
  }
  #g-menu[style*="none"],
  #g-topics[style*="none"],
  .game-grid[style*="none"] {
    display: none !important;
  }
}

/* Modal Styling */
#detailModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

#detContent {
    background: white;
    border-radius: 10px;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 5px 30px rgba(0,0,0,0.3);
    animation: modalFadeIn 0.3s;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Spinner */
.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}