/* CSS Variables - Modern indigo/violet theme */
:root {
  --background: 240 20% 97%;
  --foreground: 224 71% 4%;
  --card: 0 0% 100%;
  --card-foreground: 224 71% 4%;
  --primary: 239 84% 67%;
  --primary-foreground: 0 0% 100%;
  --secondary: 240 5% 96%;
  --secondary-foreground: 224 71% 4%;
  --muted: 240 5% 96%;
  --muted-foreground: 220 9% 46%;
  --accent: 240 100% 97%;
  --accent-foreground: 239 84% 67%;
  --destructive: 0 84% 60%;
  --destructive-foreground: 0 0% 98%;
  --border: 240 6% 90%;
  --input: 240 6% 90%;
  --ring: 239 84% 67%;
  --success: 142 76% 36%;
  --success-foreground: 0 0% 100%;
  --warning: 38 92% 50%;
  --warning-foreground: 0 0% 100%;
}

/* Base Styles */
body {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

hr {
  border-color: hsl(var(--border));
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Selection color */
::selection {
  background-color: hsl(var(--primary) / 0.2);
  color: hsl(var(--foreground));
}

/* Button animations */
.btn {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px hsl(var(--primary) / 0.25);
}
.btn:active {
  transform: translateY(0) scale(0.98);
}

/* Primary button style */
.btn-primary {
  background: linear-gradient(135deg, hsl(var(--primary)) 0%, hsl(250 84% 60%) 100%);
  color: hsl(var(--primary-foreground));
  font-weight: 500;
  border-radius: 0.75rem;
  padding: 0.625rem 1.25rem;
  box-shadow: 0 2px 8px hsl(var(--primary) / 0.3);
}
.btn-primary:hover {
  box-shadow: 0 6px 20px hsl(var(--primary) / 0.4);
}

/* Card hover effects */
.card-hover {
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid hsl(var(--border));
}
.card-hover:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 40px -12px hsl(var(--foreground) / 0.15);
  border-color: hsl(var(--primary) / 0.2);
}

/* Glass effect for cards */
.glass {
  background: hsl(var(--card) / 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Ripple effect */
.ripple {
  position: relative;
  overflow: hidden;
}
.ripple::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, hsl(var(--foreground)) 10%, transparent 10.01%);
  background-repeat: no-repeat;
  background-position: 50%;
  transform: scale(10, 10);
  opacity: 0;
  transition: transform 0.4s, opacity 0.4s;
}
.ripple:active::after {
  transform: scale(0, 0);
  opacity: 0.15;
  transition: 0s;
}

/* Sidebar styles */
.sidebar {
  transform: translateX(-100%);
  transition: transform 0.3s ease;
}
.sidebar.open {
  transform: translateX(0);
}
.sidebar-overlay {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.sidebar-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* Calendar styles */
#calendar,
#live-calendar {
  overflow: hidden;
  height: 750px;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
}
#calendar .fc-view-harness {
  touch-action: pan-y;
  will-change: transform, opacity;
}
#calendar .fc-daygrid,
#calendar .fc-daygrid-body,
#calendar .fc-scrollgrid,
#calendar .fc-scrollgrid-section,
#calendar .fc-scrollgrid-section-body,
#calendar table,
#calendar td,
#calendar .fc-daygrid-day,
#calendar .fc-daygrid-day-frame {
  touch-action: pan-y;
}
.fc-view-harness {
  transition: none;
}
.swipe-left {
  animation: slideOutLeft 0.2s cubic-bezier(0.4, 0, 0.6, 1) forwards;
}
.swipe-right {
  animation: slideOutRight 0.2s cubic-bezier(0.4, 0, 0.6, 1) forwards;
}
.slide-in-left {
  animation: slideInLeft 0.25s cubic-bezier(0.0, 0, 0.2, 1) forwards;
}
.slide-in-right {
  animation: slideInRight 0.25s cubic-bezier(0.0, 0, 0.2, 1) forwards;
}
@keyframes slideOutLeft {
  0% { transform: translateX(0) scale(1); opacity: 1; }
  100% { transform: translateX(-40%) scale(0.95); opacity: 0; }
}
@keyframes slideOutRight {
  0% { transform: translateX(0) scale(1); opacity: 1; }
  100% { transform: translateX(40%) scale(0.95); opacity: 0; }
}
@keyframes slideInLeft {
  0% { transform: translateX(40%) scale(0.95); opacity: 0; }
  100% { transform: translateX(0) scale(1); opacity: 1; }
}
@keyframes slideInRight {
  0% { transform: translateX(-40%) scale(0.95); opacity: 0; }
  100% { transform: translateX(0) scale(1); opacity: 1; }
}

/* Form input mobile fixes */
input[type="date"],
input[type="time"] {
  max-width: 100% !important;
  width: 100% !important;
  box-sizing: border-box !important;
  -webkit-appearance: none;
  appearance: none;
}

/* Modal form container */
.modal-content form {
  max-width: 100%;
}

.modal-content form > div {
  max-width: 100%;
}

