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

:root {
  /* Colors */
  --primary-rgb: 30, 41, 59;        /* #1e293b */
  --accent-rgb: 14, 165, 233;       /* #0ea5e9 */
  --purple-rgb: 99, 102, 241;       /* #6366f1 */
  --gold-rgb: 234, 179, 8;          /* #eab308 */
  --emerald-rgb: 16, 185, 129;      /* #10b981 */
  
  --primary: rgb(var(--primary-rgb));
  --accent: rgb(var(--accent-rgb));
  --accent-purple: rgb(var(--purple-rgb));
  --accent-gold: rgb(var(--gold-rgb));
  --accent-emerald: rgb(var(--emerald-rgb));
  
  --bg: #f8fafc;
  --text-main: #0f172a;
  --text-muted: #64748b;
  
  --card-bg: rgba(255, 255, 255, 0.75);
  --card-border: rgba(226, 232, 240, 0.8);
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 35px -5px rgba(0, 0, 0, 0.08), 0 10px 15px -8px rgba(0, 0, 0, 0.08);
  
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  
  --font-en: 'Outfit', sans-serif;
  --font-th: 'Sarabun', sans-serif;
  
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-en), var(--font-th);
  background: var(--bg);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
  background-image: 
    radial-gradient(at 0% 0%, rgba(14, 165, 233, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(99, 102, 241, 0.08) 0px, transparent 50%),
    radial-gradient(at 50% 100%, rgba(234, 179, 8, 0.05) 0px, transparent 50%);
  background-attachment: fixed;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-en), var(--font-th);
  font-weight: 700;
  line-height: 1.25;
}

/* Utilities */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.gradient-text {
  background: linear-gradient(135deg, var(--primary) 30%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.gradient-bg {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-purple) 100%);
}

.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.glass-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(14, 165, 233, 0.2);
}

/* Navigation / Header */
header {
  padding: 20px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(248, 250, 252, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--card-border);
}

.nav-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-main);
}

.logo span {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 0.9rem;
  font-weight: 600;
}

.nav-links {
  display: flex;
  gap: 24px;
  list-style: none;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  transition: var(--transition);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
}

.nav-links a:hover, .nav-links a.active {
  color: var(--accent);
  background: rgba(14, 165, 233, 0.05);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-purple) 100%);
  color: white;
  box-shadow: 0 4px 15px -3px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -3px rgba(99, 102, 241, 0.6);
}

.btn-secondary {
  background: white;
  color: var(--text-main);
  border: 1px solid var(--card-border);
}

.btn-secondary:hover {
  background: #f1f5f9;
  transform: translateY(-2px);
}

/* Hero Section */
.hero {
  padding: 80px 0 60px 0;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 60px;
  align-items: center;
}

.hero-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.badge-tag {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 100px;
  background: rgba(14, 165, 233, 0.1);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.85rem;
}

.hero-title {
  font-size: 3.5rem;
  font-weight: 800;
  letter-spacing: -1px;
}

.hero-title span {
  display: block;
}

.hero-bio {
  font-size: 1.15rem;
  color: var(--text-muted);
}

.hero-actions {
  display: flex;
  gap: 16px;
  margin-top: 10px;
}

.hero-visual {
  display: flex;
  justify-content: center;
  position: relative;
}

.avatar-wrapper {
  position: relative;
  width: 280px;
  height: 280px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 4px solid white;
}

.avatar-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.blob-decoration {
  position: absolute;
  width: 110%;
  height: 110%;
  top: -5%;
  left: -5%;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.2) 0%, rgba(99, 102, 241, 0.2) 100%);
  border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
  filter: blur(10px);
  z-index: -1;
  animation: morphing 12s infinite alternate ease-in-out;
}

@keyframes morphing {
  0% { border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%; }
  100% { border-radius: 70% 30% 50% 50% / 30% 60% 40% 70%; }
}

/* Quick Stats */
.stats {
  padding: 40px 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px;
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: white;
}

.stat-info h3 {
  font-size: 1.8rem;
  font-weight: 800;
}

.stat-info p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Sections */
section {
  padding: 80px 0;
}

.section-header {
  text-align: center;
  max-width: 600px;
  margin: 0 auto 50px auto;
}

.section-header h2 {
  font-size: 2.2rem;
  margin-bottom: 12px;
}

.section-header p {
  color: var(--text-muted);
}

/* Achievements Grid */
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 30px;
}

.ach-card {
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.ach-image {
  height: 200px;
  position: relative;
  overflow: hidden;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ach-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition);
}

.ach-card:hover .ach-image img {
  transform: scale(1.05);
}

.ach-category {
  position: absolute;
  top: 15px;
  left: 15px;
  padding: 6px 12px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.category-math {
  background: var(--accent-purple);
}

.category-english {
  background: var(--accent);
}

.category-sports {
  background: var(--accent-emerald);
}

.category-music {
  background: #f97316;
}

.category-other {
  background: var(--text-muted);
}

.ach-content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  gap: 12px;
}

.ach-date {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
}

.ach-title {
  font-size: 1.25rem;
  color: var(--text-main);
  line-height: 1.35;
}

.ach-award {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-gold);
  background: rgba(234, 179, 8, 0.1);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  align-self: flex-start;
}

.ach-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Gallery Section */
.gallery-filters {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 40px;
}

.filter-btn {
  padding: 8px 20px;
  border-radius: 100px;
  border: 1px solid var(--card-border);
  background: white;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: var(--transition);
}

.filter-btn:hover, .filter-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  box-shadow: 0 4px 10px -3px rgba(14, 165, 233, 0.4);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.gallery-item {
  height: 250px;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  cursor: pointer;
  border: 1px solid var(--card-border);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition);
}

