/* Custom CSS for the PHP application */

/* CSS Variables for theming */
:root {
  --primary-color: #1e40af;
  --secondary-color: #3b82f6;
  --accent-color: #10b981;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --background-light: #f9fafb;
  --border-color: #e5e7eb;
}

/* Base styles */
body {
  font-family: "Raleway", "Kanit", sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
}

/* Font family declarations for all text elements */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: "Kanit", "Raleway", sans-serif;
  font-weight: 600;
}

p,
span,
div,
a,
button,
input,
textarea,
select,
label {
  font-family: "Raleway", "Kanit", sans-serif;
}

/* Thai text specific styling */
.font-thai,
[lang="th"] {
  font-family: "Kanit", sans-serif;
}

/* English text specific styling */
.font-english,
[lang="en"] {
  font-family: "Raleway", sans-serif;
}

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

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

.fade-in {
  animation: fadeIn 0.6s ease-out;
}

.slide-in {
  animation: slideIn 0.5s ease-out;
}

/* Carousel styles */
.carousel-container {
  position: relative;
  overflow: hidden;
  border-radius: 0.5rem;
}

.carousel-slide {
  transition: transform 0.5s ease-in-out;
}

.carousel-indicators {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.5rem;
}

.carousel-indicator {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.carousel-indicator.active {
  background-color: white;
}

/* Navigation styles */
.nav-link {
  position: relative;
  transition: color 0.3s ease;
}

.nav-link::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--primary-color);
  transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

