/* Custom CSS for SKW SDEC TSIC Student Behavior Tracking System */
/* Theme: Bright Clean White with Soft Rainbow Accents (ธีมขาวสะอาดตา & สีรุ้ง) */
@import url('https://fonts.googleapis.com/css2?family=Kanit:ital,wght@0,200;0,300;0,400;0,500;0,600;0,700;0,800;1,300;1,400&display=swap');

:root {
  --skw-primary: #0284c7;
  --skw-gold: #f59e0b;
}

/* Base Typography: Kanit for text elements */
html, body, input, button, select, textarea, p, h1, h2, h3, h4, h5, h6, a, label, table, th, td, div, span:not([class*="fa-"]) {
  font-family: 'Kanit', sans-serif;
}

/* Ensure Font Awesome icons ALWAYS keep their dedicated font files */
.fa, .fas, .far, .fal, .fab, .fad, .fa-solid, .fa-regular, .fa-brands, [class*="fa-"], [class^="fa-"] {
  font-family: "Font Awesome 6 Free" !important;
  font-style: normal !important;
  font-variant: normal !important;
  text-rendering: auto !important;
  line-height: 1 !important;
}

.fa-brands, [class*="fa-brands"] {
  font-family: "Font Awesome 6 Brands" !important;
}

body {
  background-color: #fafbfc;
  color: #1e293b;
}

/* Custom scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #f8fafc;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ========================================== */
/* RAINBOW TEXT & GRADIENT ANIMATIONS         */
/* ========================================== */

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

