/**
 * Custom CSS for IntermitTracker
 * Modern, clean design with grid texture background
 */

/* Global background - nettement plus foncé que les cartes (nuances de gris) */
body {
  background-color: #d4d4d8; /* gris-300 */
}

/* Texture optionnelle très discrète (gris) */
.bg-grid-texture {
  background-color: transparent;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.12) 1px, transparent 1px);
  background-size: 24px 24px;
  position: relative;
}

.bg-grid-texture::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 2px 2px, rgba(255, 255, 255, 0.22) 1px, transparent 0);
  background-size: 48px 48px;
  pointer-events: none;
}

/* Cartes principales plus foncées que le fond (nuances de gris) */
.sonic-card {
  border-radius: 20px;
  background-color: #ffffff; /* blanc pur */
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(17, 24, 39, 0.06); /* léger contour gris */
}

.gradient-hero {
  background: linear-gradient(135deg, #8E2DE2 0%, #4A00E0 100%);
  color: #ffffff;
  border-radius: 20px;
  box-shadow: 0 22px 55px rgba(15, 23, 42, 0.25);
}

.gradient-hero h1,
.gradient-hero h2,
.gradient-hero h3,
.gradient-hero p {
  color: #ffffff;
}

/* Smooth transitions */
* {
  transition-property: color, background-color, border-color, transform, box-shadow;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 200ms;
}

/* Card hover effects */
.card-hover {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Logo animation */
.logo-icon {
  transition: transform 0.3s ease;
}

.logo-icon:hover {
  transform: scale(1.05);
}

/* Button styles - accent (purple) aligned with sidebar/branding */
.btn-primary {
  background: linear-gradient(135deg, #8E2DE2 0%, #4A00E0 100%);
  box-shadow: 0 4px 6px -1px rgba(142, 45, 226, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #7B22C7 0%, #3d00b8 100%);
  box-shadow: 0 6px 8px -1px rgba(142, 45, 226, 0.4);
  transform: translateY(-1px);
}

/* Legacy teal primary (if needed elsewhere) */
.btn-primary-teal {
  background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%);
  box-shadow: 0 4px 6px -1px rgba(20, 184, 166, 0.3);
}

.btn-primary-teal:hover {
  background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
  box-shadow: 0 6px 8px -1px rgba(20, 184, 166, 0.4);
  transform: translateY(-1px);
}

/* Glass morphism effect for cards */
.glass-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.8);
}

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

/* Focus styles - accent aligned with brand */
input:focus,
textarea:focus,
select:focus,
button:focus {
  outline: none;
  ring-width: 2px;
  ring-color: #8E2DE2;
}

/* Custom Calendar Styles */
.calendar-week-view {
  display: flex;
  flex-direction: column;
  height: 600px; /* 12 hours * 50px (8h-20h) */
  overflow: hidden;
}

.calendar-week-header {
  display: flex;
  border-bottom: 2px solid #e5e7eb;
  background-color: #f9fafb;
  position: relative;
  /* Account for scrollbar width to keep alignment */
  /* padding-right will be set dynamically by JavaScript to match scrollbar width */
  box-sizing: border-box;
}

.calendar-time-column {
  width: 60px;
  flex-shrink: 0;
  border-right: 1px solid #e5e7eb;
}

.calendar-days-container {
  flex: 1;
  display: flex;
  min-width: 0; /* Prevent flex overflow */
}

.calendar-day-header {
  flex: 1;
  padding: 12px 8px;
  text-align: center;
  border-right: 1px solid #e5e7eb;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
}

.calendar-day-header.today {
  background-color: #ede9fe;
  color: #6d28d9;
}

.calendar-day-header .day-name {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  color: #6b7280;
  margin-bottom: 4px;
}

.calendar-day-header .day-number {
  display: block;
  font-size: 16px;
  font-weight: 700;
}

.calendar-week-body {
  display: flex;
  flex: 1;
  overflow-y: scroll; /* Always show scrollbar to prevent layout shift */
  overflow-x: hidden;
  /* Ensure header and body columns align even with scrollbar */
  scrollbar-gutter: stable;
}

/* Fix alignment: ensure header and body have same width calculation */
.calendar-week-view {
  display: flex;
  flex-direction: column;
  position: relative;
}

.calendar-week-header .calendar-days-container,
.calendar-week-body .calendar-days-container {
  width: 100%;
  box-sizing: border-box;
}

.calendar-time-slots {
  width: 60px;
  padding: 0 8px;
}

.calendar-time-slot {
  height: 50px;
  border-top: 1px solid #f3f4f6;
  font-size: 11px;
  color: #6b7280;
  padding-top: 4px;
  text-align: right;
  box-sizing: border-box;
  margin: 0;
}

.calendar-day-columns {
  flex: 1;
  display: flex;
  position: relative;
}

.calendar-day-column {
  flex: 1;
  border-right: 1px solid #e5e7eb;
  position: relative;
  min-height: 600px; /* 12 hours * 50px (8h-20h) */
  height: 600px; /* Force exact height to match time slots */
  overflow: hidden;
  box-sizing: border-box;
}

.calendar-day-slot {
  height: 50px;
  border-top: 1px solid #f3f4f6;
  position: relative;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  /* Ensure exact 50px height including border */
  min-height: 50px;
  max-height: 50px;
}

.calendar-event {
  position: absolute;
  left: 2px;
  right: 2px;
  background: linear-gradient(135deg, #8E2DE2 0%, #4A00E0 100%);
  color: white;
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  overflow: hidden;
  word-wrap: break-word;
  overflow-wrap: break-word;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  z-index: 10;
  transition: all 0.2s ease;
  max-width: calc(100% - 4px);
  box-sizing: border-box;
}

.calendar-event:hover {
  z-index: 20;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

.calendar-event-time {
  font-size: 9px;
  opacity: 0.9;
  margin-bottom: 2px;
  line-height: 1.1;
}

.calendar-event-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
  line-height: 1.2;
  width: 100%;
  box-sizing: border-box;
}

.calendar-event-employer {
  font-weight: 600;
  font-size: 10px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  line-height: 1.2;
  max-width: 100%;
}

.calendar-event-title {
  font-weight: 500;
  font-size: 9px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  opacity: 0.95;
  line-height: 1.2;
  max-width: 100%;
}

.calendar-event-location {
  font-weight: 400;
  font-size: 8px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  opacity: 0.85;
  line-height: 1.2;
  max-width: 100%;
}

/* Month View */
.calendar-month-view {
  min-height: 500px;
}

.calendar-month-header {
  border-bottom: 2px solid #e5e7eb;
  background-color: #f9fafb;
}

.calendar-weekday-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid #e5e7eb;
}

.calendar-weekday {
  padding: 12px 8px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: #6b7280;
  border-right: 1px solid #e5e7eb;
}

.calendar-weekday:last-child {
  border-right: none;
}

.calendar-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: minmax(100px, auto);
}

