/* 自定义滚动条样式 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

/* 深色模式下的滚动条 */
.dark ::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.dark ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* 日历单元格样式 */
.calendar-day {
  aspect-ratio: 1;
  min-height: 140px; /* 增加单元格最小高度，确保内容显示完整 */
  position: relative;
  transition: all 0.3s ease;
}

/* 日历过渡动画 */
.calendar-transition {
  transition: opacity 0.3s ease;
  opacity: 0.7;
}

/* 在移动设备上调整日历单元格高度 */
@media (max-width: 768px) {
  .calendar-day {
    min-height: 120px;
  }
}

@media (max-width: 480px) {
  .calendar-day {
    min-height: 100px;
  }
}

/* 事件项样式 */
.event-item {
  cursor: pointer;
  transition: all 0.2s ease;
  overflow: hidden;
  position: relative;
}

.event-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background-color: var(--event-color, #3b82f6);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.2s ease;
}

.event-item:hover {
  transform: translateY(-1px);
}

.event-item:hover::before {
  transform: scaleY(1);
}

/* 模态框动画 */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes scaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes scaleOut {
  from { transform: scale(1); opacity: 1; }
  to { transform: scale(0.95); opacity: 0; }
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* 模态框显示状态 */
.modal-visible {
  opacity: 1 !important;
  pointer-events: auto !important;
}

.modal-visible #modalContent {
  transform: scale(1) !important;
  opacity: 1 !important;
  animation: slideUp 0.3s ease forwards;
}

/* 数字徽章动画 */
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.badge-pulse {
  animation: pulse 0.6s ease-in-out;
}

/* 主题切换动画 */
.theme-transition {
  transition: background-color 0.5s ease, color 0.5s ease;
}

/* 统计卡片悬停效果 */
.stat-card {
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 20px rgba(0, 0, 0, 0.12);
}

/* 响应式调整 */
@media (max-width: 768px) {
  /* 缩小日历标题 */
  h1 {
    font-size: 1.5rem !important;
  }
  
  h2 {
    font-size: 1.25rem !important;
  }
  
  /* 调整统计卡片布局 */
  .grid-cols-3 {
    grid-template-columns: 1fr !important;
  }
  
  /* 调整按钮大小 */
  button {padding: 0.5rem 1rem !important;
  }
  
  /* 调整日历单元格内边距 */
  .calendar-day {
    padding: 0.75rem !important; /* 增加内边距以便更好地显示内容 */
  }
  
  /* 优化移动端事件显示 */
  .calendar-day .pt-8 {
    padding-top: 2rem !important;
  }
  
  /* 调整事件项样式 */
  .event-item {
    padding: 0.75rem !important;
  }
  
  /* 调整字体大小 */
  .event-item .text-xs {
    font-size: 0.75rem !important;
  }
}

@media (max-width: 480px) {
  /* 进一步缩小字体 */
  h1 {
    font-size: 1.25rem !important;
  }
  
  h2 {
    font-size: 1.1rem !important;
  }
  
  /* 调整导航按钮大小 */
  .flex.items-center.space-x-2 button {
    padding: 0.75rem !important;
  }
  
  /* 模态框适应小屏幕 */
  #modalContent {
    margin: 1rem !important;
    width: calc(100% - 2rem) !important;
  }
  
  /* 日历标题栏调整 */
  header .container {
    padding: 0.75rem !important;
  }
  
  /* 日历内容区域调整 */
  main .container {
    padding: 0.75rem !important;
  }
}

/* 平滑滚动 */
html {
  scroll-behavior: smooth;
}

/* 页面加载动画 */
@keyframes fadeInPage {
  from { opacity: 0; }
  to { opacity: 1; }
}

body {
  animation: fadeInPage 0.5s ease-in-out;
}

body.loaded {
  opacity: 1;
}

/* 加载指示器 */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(59, 130, 246, 0.3);
  border-radius: 50%;
  border-top-color: #3b82f6;
  animation: spin 1s ease-in-out infinite;
}

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

/* 按钮交互动画 */
button {
  transition: all 0.2s ease;
}

button:active {
  transform: scale(0.98);
}

/* 图标动画 */
.fa-calendar-check-o {
  transition: transform 0.3s ease;
}

.group:hover .fa-calendar-check-o {
  transform: rotate(5deg) scale(1.1);
}

/* 滚动条美化 */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(156, 163, 175, 0.5);
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(156, 163, 175, 0.8);
}

.dark ::-webkit-scrollbar-thumb {
  background: rgba(75, 85, 99, 0.5);
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: rgba(75, 85, 99, 0.8);
}

/* 日历当前日期高亮增强 */
.calendar-day-today {
  position: relative;
  overflow: hidden;
}

.calendar-day-today::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--tw-gradient-stops));
  opacity: 0.6;
}

/* 新增的动画效果 */
@keyframes bounce {
  0%, 100% { transform: translateY(-25%); animation-timing-function: cubic-bezier(0.8, 0, 1, 1); }
  50% { transform: translateY(0); animation-timing-function: cubic-bezier(0, 0, 0.2, 1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.animate-bounce {
  animation: bounce 1s infinite;
}

.animate-shake {
  animation: shake 0.5s ease-in-out;
}

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

/* 颜色渐变效果 */
.gradient-bg {
  background: linear-gradient(120deg, var(--tw-gradient-stops));
}

/* 卡片悬浮效果增强 */
.shadow-glow {
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.15);
}

.shadow-glow-success {
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.15);
}

.shadow-glow-warning {
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.15);
}

/* 输入框聚焦效果增强 */
.input-field:focus {
  border-color: var(--event-color, #3b82f6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 按钮悬停颜色变化 */
.btn-primary:hover {
  filter: brightness(1.1);
}

/* 选项框样式增强 */
select.input-field {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  padding-right: 2.5rem;
}

/* 暗黑模式优化 */
.dark .calendar-day {
  border-color: rgba(255, 255, 255, 0.1);
}

/* 增强通知动画 */
#notificationContainer div {
  backdrop-filter: blur(12px);
}

/* 渐入渐出效果 */
.fade-in {
  animation: fadeIn 0.5s ease-in-out;
}

.fade-out {
  animation: fadeOut 0.5s ease-in-out;
}

/* 图标颜色增强 */
.fa {
  transition: color 0.2s ease, transform 0.2s ease;
}

button:hover .fa {
  transform: scale(1.1);
}

/* 日期数字增强 */
.calendar-day .absolute {
  z-index: 1;
}

/* 事件项内部元素动画 */
.event-item div {
  transition: opacity 0.2s ease;
}

.event-item:hover div {
  opacity: 0.9;
}

/* 模态框表单元素动画 */
#eventForm > div {
  transition: transform 0.2s ease, opacity 0.2s ease;
}

#eventForm > div:focus-within {
  transform: translateY(-2px);
}

/* 修复日期显示问题 */
.calendar-day-today .absolute {
  background-color: #3b82f6;
  color: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

/* 移动端优化 */
@media (max-width: 768px) {
  .calendar-day-today .absolute {
    width: 24px !important;
    height: 24px !important;
    font-size: 0.75rem !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  }
}