.text-rainbow {
  background: linear-gradient(135deg, #ec4899, #8b5cf6, #3b82f6, #06b6d4, #10b981, #f59e0b, #ec4899);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: rainbow-pan 6s ease infinite;
}

.text-rainbow-soft {
  background: linear-gradient(135deg, #f43f5e, #a855f7, #2563eb, #0ea5e9, #059669, #d97706);
  background-size: 250% 250%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: rainbow-pan 8s ease infinite;
}

.text-rainbow-pastel {
  background: linear-gradient(135deg, #fb7185, #c084fc, #60a5fa, #38bdf8, #34d399, #fbbf24);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Rainbow Animated Bar */
.rainbow-gradient-bar {
  background: linear-gradient(90deg, #f43f5e, #a855f7, #3b82f6, #06b6d4, #10b981, #f59e0b, #f43f5e);
  background-size: 200% auto;
  animation: rainbow-pan 4s linear infinite;
}

/* Rainbow Line */
.rainbow-line {
  height: 4px;
  background: linear-gradient(90deg, #f43f5e, #ec4899, #a855f7, #3b82f6, #06b6d4, #10b981, #f59e0b);
  background-size: 200% auto;
  animation: rainbow-pan 5s linear infinite;
}

/* Soft Rainbow Glow for borders/headers */
.rainbow-glow {
  box-shadow: 0 10px 25px -5px rgba(168, 85, 247, 0.15), 0 6px 12px -5px rgba(59, 130, 246, 0.12);
}

.rainbow-glow-sm {
  box-shadow: 0 4px 12px -2px rgba(168, 85, 247, 0.1), 0 2px 6px -2px rgba(59, 130, 246, 0.08);
}

/* ======================================================== */
/* BIGGER & TOUCH-FRIENDLY NAVIGATION MENU BUTTONS          */
/* (ปุ่มเมนูขนาดใหญ่พิเศษ กดง่าย เห็นชัดเจน 100%)                 */
/* ======================================================== */

.nav-tab-btn {
  min-height: 52px;
  font-size: 0.95rem;
  font-weight: 800;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  background-color: #ffffff;
  color: #1e293b;
  border: 2px solid #cbd5e1;
  border-radius: 1.15rem;
  padding: 0.72rem 1.2rem;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  letter-spacing: -0.01em;
  user-select: none;
  -webkit-user-select: none;
}

.nav-tab-btn:hover {
  background-color: #f0f9ff;
  border-color: #0284c7;
  color: #0284c7;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -2px rgba(2, 132, 199, 0.22);
}

.nav-tab-btn:active {
  transform: scale(0.96);
}

.nav-tab-btn.active {
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 50%, #4f46e5 100%) !important;
  color: #ffffff !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 8px 24px -4px rgba(37, 99, 235, 0.45), 0 2px 6px -1px rgba(0, 0, 0, 0.12) !important;
  font-weight: 900 !important;
  transform: translateY(-2px);
}

.nav-tab-btn.active i {
  color: #ffffff !important;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.nav-tab-btn i {
  font-size: 1.25rem;
  transition: transform 0.2s ease;
}

.nav-tab-btn:hover i {
  transform: scale(1.15);
}

/* Mobile & Tablet Drawer Menu Buttons */
.mobile-nav-btn {
  min-height: 72px;
  touch-action: manipulation;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2.5px solid #e2e8f0;
  border-radius: 1.35rem;
  background-color: #ffffff;
  padding: 1rem 1.25rem;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.04);
  cursor: pointer;
}

.mobile-nav-btn:hover,
.mobile-nav-btn:active {
  border-color: #0284c7;
  background-color: #f0f9ff;
  transform: scale(0.985);
  box-shadow: 0 8px 22px -3px rgba(2, 132, 199, 0.2);
}

.mobile-nav-btn.active {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%) !important;
  border-color: #0284c7 !important;
  box-shadow: 0 8px 24px -3px rgba(2, 132, 199, 0.25) !important;
}

.mobile-nav-btn.active .mobile-icon-box {
  background: linear-gradient(135deg, #0284c7, #4f46e5) !important;
  color: #ffffff !important;
  box-shadow: 0 6px 16px rgba(2, 132, 199, 0.4);
}

.mobile-nav-btn.active span.block {
  color: #0369a1 !important;
}

/* ======================================================== */
/* CLEAN WHITE CARDS: ไม่เล่นสีพื้นหลังในกล่องเมื่อเลื่อนเมาส์     */
/* (Background stays pure white on hover to prevent eye strain) */
/* ======================================================== */

.rainbow-border-card,
.team-card {
  position: relative;
  background-color: #ffffff !important;
  border-radius: 1.5rem;
  border: 1.5px solid #e2e8f0;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.rainbow-border-card:hover,
.team-card:hover {
  background-color: #ffffff !important; /* พื้นหลังคงเป็นสีขาวสนิท ไม่เปลี่ยนสีเพื่อให้อ่านตัวหนังสือชัดเจน */
  border-color: #cbd5e1;
  transform: translateY(-2px);
  box-shadow: 0 12px 24px -6px rgba(0, 0, 0, 0.06);
}

/* ========================================== */
/* SPLASH SCREEN (BRIGHT SOFT RAINBOW MESH)   */
/* ========================================== */

.splash-white-rainbow-bg {
  background: 
    radial-gradient(circle at 15% 20%, rgba(254, 205, 211, 0.65) 0%, transparent 40%),
    radial-gradient(circle at 85% 25%, rgba(199, 210, 254, 0.65) 0%, transparent 45%),
    radial-gradient(circle at 30% 80%, rgba(187, 247, 208, 0.6) 0%, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(254, 240, 138, 0.6) 0%, transparent 45%),
    radial-gradient(circle at 50% 50%, rgba(224, 242, 254, 0.7) 0%, transparent 50%),
    #ffffff;
}

@keyframes float-gentle {
  0%, 100% { transform: translateY(0px) scale(1); }
  50% { transform: translateY(-8px) scale(1.02); }
}

.animate-float-gentle {
  animation: float-gentle 4s infinite ease-in-out;
}

/* Glassmorphism Light */
.glass-white {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(226, 232, 240, 0.8);
}

.glass-white-card {
  background: #ffffff;
  border: 1px solid rgba(226, 232, 240, 0.8);
}

/* ======================================================== */
/* TABLET & IPAD RESPONSIVE STYLING (768px - 1024px)        */
/* ======================================================== */

/* Smooth touch scrolling on iOS / iPadOS Safari & Android Tablets */
.overflow-x-auto,
.overflow-y-auto {
  -webkit-overflow-scrolling: touch;
}

/* Tablet & iPad specific layout adjustments */
@media (min-width: 768px) and (max-width: 1024px) {
  /* Prevent tap zoom delay and optimize touch interaction */
  button, a, input, select, label {
    touch-action: manipulation;
  }

  /* Tablet nav buttons: compact yet big and easy to tap */
  .nav-tab-btn {
    min-height: 48px !important;
    font-size: 0.88rem !important;
    padding: 0.6rem 0.95rem !important;
    gap: 0.45rem !important;
    border-radius: 0.95rem !important;
  }

  .nav-tab-btn i {
    font-size: 1.12rem !important;
  }

  /* Comfortable padding for tablet table rows */
  table th {
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
    font-size: 0.75rem !important;
  }

  table td {
    padding-top: 0.7rem !important;
    padding-bottom: 0.7rem !important;
  }

  /* Ensure dialogs never exceed iPad viewport height */
  .modal-dialog,
  #addStudentModal > div,
  #scoreAdjustmentModal > div,
  #studentHistoryModal > div {
    max-height: 88vh;
    -webkit-overflow-scrolling: touch;
  }

  /* Optimize chart canvas height */
  canvas {
    max-height: 100% !important;
  }
}

/* Touch-device scrollbar visibility hint for horizontal scroll tables */
@media (hover: none) and (pointer: coarse) {
  .overflow-x-auto::-webkit-scrollbar {
    height: 6px;
  }
  .overflow-x-auto::-webkit-scrollbar-track {
    background: #f1f5f9;
  }
  .overflow-x-auto::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 9999px;
  }
  * {
    -webkit-tap-highlight-color: transparent;
  }
}

/* Print Styling */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .no-print, header, footer, #splashScreen, #loginModals, .nav-tabs, .action-buttons, .alert-box {
    display: none !important;
  }
  #printableArea {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 10mm !important;
  }
  table {
    width: 100% !important;
    border-collapse: collapse !important;
  }
  th, td {
    border: 1px solid #333 !important;
    padding: 6px 10px !important;
    font-size: 11pt !important;
  }
}
