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

:root {
  --primary-color: #6366f1;
  --secondary-color: #a855f7;
  --accent-color: #ec4899;
  --text-primary: #ffffff;
  --text-secondary: #cbd5e1;
  --bg-color: #0f172a;
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Kanit', sans-serif;
}

body {
  background: linear-gradient(-45deg, #0f172a, #2e1065, #1e1b4b, #312e81, #0f172a);
  background-size: 400% 400%;
  animation: gradientBG 20s ease infinite;
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

@keyframes gradientBG {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes pulse-glow {
  0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
  70% { box-shadow: 0 0 0 20px rgba(99, 102, 241, 0); }
  100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

@keyframes moveShape1 {
  0% { transform: translate(0, 0) scale(1) rotate(0deg); }
  33% { transform: translate(150px, 150px) scale(1.3) rotate(120deg); }
  66% { transform: translate(50px, 300px) scale(0.8) rotate(240deg); }
  100% { transform: translate(0, 0) scale(1) rotate(360deg); }
}

@keyframes moveShape2 {
  0% { transform: translate(0, 0) scale(1) rotate(0deg); }
  33% { transform: translate(-200px, -150px) scale(1.3) rotate(-120deg); }
  66% { transform: translate(-100px, -300px) scale(0.9) rotate(-240deg); }
  100% { transform: translate(0, 0) scale(1) rotate(-360deg); }
}

@keyframes moveShape3 {
  0% { transform: translate(0, 0) scale(1) rotate(0deg); }
  50% { transform: translate(300px, -200px) scale(1.5) rotate(180deg); }
  100% { transform: translate(0, 0) scale(1) rotate(360deg); }
}

/* Animated Background Container */
.animated-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Background Elements */
.bg-shape {
  position: absolute;
  filter: blur(120px);
  z-index: 0;
  border-radius: 50%;
  opacity: 0.6;
  mix-blend-mode: screen;
}

.shape-1 {
  width: 600px;
  height: 600px;
  background: var(--primary-color);
  top: -200px;
  left: -200px;
  animation: moveShape1 25s infinite alternate ease-in-out;
}

.shape-2 {
  width: 500px;
  height: 500px;
  background: var(--accent-color);
  bottom: -150px;
  right: -150px;
  animation: moveShape2 30s infinite alternate ease-in-out;
}

.shape-3 {
  width: 400px;
  height: 400px;
  background: #38bdf8; /* cyan */
  top: 30%;
  left: 50%;
  animation: moveShape3 20s infinite alternate ease-in-out;
}

/* Particles Effect */
.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
}

.particles li {
    position: absolute;
    display: block;
    list-style: none;
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    animation: animateParticles 25s linear infinite;
    bottom: -150px;
    border-radius: 50%;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 0 20px rgba(255,255,255,0.1);
}

.particles li:nth-child(1) { left: 25%; width: 80px; height: 80px; animation-delay: 0s; }
.particles li:nth-child(2) { left: 10%; width: 20px; height: 20px; animation-delay: 2s; animation-duration: 12s; }
.particles li:nth-child(3) { left: 70%; width: 20px; height: 20px; animation-delay: 4s; }
.particles li:nth-child(4) { left: 40%; width: 60px; height: 60px; animation-delay: 0s; animation-duration: 18s; }
.particles li:nth-child(5) { left: 65%; width: 20px; height: 20px; animation-delay: 0s; }
.particles li:nth-child(6) { left: 75%; width: 110px; height: 110px; animation-delay: 3s; }
.particles li:nth-child(7) { left: 35%; width: 150px; height: 150px; animation-delay: 7s; }
.particles li:nth-child(8) { left: 50%; width: 25px; height: 25px; animation-delay: 15s; animation-duration: 45s; }
.particles li:nth-child(9) { left: 20%; width: 15px; height: 15px; animation-delay: 2s; animation-duration: 35s; }
.particles li:nth-child(10) { left: 85%; width: 150px; height: 150px; animation-delay: 0s; animation-duration: 11s; }

@keyframes animateParticles {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
        border-radius: 10px;
    }
    100% {
        transform: translateY(-1200px) rotate(720deg);
        opacity: 0;
        border-radius: 50%;
    }
}

/* Index Page */
.hero-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 4rem 2rem 2rem 2rem;
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
}

.hero-content-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 3rem 2rem;
  max-width: 800px;
  z-index: 10;
  position: relative;
  width: 100%;
}

@media (min-width: 992px) {
  .hero-content-center {
    padding: 4rem 3rem;
  }
}

.logo-wrapper {
  margin-bottom: 0.5rem;
  animation: float 6s ease-in-out infinite;
}

.logo-wrapper img {
  max-width: 140px;
  height: auto;
  filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.2));
}