.calendar-month-day {
  border-right: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  padding: 6px;
  min-height: 100px;
  position: relative;
  background-color: white;
  overflow: hidden;
}

.calendar-month-day.other-month {
  background-color: #f9fafb;
  color: #9ca3af;
}

.calendar-month-day.today {
  background-color: #fef3c7;
}

.calendar-month-day-number {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 4px;
}

.calendar-month-day.today .calendar-month-day-number {
  color: #6d28d9;
  font-weight: 700;
}

.calendar-month-day.other-month .calendar-month-day-number {
  color: #9ca3af;
}

.calendar-month-events {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  overflow: hidden;
}

.calendar-month-event {
  background: linear-gradient(135deg, #8E2DE2 0%, #4A00E0 100%);
  color: white;
  border-radius: 3px;
  padding: 3px 5px;
  font-size: 9px;
  cursor: pointer;
  overflow: hidden;
  word-wrap: break-word;
  overflow-wrap: break-word;
  transition: all 0.2s ease;
  width: 100%;
  box-sizing: border-box;
  max-width: 100%;
}

.calendar-month-event:hover {
  opacity: 0.9;
  transform: translateX(2px);
}

/* Responsive */
@media (max-width: 768px) {
  .calendar-week-view {
    height: 400px;
  }
  
  .calendar-time-column {
    width: 45px;
  }
  
  .calendar-time-slot {
    height: 50px;
    font-size: 9px;
    padding-top: 2px;
  }
  
  .calendar-day-slot {
    height: 50px;
  }
  
  .calendar-event {
    font-size: 9px;
    padding: 3px 5px;
  }
  
  .calendar-event-time {
    font-size: 8px;
  }
  
  .calendar-event-employer {
    font-size: 9px;
  }
  
  .calendar-event-title {
    font-size: 8px;
  }
  
  .calendar-event-location {
    font-size: 7px;
  }
  
  .calendar-day-header {
    padding: 8px 4px;
    font-size: 11px;
  }
  
  .calendar-day-header .day-name {
    font-size: 9px;
  }
  
  .calendar-day-header .day-number {
    font-size: 14px;
  }
  
  .calendar-month-day {
    min-height: 70px;
    padding: 4px;
  }
  
  .calendar-month-day-number {
    font-size: 11px;
  }
  
  .calendar-month-event {
    font-size: 8px;
    padding: 2px 4px;
  }
  
  #calendar-title {
    font-size: 16px;
  }
  
  #calendar-view-select {
    font-size: 12px;
    padding: 6px 8px;
  }
  
  #calendar-today-btn {
    font-size: 12px;
    padding: 6px 12px;
  }
}

/* Profile page - readonly fields */
.tile-field[readonly] {
  background-color: #f3f4f6 !important;
  cursor: not-allowed;
}

.tile-field.tile-readonly {
  pointer-events: none;
  opacity: 0.6;
  cursor: not-allowed;
}
