@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
  :root {
    /* Color Tokens - Professional Green Palette */
    --color-primary: 16 120 75;
    --color-primary-light: 34 140 95;
    --color-primary-dark: 12 90 60;
    --color-primary-subtle: 220 252 231;

    --color-secondary: 239 68 68;
    --color-accent: 59 130 246;

    --color-background: 249 250 251;
    --color-surface: 255 255 255;
    --color-surface-elevated: 255 255 255;

    --color-text-primary: 17 24 39;
    --color-text-secondary: 75 85 99;
    --color-text-tertiary: 156 163 175;
    --color-text-inverse: 255 255 255;

    --color-border: 229 231 235;
    --color-border-hover: 209 213 219;

    --color-success: 34 197 94;
    --color-warning: 251 146 60;
    --color-error: 239 68 68;
    --color-info: 59 130 246;

    --radius: 0.5rem;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  }
}

@layer utilities {
  /* FullCalendar Custom Styling */
  .fc {
    --fc-border-color: rgb(var(--color-border));
    --fc-button-bg-color: rgb(var(--color-primary));
    --fc-button-border-color: rgb(var(--color-primary-dark));
    --fc-button-hover-bg-color: rgb(var(--color-primary-light));
    --fc-button-hover-border-color: rgb(var(--color-primary-dark));
    --fc-button-active-bg-color: rgb(var(--color-primary-dark));
    --fc-button-active-border-color: rgb(var(--color-primary-dark));
    --fc-today-bg-color: rgb(var(--color-primary-subtle));
  }

  .fc .fc-button-primary {
    @apply bg-primary text-white border-primary-dark shadow-sm transition-all duration-200;
    font-weight: 500;
    padding: 0.5rem 1rem;
  }

  .fc .fc-button-primary:hover {
    @apply bg-primary-light border-primary-dark shadow-md;
    transform: translateY(-1px);
  }

  .fc .fc-button-primary:active,
  .fc .fc-button-primary.fc-button-active {
    @apply bg-primary-dark border-primary-dark;
    transform: translateY(0);
  }

  .fc .fc-button-primary:focus {
    @apply shadow-none ring-2 ring-primary-light ring-offset-2;
  }

  .fc .fc-button-primary:disabled {
    @apply opacity-50 cursor-not-allowed;
  }

  /* Calendar Header */
  .fc .fc-toolbar {
    @apply gap-3 mb-4;
  }

  .fc .fc-toolbar-title {
    @apply text-2xl font-semibold text-text-primary;
  }

  /* Calendar Grid */
  .fc .fc-col-header-cell {
    @apply bg-surface-elevated border-border;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 0.75rem 0.5rem;
  }

  .fc .fc-timegrid-slot {
    @apply border-border;
    height: 3.5rem;
  }

  .fc .fc-timegrid-slot-label {
    @apply text-text-secondary;
    font-size: 0.875rem;
    font-weight: 500;
  }
}

/* Hover effect on available slots */
.fc-timegrid-slot:not(.fc-timegrid-slot-lane) {
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.fc-timegrid-slot:not(.fc-timegrid-slot-lane):hover {
  background-color: rgb(var(--color-primary-subtle));
  cursor: pointer;
}

/* Event hover (not-allowed) */
.fc-event-main-frame:hover {
  cursor: not-allowed;
  opacity: 0.85;
  transition: opacity 0.2s ease;
}

/* Event Status Styles */
.fc-event-main-frame {
  padding: 4px 6px;
  border-radius: 6px;
  color: white !important;
  overflow: hidden;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.fc-event-main-frame:hover {
  box-shadow: var(--shadow-md);
}

.status-confirmado {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-color: #059669;
}

.status-em_andamento {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border-color: #2563eb;
}

.status-cancelado {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  border-color: #dc2626;
}

/* Unavailable block style */
.fc-event.evento-indisponivel .fc-event-main {
  background: repeating-linear-gradient(
    45deg,
    rgb(var(--color-border)),
    rgb(var(--color-border)) 10px,
    rgb(var(--color-background)) 10px,
    rgb(var(--color-background)) 20px
  );
  color: rgb(var(--color-text-tertiary));
  text-align: center;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 8px;
  border: 2px dashed rgb(var(--color-border-hover));
  letter-spacing: 0.05em;
}

/* Draggable Items Styling */
.fc-event-item {
  transition: all 0.2s ease;
  font-weight: 500;
}

.fc-event-item:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-md);
}

.fc-event-item:active {
  transform: scale(0.98);
}

/* Modal Animation */
#modalReserva {
  animation: fadeIn 0.2s ease;
}

#modalReserva > div {
  animation: slideUp 0.3s ease;
}

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

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

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

::-webkit-scrollbar-track {
  background: rgb(var(--color-background));
}

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

::-webkit-scrollbar-thumb:hover {
  background: rgb(var(--color-text-tertiary));
}

/* Loading Animation */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* Pulse Animation for Status Badges */
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