.hero-title {
  font-size: 3.2rem;
  font-weight: 700;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: fadeIn 1s ease-out;
  line-height: 1.2;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  max-width: 600px;
  animation: fadeIn 1s ease-out 0.2s backwards;
  line-height: 1.6;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 2rem;
  font-size: 1.1rem;
  font-weight: 500;
  color: #fff;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  border: none;
  border-radius: 50px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.3s ease;
  animation: fadeIn 1s ease-out 0.4s backwards, pulse-glow 2s infinite;
  box-shadow: 0 10px 20px -10px rgba(99, 102, 241, 0.5);
  margin-bottom: 1.5rem;
}

.btn-primary:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 15px 30px -10px rgba(99, 102, 241, 0.6);
}

.btn-primary i {
  transition: transform 0.3s ease;
}

.btn-primary:hover i {
  transform: translateX(5px);
}

/* Programs Page */
.page-container {
  padding: 4rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.page-header {
  text-align: center;
  margin-bottom: 4rem;
}

.page-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  margin-bottom: 2rem;
  transition: color 0.3s ease;
}

.back-link:hover {
  color: #fff;
}

.programs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.program-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 2rem;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  text-decoration: none;
  color: var(--text-primary);
  opacity: 0;
  animation: fadeIn 0.6s ease-out forwards;
}

.program-card:nth-child(1) { animation-delay: 0.1s; }
.program-card:nth-child(2) { animation-delay: 0.2s; }
.program-card:nth-child(3) { animation-delay: 0.3s; }
.program-card:nth-child(4) { animation-delay: 0.4s; }
.program-card:nth-child(5) { animation-delay: 0.5s; }
.program-card:nth-child(6) { animation-delay: 0.6s; }

.program-card:hover {
  transform: translateY(-10px);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.3);
}

.card-icon {
  width: 60px;
  height: 60px;
  border-radius: 15px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--secondary-color);
  transition: all 0.3s ease;
}

.program-card:hover .card-icon {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: #fff;
  transform: scale(1.1) rotate(5deg);
}

.card-content h3 {
  font-size: 1.3rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: #fff;
}

.card-content p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

.card-arrow {
  margin-top: auto;
  align-self: flex-end;
  color: var(--text-secondary);
  font-size: 1.25rem;
  transition: all 0.3s ease;
}

.program-card:hover .card-arrow {
  color: #fff;
  transform: translateX(5px);
}

/* Responsive */
@media (max-width: 768px) {
  .hero-title {
    font-size: 2.2rem;
  }
  
  .hero-subtitle {
    font-size: 1rem;
  }
  
  .programs-grid {
    grid-template-columns: 1fr;
  }
}

/* Floating Images Section */
.floating-gallery {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.float-img {
  position: absolute;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4), inset 0 1px 1px rgba(255,255,255,0.3);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
  animation: floatImg 8s ease-in-out infinite;
  opacity: 0.8;
  transition: opacity 0.3s;
}

.float-img img {
  width: 100%;
  height: auto;
  display: block;
}

.float-img::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0.05) 30%, rgba(255,255,255,0) 100%);
  pointer-events: none;
}

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

/* Individual Image Positions */
.img-1 { top: 10%; left: 5%; width: 300px; animation-delay: 0s; rotate: -5deg; }
.img-2 { top: 75%; left: 10%; width: 250px; animation-delay: 1.5s; rotate: 8deg; }
.img-3 { top: 10%; right: 5%; width: 330px; animation-delay: 3s; rotate: 5deg; }
.img-4 { top: 75%; right: 10%; width: 270px; animation-delay: 4.5s; rotate: -8deg; }
.img-5 { top: 40%; left: 2%; width: 220px; animation-delay: 2s; rotate: -15deg; filter: blur(2px); }
.img-6 { top: 45%; right: 2%; width: 230px; animation-delay: 5s; rotate: 12deg; filter: blur(2px); }

/* Responsive adjustments */
@media (max-width: 992px) {
  .float-img {
    transform: scale(0.7);
    opacity: 0.5;
  }
}
@media (max-width: 768px) {
  .float-img {
    transform: scale(0.4);
    opacity: 0.3;
  }
}

/* Upload Image Button and Modal Styles */
.change-img-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 100;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.change-img-btn:hover {
  background: var(--primary-color);
  transform: scale(1.1);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.6);
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 30px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  position: relative;
  animation: fadeIn 0.3s ease-out forwards;
}

.close-modal {
  color: var(--text-secondary);
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s;
  position: absolute;
  top: 15px;
  right: 20px;
}

.close-modal:hover {
  color: white;
}

.modal-content h2 {
  margin-bottom: 20px;
  color: var(--primary-color);
  font-weight: 600;
}

.admin-input {
  width: 100%;
  padding: 12px 15px;
  margin: 10px 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: white;
  font-size: 1rem;
  transition: border-color 0.3s;
}

.admin-input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 5px;
}

.upload-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 15px;
}

.file-input-wrapper {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.file-input {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.file-input::file-selector-button {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 5px 10px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.2s;
}

.file-input::file-selector-button:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Custom scrollbar for upload grid */
.upload-grid::-webkit-scrollbar {
  width: 6px;
}
.upload-grid::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}
.upload-grid::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 10px;
}