.gallery-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(15, 23, 42, 0.8) 0%, rgba(15, 23, 42, 0.2) 60%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 20px;
  opacity: 0;
  transition: var(--transition);
}

.gallery-item:hover img {
  transform: scale(1.05);
}

.gallery-item:hover .gallery-overlay {
  opacity: 1;
}

.gallery-info h4 {
  color: white;
  font-size: 1.1rem;
}

.gallery-info p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.8rem;
  margin-top: 4px;
}

/* Contact Footer Section */
footer {
  background: #0f172a;
  color: white;
  padding: 60px 0 20px 0;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
  padding-bottom: 40px;
  border-bottom: 1px solid #1e293b;
}

.footer-info h2 {
  font-size: 2rem;
  margin-bottom: 10px;
}

.footer-info p {
  color: #94a3b8;
  margin-bottom: 20px;
}

.footer-socials {
  display: flex;
  gap: 16px;
}

.social-link {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  text-decoration: none;
  font-size: 1.2rem;
  transition: var(--transition);
}

.social-link:hover {
  background: var(--accent);
  transform: translateY(-2px);
}

.footer-contacts {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: flex-end;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
  color: #cbd5e1;
}

.contact-item span {
  font-size: 1.1rem;
}

.copyright {
  text-align: center;
  padding-top: 20px;
  font-size: 0.85rem;
  color: #64748b;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.copyright a {
  color: #94a3b8;
  text-decoration: none;
  transition: var(--transition);
}

.copyright a:hover {
  color: var(--accent);
}

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 20px;
}

.modal.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: white;
  max-width: 600px;
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95);
  transition: transform 0.3s ease;
  position: relative;
}

.modal.active .modal-content {
  transform: scale(1);
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.1);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.2rem;
  transition: var(--transition);
  color: var(--text-main);
  z-index: 10;
}

.modal-close:hover {
  background: rgba(15, 23, 42, 0.2);
}

.modal-img {
  width: 100%;
  height: 300px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-info {
  padding: 30px;
}

.modal-info h3 {
  font-size: 1.5rem;
  margin-bottom: 10px;
}

.modal-info p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ==========================================================================
   ADMIN PAGE STYLES
   ========================================================================== */
.admin-header {
  background: white;
  border-bottom: 1px solid var(--card-border);
  padding: 24px 0;
  margin-bottom: 40px;
  box-shadow: var(--shadow);
}

.admin-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-title-wrap {
  display: flex;
  align-items: center;
  gap: 15px;
}

.admin-title-wrap h1 {
  font-size: 1.8rem;
}

.admin-nav-btn {
  font-size: 0.9rem;
  padding: 8px 16px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 40px;
  margin-bottom: 80px;
  align-items: start;
}

.admin-sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 100px;
}

.admin-tab-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: var(--transition);
  width: 100%;
}

.admin-tab-btn:hover {
  background: rgba(14, 165, 233, 0.05);
  color: var(--accent);
}

.admin-tab-btn.active {
  background: white;
  border-color: var(--card-border);
  color: var(--accent);
  box-shadow: var(--shadow);
}

.admin-panel {
  display: none;
  animation: fadeIn 0.4s ease;
}

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

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

.panel-title {
  font-size: 1.5rem;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-group.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 8px;
  color: var(--text-main);
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: white;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text-main);
  transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

/* Image Upload Widget */
.image-upload-wrapper {
  display: flex;
  gap: 20px;
  align-items: center;
  border: 1px dashed var(--card-border);
  padding: 15px;
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.image-preview {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  background: #f1f5f9;
  border: 1px solid var(--card-border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-input-btn {
  position: relative;
  overflow: hidden;
  background: var(--accent);
  color: white;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  display: inline-block;
  font-size: 0.85rem;
  transition: var(--transition);
}

.file-input-btn:hover {
  background: rgba(14, 165, 233, 0.85);
}

.file-input-btn input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.upload-info {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Dynamic list manager */
.dynamic-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.dynamic-item {
  border-left: 4px solid var(--accent);
  padding: 20px;
  position: relative;
}

.dynamic-item.category-Math {
  border-left-color: var(--accent-purple);
}

.dynamic-item.category-English {
  border-left-color: var(--accent);
}

.remove-item-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  transition: var(--transition);
}

.remove-item-btn:hover {
  background: #ef4444;
  color: white;
}

.add-item-btn {
  align-self: flex-start;
}

/* Action Bar */
.action-bar {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--card-border);
}

/* Responsive */
@media (max-width: 968px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 40px;
    text-align: center;
  }
  
  .badge-tag {
    align-self: center;
  }
  
  .hero-title {
    font-size: 2.8rem;
  }
  
  .hero-actions {
    justify-content: center;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .admin-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }
  
  .admin-sidebar {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 10px;
  }
  
  .admin-tab-btn {
    white-space: nowrap;
    padding: 10px 16px;
  }
  
  .footer-grid {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 30px;
  }
  
  .footer-contacts {
    align-items: center;
  }
  
  .copyright {
    flex-direction: column;
    gap: 10px;
  }
}

@media (max-width: 576px) {
  .nav-links {
    display: none; /* simple hidden on mobile, fallback */
  }
  
  .hero-title {
    font-size: 2.2rem;
  }
  
  .form-group.grid-2 {
    grid-template-columns: 1fr;
    gap: 0;
  }
  
  .action-bar {
    flex-direction: column;
  }
  
  .action-bar .btn {
    width: 100%;
  }
}