/* FullCalendar theme overrides */
.fc {
  --fc-border-color: hsl(var(--border));
  --fc-today-bg-color: hsl(var(--primary) / 0.08);
  --fc-page-bg-color: transparent;
  --fc-neutral-bg-color: hsl(var(--muted));
  font-family: inherit;
  font-size: 0.9em;
}
.fc .fc-toolbar {
  margin-bottom: 1rem;
}
.fc .fc-toolbar-title {
  color: hsl(var(--foreground));
  font-size: 24px;
  font-weight: 600;
  padding: 0.5rem 6px;
  background: linear-gradient(135deg, hsl(var(--foreground)) 0%, hsl(var(--muted-foreground)) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.fc th {
  color: hsl(var(--muted-foreground));
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.75rem 0;
  border: none !important;
}
.fc .fc-scrollgrid {
  border: none !important;
}
.fc .fc-scrollgrid td {
  border-color: hsl(var(--border));
}
.fc .fc-daygrid-day {
  border-radius: 0.75rem;
}
.fc .fc-daygrid-day-number {
  color: hsl(var(--foreground));
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem;
}
.fc .fc-day-other .fc-daygrid-day-number {
  color: hsl(var(--muted-foreground));
  opacity: 0.5;
}
.fc .fc-daygrid-day.fc-day-today {
  background: linear-gradient(135deg, hsl(var(--primary) / 0.1) 0%, hsl(var(--primary) / 0.05) 100%) !important;
  border-radius: 0;
  position: relative;
}
.fc .fc-daygrid-day.fc-day-today::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid hsl(var(--primary) / 0.3);
  border-radius: 0;
  pointer-events: none;
}
.fc .fc-daygrid-day.fc-day-today .fc-daygrid-day-number {
  font-weight: 700;
  color: hsl(var(--primary));
}
.fc .fc-daygrid-body-unbalanced .fc-daygrid-day-events {
  min-height: 4.5em;
}
.fc .fc-daygrid-day-frame {
  min-height: 100%;
}
.fc .fc-daygrid-body-balanced .fc-daygrid-day-events {
  min-height: 4.5em;
}
.fc .fc-daygrid-day-events {
  min-height: 4.5em;
}
.fc .fc-day-other .fc-daygrid-day-events {
  opacity: 0.4;
}
.fc .fc-event {
  border: none;
  border-radius: 0.375rem;
  font-size: 0.7rem;
  padding: 0.125rem 0.5rem;
  font-weight: 600;
  transition: transform 0.15s ease;
}
.fc .fc-event:hover {
  transform: scale(1.02);
}
.fc .fc-daygrid-event {
  margin: 1px 3px;
}

/* Remove left/right margins on events */
.fc-direction-ltr .fc-daygrid-event.fc-event-end,
.fc-direction-rtl .fc-daygrid-event.fc-event-start {
  margin-right: 0px;
}
.fc-direction-ltr .fc-daygrid-event.fc-event-start,
.fc-direction-rtl .fc-daygrid-event.fc-event-end {
  margin-left: 0px;
}

.fc .fc-daygrid-more-link {
  color: hsl(var(--primary));
  font-size: 0.7rem;
  font-weight: 600;
}
.fc .fc-scrollgrid-section > td {
  border: none;
}
.fc .fc-col-header {
  border: none !important;
}
.fc .fc-col-header-cell {
  border: none !important;
}
.fc-theme-standard td, .fc-theme-standard th {
  border-color: hsl(var(--border));
}
.fc-theme-standard .fc-scrollgrid {
  border: none;
}
.fc .fc-toolbar.fc-header-toolbar {
  margin-bottom: -0.9em;
  margin-top: 0.4em;
}

/* Event dot style (list-item display) */
.fc .fc-daygrid-event.fc-daygrid-dot-event {
  background: transparent !important;
  border: none !important;
  padding: 0.0625rem 0.125rem;
}
.fc .fc-daygrid-event.fc-daygrid-dot-event:hover {
  background: hsl(var(--accent)) !important;
}
.fc .fc-daygrid-dot-event .fc-event-title {
  font-weight: 600;
  font-size: 0.675rem;
  color: hsl(var(--foreground));
}

/* Center shift titles in calendar events */
.fc .fc-daygrid-event {
  display: flex;
  justify-content: center;
  align-items: center;
}
.fc .fc-daygrid-dot-event {
  justify-content: center;
}
.fc .fc-event-main {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}
.fc .fc-event-main-frame {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}
.fc .fc-event-title-container {
  text-align: center;
  flex-grow: 1;
}
.fc .fc-daygrid-event-dot {
  border: 3.5px solid var(--fc-event-border-color, currentColor) !important;
  border-radius: 50%;
  width: 0;
  height: 0;
  margin: 0 2px 0 0;
}

/* Enhanced form inputs */
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  transition: all 0.2s ease;
}
input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 3px hsl(var(--primary) / 0.1);
}

/* Modal enhancements */
.modal-content {
  border-radius: 1.5rem;
  box-shadow: 0 25px 50px -12px hsl(var(--foreground) / 0.25);
}

/* Gradient text utility */
.gradient-text {
  background: linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(250 84% 60%) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Stat card with icon */
.stat-card {
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, hsl(var(--primary) / 0.05) 0%, transparent 70%);
  pointer-events: none;
}

/* Smooth page transitions */
main {
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Bottom nav active indicator animation */
.nav-btn span.absolute {
  animation: slideDown 0.2s ease;
}
@keyframes slideDown {
  from { transform: translateX(-50%) scaleX(0); }
  to { transform: translateX(-50%) scaleX(1); }
}

/* Improved scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: hsl(var(--border));
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: hsl(var(--muted-foreground) / 0.5);
}

/* Focus visible for accessibility */
:focus-visible {
  outline: 2px solid hsl(var(--primary));
  outline-offset: 2px;
}

/* Loading skeleton animation */
.skeleton {
  background: linear-gradient(90deg, hsl(var(--muted)) 25%, hsl(var(--accent)) 50%, hsl(var(--muted)) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
