/* ===========================================
   Modern UI Enhancements - Phase 6
   เพิ่ม UI สวยงามโดยไม่กระทบ CSS เดิม
   =========================================== */

/* ===== Animation Keyframes ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes glow {
  0%, 100% { box-shadow: 0 0 5px rgba(96, 165, 250, 0.3); }
  50% { box-shadow: 0 0 20px rgba(96, 165, 250, 0.7); }
}
@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ===== Glassmorphism Effects ===== */
.glass-card {
  background: rgba(255, 255, 255, 0.05) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 20px !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2) !important;
}

/* ===== Gradient Text ===== */
.gradient-text {
  background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 50%, #f472b6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}

/* ===== Loading Skeleton ===== */
.skeleton {
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0.05) 25%,
    rgba(255, 255, 255, 0.15) 50%,
    rgba(255, 255, 255, 0.05) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}
.skeleton-text {
  height: 16px;
  margin-bottom: 8px;
}
.skeleton-title {
  height: 28px;
  width: 60%;
  margin-bottom: 12px;
}

/* ===== Animated Entrance ===== */
.animate-in {
  animation: fadeInUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.animate-in-delay-1 { animation-delay: 0.1s; }
.animate-in-delay-2 { animation-delay: 0.2s; }
.animate-in-delay-3 { animation-delay: 0.3s; }
.animate-in-delay-4 { animation-delay: 0.4s; }

/* ===== Enhanced Card Hover ===== */
.card-hover {
  transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1) !important;
  cursor: pointer;
}
.card-hover:hover {
  transform: translateY(-4px) scale(1.01) !important;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3) !important;
}

/* ===== Pulsing Status Indicator ===== */
.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 8px;
  position: relative;
}
.status-dot::after {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  border-radius: 50%;
  animation: pulse 2s infinite;
}
.status-dot.available {
  background: #22c55e;
}
.status-dot.available::after {
  background: rgba(34, 197, 94, 0.4);
}
.status-dot.busy {
  background: #ef4444;
}
.status-dot.busy::after {
  background: rgba(239, 68, 68, 0.4);
}

/* ===== Smooth Scrolling ===== */
html {
  scroll-behavior: smooth;
}
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.5);
}
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #3b82f6, #8b5cf6);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #60a5fa, #a78bfa);
}

/* ===== Better Focus States ===== */
*:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 3px;
  border-radius: 6px;
  transition: outline-offset 0.2s;
}

/* ===== Text Selection ===== */
::selection {
  background: rgba(96, 165, 250, 0.4);
  color: #fff;
}

/* ===== Floating Action ===== */
.float {
  animation: float 3s ease-in-out infinite;
}

/* ===== Glowing Border ===== */
.glow-border {
  position: relative;
  border-radius: 16px;
  background: linear-gradient(135deg, #1e3a8a, #312e81);
  padding: 2px;
}
.glow-border::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 18px;
  background: linear-gradient(135deg, #60a5fa, #a78bfa, #f472b6, #60a5fa);
  background-size: 300% 300%;
  animation: gradientShift 6s ease infinite;
  z-index: -1;
}
@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ===== Skeleton Loaders for Calendar Days ===== */
.cal-day.loading {
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0.03) 25%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.03) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* ===== Smooth Tab Transitions ===== */
.section {
  animation: fadeIn 0.4s ease-out;
}

/* ===== Event Card Enhancements ===== */
.evt-item {
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1) !important;
}
.evt-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 100%;
  background: currentColor;
  opacity: 0.6;
  transition: width 0.3s;
}
.evt-item:hover {
  transform: translateX(4px) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.evt-item:hover::before {
  width: 6px;
  opacity: 1;
}

/* ===== Better Buttons (if any) ===== */
.btn-modern {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}
.btn-modern:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(59, 130, 246, 0.4);
}
.btn-modern:active {
  transform: translateY(0);
}

/* ===== Tooltip ===== */
[data-tooltip] {
  position: relative;
}
[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: rgba(15, 23, 42, 0.95);
  color: white;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  animation: fadeIn 0.2s;
  z-index: 1000;
  border: 1px solid rgba(96, 165, 250, 0.3);
}

/* ===== Accessibility ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ===== Print Styles ===== */
@media print {
  .sidebar, .status-banner, .footer { display: none !important; }
  .content { margin: 0 !important; padding: 0 !important; }
  body { background: white !important; color: black !important; }
}

/* ===== Mobile Responsive ===== */
@media (max-width: 768px) {
  /* Sidebar แสดงเสมอ (ไม่ซ่อน) — แต่ปรับขนาดให้เล็กลง */
  .sidebar {
    transform: translateX(0) !important;
    width: 60px !important;
  }
  .sidebar .sidebar-text {
    display: none;
  }
  .sidebar-toggle {
    display: none;
  }
  .sidebar-item {
    justify-content: center;
    padding: 12px 8px !important;
  }
  .content {
    margin-left: 60px !important;
    padding: 10px !important;
  }
  .cal-grid {
    grid-template-columns: repeat(7, minmax(40px, 1fr)) !important;
    font-size: 12px !important;
  }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
