@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@400;600;700&display=swap');

:root {
  --purple-900: #4C1D95;
  --purple-800: #5B21B6;
  --purple-700: #6D28D9;
  --purple-600: #7C3AED;
  --purple-500: #8B5CF6;
  --purple-400: #A78BFA;
  --purple-100: #EDE9FE;
  --purple-50: #F5F3FF;
  --white: #FFFFFF;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-500: #6B7280;
  --gray-700: #374151;
  --gray-900: #111827;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Sarabun', sans-serif;
  background-color: var(--purple-50);
  margin: 0;
  padding: 0;
}

.container {
  max-width: 800px;
  margin: auto;
  padding: 1rem;
}

.header {
  background: linear-gradient(to right, var(--purple-800), var(--purple-600));
  color: var(--white);
  padding: 1rem 1.5rem;
  font-size: 1.1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-title {
  font-weight: 600;
  flex: 1;
}

.header-login-btn {
  background: rgba(255, 255, 255, 0.2);
  color: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-family: 'Sarabun', sans-serif;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.header-login-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.cover-section {
  margin: 0 auto 1.5rem auto;
  text-align: center;
}

.cover-image {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.search-section {
  margin: 1rem auto;
  max-width: 600px;
}

.search-wrapper {
  position: relative;
}

.search-input {
  width: 100%;
  padding: 12px 20px 12px 45px;
  border-radius: 25px;
  border: 2px solid var(--purple-400);
  font-size: 1rem;
  outline: none;
  transition: all 0.3s ease;
}

.search-input:focus {
  border-color: var(--purple-600);
  box-shadow: 0 0 0 3px var(--purple-100);
}

.search-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-500);
}

.category-section {
  margin: 1rem;
}

.category-card {
  background: var(--white);
  border-radius: 12px;
  margin-bottom: 1rem;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: all 0.3s ease;
}

.category-header {
  padding: 15px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  background: var(--white);
  transition: background 0.3s ease;
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--purple-800);
}

.category-header:hover {
  background: var(--purple-50);
}

.category-header .icon {
  margin-right: 10px;
  font-size: 1.3rem;
}

.category-header .arrow {
  transition: transform 0.3s ease;
}

.category-card .open .arrow {
  transform: rotate(180deg);
}

.category-items {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.category-items.open {
  max-height: 2000px;
}

.item-row {
  padding: 12px 20px 12px 50px;
  display: flex;
  align-items: center;
  border-top: 1px solid var(--gray-200);
  cursor: pointer;
  transition: background 0.3s ease;
}

.item-row:hover {
  background: var(--purple-50);
}

.item-row .play-icon {
  color: var(--purple-600);
  margin-right: 10px;
  font-size: 1.1rem;
}

.item-row .item-title {
  color: var(--gray-700);
  flex: 1;
}

.login-btn-section {
  text-align: center;
  margin: 2rem;
}

.btn-login {
  background: linear-gradient(to right, var(--purple-700), var(--purple-500));
  color: var(--white);
  border: none;
  padding: 12px 40px;
  border-radius: 25px;
  font-size: 1.1rem;
  cursor: pointer;
  font-family: 'Sarabun', sans-serif;
  font-weight: 600;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--white);
  border-radius: 12px;
  width: 95%;
  max-width: 900px;
  height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: var(--purple-800);
  color: var(--white);
}