/* Card hover effects */
.card-hover {
  transition: all 0.3s ease;
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Button styles */
.btn-primary {
  background-color: var(--primary-color);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
}

.btn-primary:hover {
  background-color: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(30, 64, 175, 0.3);
}

.btn-secondary {
  background-color: transparent;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
}

.btn-secondary:hover {
  background-color: var(--primary-color);
  color: white;
}

/* Form styles */
.form-input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

/* Statistics counter animation */
.stat-number {
  font-size: 2.5rem;
  font-weight: bold;
  color: var(--primary-color);
}

/* Loading spinner */
.spinner {
  border: 3px solid #f3f3f3;
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

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

/* Fade-in animation for mobile menu */
.fade-in {
  animation: fadeIn 0.3s ease-in-out;
}

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

/* Enhanced Responsive Design */
/* Mobile-first approach with progressive enhancement */

/* Base mobile styles (320px+) */
.container {
  padding-left: 1rem;
  padding-right: 1rem;
}

.grid-responsive {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

/* Touch-friendly interactions */
.touch-target {
  min-height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-touch {
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
  line-height: 1.5;
}

/* Improved card layouts for mobile */
.card-mobile {
  margin-bottom: 1rem;
  border-radius: 0.75rem;
  overflow: hidden;
}

.card-mobile img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

/* Enhanced typography scaling */
.text-responsive-sm {
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.text-responsive-base {
  font-size: 1rem;
  line-height: 1.5rem;
}

.text-responsive-lg {
  font-size: 1.125rem;
  line-height: 1.75rem;
}

.text-responsive-xl {
  font-size: 1.25rem;
  line-height: 1.75rem;
}

.text-responsive-2xl {
  font-size: 1.5rem;
  line-height: 2rem;
}

.text-responsive-3xl {
  font-size: 1.875rem;
  line-height: 2.25rem;
}

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) {
  .container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  .grid-responsive {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }

  .text-responsive-lg {
    font-size: 1.25rem;
    line-height: 1.75rem;
  }

  .text-responsive-xl {
    font-size: 1.5rem;
    line-height: 2rem;
  }

  .text-responsive-2xl {
    font-size: 1.875rem;
    line-height: 2.25rem;
  }

  .text-responsive-3xl {
    font-size: 2.25rem;
    line-height: 2.5rem;
  }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
  .mobile-menu {
    display: block;
  }

  .desktop-menu {
    display: none;
  }

  .container {
    padding-left: 2rem;
    padding-right: 2rem;
  }

  .grid-responsive {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
  }

  .card-mobile {
    margin-bottom: 1.5rem;
  }

  .card-mobile img {
    height: 240px;
  }

  .stat-number {
    font-size: 2rem;
  }

  .text-responsive-2xl {
    font-size: 2.25rem;
    line-height: 2.5rem;
  }

  .text-responsive-3xl {
    font-size: 3rem;
    line-height: 1;
  }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
  .mobile-menu {
    display: none;
  }

  .desktop-menu {
    display: block;
  }

  .grid-responsive {
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
  }

  .card-mobile img {
    height: 280px;
  }

  .stat-number {
    font-size: 2.5rem;
  }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
  .container {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
  }

  .grid-responsive {
    grid-template-columns: repeat(4, 1fr);
    gap: 2.5rem;
  }

  .text-responsive-3xl {
    font-size: 3.75rem;
    line-height: 1;
  }
}

/* Ultra wide screens (1400px and up) */
@media (min-width: 1400px) {
  .container {
    max-width: 1320px;
  }

  .grid-responsive {
    gap: 3rem;
  }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .high-dpi-image {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* Landscape orientation adjustments */
@media (orientation: landscape) and (max-height: 500px) {
  .mobile-landscape-adjust {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }

  .hero-mobile-landscape {
    min-height: 60vh;
  }
}

/* Touch interactions and responsive enhancements */
.touch-active {
  transform: scale(0.98);
  opacity: 0.8;
  transition: all 0.1s ease;
}

.lazy {
  opacity: 0;
  transition: opacity 0.3s;
}

.lazy.loaded {
  opacity: 1;
}

/* Low power mode optimizations */
.low-power-mode * {
  animation: none !important;
  transition: none !important;
}

.low-power-mode .carousel {
  scroll-behavior: auto;
}

/* Dynamic viewport height */
.full-height {
  height: 100vh;
  height: calc(var(--vh, 1vh) * 100);
}

/* Enhanced responsive grid system */
.responsive-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

@media (min-width: 640px) {
  .responsive-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
  }
}

@media (min-width: 1024px) {
  .responsive-grid {
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
  }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
  .reduce-motion *,
  .reduce-motion *::before,
  .reduce-motion *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Card hover effects with reduced motion support */
.card-hover:hover {
  transform: none;
}

/* Detail page specific styles */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.prose {
  max-width: none;
}

.prose p {
  margin-bottom: 1rem;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.prose ul,
.prose ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.prose li {
  margin-bottom: 0.25rem;
}

/* Accessibility improvements */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--primary-color);
  color: white;
  padding: 8px;
  text-decoration: none;
  border-radius: 0 0 4px 4px;
  z-index: 1000;
}

.skip-link:focus {
  top: 0;
}

/* Print styles */
@media print {
  .no-print {
    display: none !important;
  }

  body {
    font-size: 12pt;
    line-height: 1.4;
  }

  .container {
    max-width: none;
    margin: 0;
    padding: 0;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --background-light: #1f2937;
    --border-color: #374151;
  }
}

/* Placeholder text styling */
input::placeholder,
textarea::placeholder {
  color: #6b7280 !important;
  opacity: 1 !important;
}

input::-webkit-input-placeholder,
textarea::-webkit-input-placeholder {
  color: #6b7280 !important;
}

input::-moz-placeholder,
textarea::-moz-placeholder {
  color: #6b7280 !important;
  opacity: 1 !important;
}

input:-ms-input-placeholder,
textarea:-ms-input-placeholder {
  color: #6b7280 !important;
}

/* Additional specificity for admin inputs */
.w-full.px-3.py-2::placeholder {
  color: #6b7280 !important;
  opacity: 1 !important;
}

/* Fix input text color */
input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
textarea,
select {
  color: #1f2937 !important;
}

/* Specific fix for admin form inputs */
.w-full.px-3.py-2 {
  color: #1f2937 !important;
}

/* Faculty image full resolution display */
.faculty-image-full {
  max-width: 54% !important;
  max-height: 48.6vh !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  display: block !important;
  margin: 0 auto !important;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* Override existing faculty image constraints for full display */
img[src*="faculty"].faculty-image-full {
  position: relative;
  z-index: 10;
  background: white;
  padding: 10px;
}

/* Faculty name links styling */
.faculty-name-link {
  text-decoration: none;
  position: relative;
  display: inline-block;
  transition: all 0.3s ease;
}

.faculty-name-link:hover {
  transform: translateY(-1px);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.faculty-name-link::after {
  content: "";
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -2px;
  left: 50%;
  background: linear-gradient(90deg, #3b82f6, #1d4ed8);
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

.faculty-name-link:hover::after {
  width: 100%;
}

.faculty-name-link:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #1d4ed8;
}
