/* css/style.css (ไฟล์ใหม่) */
:root {
  --primary-color: #6366f1;
  /* Indigo/Blue */
  --secondary-color: #a855f7;
  /* Purple */
  --accent-color: #22d3ee;
  /* Cyan */
  --dark-bg: #020617;
  /* Very Dark Blue */
  --light-bg: #0f172a;
  /* Slate-900 */
  --warning-color: #f59e0b;
}

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

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, var(--dark-bg) 0%, var(--light-bg) 100%);
  color: #fff;
  overflow-x: hidden;
  min-height: 100vh;
}

/* === 1. PRELOADER === */
.preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--dark-bg);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
  opacity: 1;
  visibility: visible;
}

.preloader .spinner {
  width: 50px;
  height: 50px;
  border: 5px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* === 2. NAVBAR (Glassmorphism) === */
.navbar {
  background: rgba(2, 6, 23, 0.95);
  backdrop-filter: blur(15px);
  border-bottom: 1px solid rgba(99, 102, 241, 0.3);
  /* Blue border glow */
  padding: 1rem 0;
}

.navbar-brand {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary-color);
  text-shadow: 0 0 15px rgba(99, 102, 241, 0.5);
}

.navbar-toggler {
  border-color: rgba(255, 255, 255, 0.2);
}

.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(255, 255, 255, 0.8)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* === 3. OFF-CANVAS (เมนูสไลด์) === */
.offcanvas {
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(15px);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.offcanvas-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.offcanvas-title {
  color: #fff;
  font-weight: bold;
}

.offcanvas-body .navbar-nav .nav-link {
  font-size: 1.5rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
  padding: 1rem;
  text-align: center;
  border-radius: 10px;
  transition: all 0.3s ease;
}

.offcanvas-body .navbar-nav .nav-link i {
  width: 30px;
}

.offcanvas-body .navbar-nav .nav-link:hover {
  color: #fff;
  transform: scale(1.05);
  background: rgba(255, 255, 255, 0.05);
}

@keyframes slideInFromRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.offcanvas-body .nav-item {
  opacity: 0;
}

/* === 4. LANDING PAGE (Hero) === */
.animated-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
}

.floating-shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.3;
  transition: transform 0.2s ease-out;
}

.shape-1 {
  width: 400px;
  height: 400px;
  background: var(--primary-color);
  top: -100px;
  left: -100px;
}

.shape-2 {
  width: 300px;
  height: 300px;
  background: var(--accent-color);
  bottom: -150px;
  right: -100px;
}

.shape-3 {
  width: 350px;
  height: 350px;
  background: var(--secondary-color);
  top: 50%;
  right: 10%;
}

.hero-section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 2rem 0;
}

.hero-title {
  font-size: 3.5rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  color: #fff;
  text-shadow: 0 0 25px rgba(99, 102, 241, 0.7);
  opacity: 0;
}

.hero-subtitle {
  font-size: 1.3rem;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 2rem;
  animation: fadeInUp 1s ease-out 0.2s both;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* === 5. LOGIN/REGISTER CARD (หน้า Landing) === */
.login-card {
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 20px;
  padding: 3rem;
  box-shadow: 0 0 40px rgba(99, 102, 241, 0.15);
  animation: fadeInUp 1s ease-out 0.4s both;
  transition: transform 0.3s ease;
  display: none;
}

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

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

/* === 6. DASHBOARD CARD (หน้า Home) === */
.dashboard-card,
.content-card {
  background: rgba(10, 10, 10, 0.8);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-left: 3px solid var(--primary-color);
  border-radius: 20px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.credit-display {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary-color);
}

/* === 7. FORM & BUTTONS === */
.form-control {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  transition: all 0.3s ease;
}

.form-control:focus {
  background: rgba(15, 23, 42, 0.7);
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
  color: #fff;
}

.form-control::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.btn-primary,
.btn-warning {
  border: none;
  padding: 0.75rem 2rem;
  border-radius: 10px;
  font-weight: 600;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
}

.btn-warning {
  background: linear-gradient(
    135deg,
    var(--warning-color),
    var(--accent-color)
  );
}

.btn-primary:hover,
.btn-warning:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
}

/* === 8. FEATURES & FOOTER === */
.fade-in {
  opacity: 0;
  animation: fadeInUp 0.6s ease-out forwards;
}

.feature-icon {
  width: 70px;
  height: 70px;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin-bottom: 1rem;
  transition: transform 0.3s ease;
}

.feature-card:hover .feature-icon {
  transform: rotate(10deg) scale(1.1);
}

.feature-card {
  background: rgba(30, 41, 59, 0.4);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  padding: 2rem;
  transition: all 0.3s ease;
  height: 100%;
}

.feature-card:hover {
  transform: translateY(-10px);
  border-color: var(--primary-color);
  box-shadow: 0 15px 40px rgba(99, 102, 241, 0.2);
}

footer {
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 2rem 0;
  margin-top: 4rem;
}

/* === 9. SWEETALERT2 THEME === */
.swal2-popup {
  background: rgba(30, 41, 59, 0.8) !important;
  backdrop-filter: blur(20px) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 20px !important;
}

.swal2-title {
  color: #fff !important;
}

.swal2-html-container {
  color: rgba(255, 255, 255, 0.8) !important;
}

.swal2-confirm {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  ) !important;
  border: none !important;
  box-shadow: none !important;
}

.swal2-error-icon .x-mark {
  border-color: #ec4899 !important;
}

.swal2-warning-icon {
  border-color: var(--warning-color) !important;
  color: var(--warning-color) !important;
}

.swal2-info-icon {
  border-color: var(--primary-color) !important;
  color: var(--primary-color) !important;
}

.swal2-timer-progress-bar {
  background: var(--primary-color) !important;
}

/* === 10. RESPONSIVE === */
@media (max-width: 991px) {
  .hero-section {
    text-align: center;
  }

  .hero-section .d-flex {
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .hero-title {
    font-size: 2.5rem;
  }

  .hero-subtitle {
    font-size: 1.1rem;
  }

  .login-card {
    padding: 2rem;
  }
}