.modal-close {
  background: none;
  border: none;
  color: var(--white);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-body {
  flex: 1;
  padding: 0;
}

.modal-body iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.footer {
  text-align: center;
  padding: 2rem;
  color: var(--gray-500);
  font-size: 0.85rem;
}

.no-results {
  text-align: center;
  padding: 2rem;
  color: var(--gray-500);
}

/* Admin Page Styles */
.admin-login-container {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(to bottom, var(--purple-50), var(--white));
}

.admin-login-card {
  background: var(--white);
  padding: 2.5rem;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.admin-login-card h2 {
  color: var(--purple-800);
  margin-bottom: 1.5rem;
}

.admin-login-card .lock-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.password-input {
  width: 100%;
  padding: 12px 20px;
  border-radius: 8px;
  border: 2px solid var(--gray-200);
  font-size: 1rem;
  text-align: center;
  letter-spacing: 3px;
  margin-bottom: 1rem;
  outline: none;
  transition: all 0.3s ease;
}

.password-input:focus {
  border-color: var(--purple-600);
}

.btn-admin-login {
  width: 100%;
  background: linear-gradient(to right, var(--purple-700), var(--purple-500));
  color: var(--white);
  border: none;
  padding: 12px;
  border-radius: 8px;
  font-size: 1.1rem;
  cursor: pointer;
  font-weight: 600;
  font-family: 'Sarabun', sans-serif;
}

.login-error {
  color: #EF4444;
  margin-top: 1rem;
  display: none;
}

.admin-header {
  background: linear-gradient(to right, var(--purple-800), var(--purple-600));
  color: var(--white);
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.btn-logout {
  background: rgba(255,255,255,0.2);
  color: var(--white);
  border: 1px solid rgba(255,255,255,0.3);
  padding: 8px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Sarabun', sans-serif;
}

.admin-tabs {
  display: flex;
  background: var(--white);
  border-bottom: 2px solid var(--gray-200);
  overflow-x: auto;
}

.admin-tab {
  padding: 12px 24px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: 'Sarabun', sans-serif;
  font-size: 1rem;
  color: var(--gray-500);
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
}

.admin-tab.active {
  color: var(--purple-700);
  border-bottom-color: var(--purple-700);
  font-weight: 600;
}

.admin-panel {
  padding: 1.5rem;
  display: none;
}

.admin-panel.active {
  display: block;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--gray-700);
}

.form-group input, 
.form-group select, 
.form-group textarea {
  width: 100%;
  padding: 10px 15px;
  border-radius: 8px;
  border: 1px solid var(--gray-200);
  font-size: 1rem;
  font-family: 'Sarabun', sans-serif;
  outline: none;
  transition: all 0.3s ease;
}

.form-group input:focus, 
.form-group select:focus, 
.form-group textarea:focus {
  border-color: var(--purple-600);
}

.btn-primary {
  background: var(--purple-700);
  color: var(--white);
  border: none;
  padding: 10px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Sarabun', sans-serif;
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn-primary:hover {
  background: var(--purple-800);
}

.btn-danger {
  background: #EF4444;
  color: var(--white);
  border: none;
  padding: 10px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Sarabun', sans-serif;
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn-danger:hover {
  background: #DC2626;
}

.btn-secondary {
  background: var(--gray-200);
  color: var(--gray-700);
  border: none;
  padding: 10px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Sarabun', sans-serif;
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn-secondary:hover {
  background: var(--gray-300);
}

.admin-card {
  background: var(--white);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.admin-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid var(--gray-100);
}

.admin-item-actions {
  display: flex;
  gap: 8px;
}

.cover-preview {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  border-radius: 8px;
  margin-top: 1rem;
  border: 2px dashed var(--gray-200);
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #10B981;
  color: var(--white);
  padding: 12px 24px;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  z-index: 2000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.error {
  background: #EF4444;
}

/* === Splash Screen === */
.splash-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--purple-100), var(--white));
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.splash-content {
  text-align: center;
  padding: 2rem;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(109, 40, 217, 0.15);
  max-width: 90%;
  width: 500px;
  animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

.splash-logo {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.splash-title {
  color: var(--purple-800);
  margin: 0 0 0.5rem 0;
  font-size: 1.4rem;
}

.splash-subtitle {
  color: var(--purple-600);
  margin: 0 0 2rem 0;
  font-size: 1.1rem;
  font-weight: normal;
}

.btn-enter {
  background: linear-gradient(to right, var(--purple-700), var(--purple-500));
  color: white;
  border: none;
  padding: 14px 32px;
  border-radius: 30px;
  font-size: 1.2rem;
  font-family: 'Sarabun', sans-serif;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(109, 40, 217, 0.3);
  transition: all 0.3s ease;
}

.btn-enter:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(109, 40, 217, 0.4);
  background: linear-gradient(to right, var(--purple-600), var(--purple-400));
}

@media (max-width: 768px) {
  .container { padding: 0.5rem; }
  .category-header { font-size: 1rem; }
  .item-row { padding-left: 35px; }
  .admin-tabs { font-size: 0.9rem; }
  .modal-content { height: 90vh; width: 98%; }
  
  .header {
    flex-direction: column;
    gap: 12px;
    padding: 1rem;
    text-align: center;
  }
  .header-title {
    font-size: 1rem;
    line-height: 1.4;
  }
}
