/**
 * @file
 * Styles for GUDE appointment calendar functionality.
 */

/* Appointment form styling */
.webform-submission-form .rendez-vous-section {
  border: 1px solid #e0e0e0;
  padding: 20px;
  margin: 20px 0;
  border-radius: 8px;
  background-color: #f9f9f9;
}

.webform-submission-form .rendez-vous-section legend {
  font-weight: bold;
  color: #333;
  padding: 0 10px;
  background-color: #f9f9f9;
}

/* Date input styling */
.form-item-appointment-date input[type="date"] {
  padding: 10px;
  border: 2px solid #ddd;
  border-radius: 5px;
  font-size: 16px;
  width: 100%;
  max-width: 300px;
}

.form-item-appointment-date input[type="date"]:focus {
  border-color: #0073aa;
  outline: none;
  box-shadow: 0 0 5px rgba(0, 115, 170, 0.3);
}

/* Time slots container */
#appointment-time-slots-wrapper {
  margin-top: 15px;
  transition: opacity 0.3s ease;
}

#appointment-time-slots-wrapper.loading {
  opacity: 0.6;
  position: relative;
}

#appointment-time-slots-wrapper.loading::after {
  content: '';
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #ccc;
  border-top-color: #0073aa;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Time slot selection */
.form-item-appointment-time select {
  padding: 10px;
  border: 2px solid #ddd;
  border-radius: 5px;
  font-size: 16px;
  width: 100%;
  max-width: 300px;
  background-color: white;
}

.form-item-appointment-time select:focus {
  border-color: #0073aa;
  outline: none;
  box-shadow: 0 0 5px rgba(0, 115, 170, 0.3);
}

.form-item-appointment-time select:disabled {
  background-color: #f5f5f5;
  color: #999;
}

/* Appointment preview */
.appointment-preview {
  margin: 20px 0;
  padding: 15px;
  background-color: #e7f3ff;
  border: 1px solid #b3d9ff;
  border-radius: 5px;
  display: none;
}

.appointment-preview-content h4 {
  margin: 0 0 10px 0;
  color: #0073aa;
  font-size: 18px;
}

.appointment-preview-content p {
  margin: 5px 0;
  font-size: 14px;
}

.appointment-preview-content .appointment-note {
  font-style: italic;
  color: #666;
  margin-top: 10px;
  font-size: 13px;
}

/* Mini calendar widget */
.mini-calendar {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: 10px 0;
}

.mini-calendar th,
.mini-calendar td {
  padding: 5px;
  text-align: center;
  border: 1px solid #ddd;
}

.mini-calendar th {
  background-color: #f0f0f0;
  font-weight: bold;
}

.mini-calendar td.today {
  background-color: #0073aa;
  color: white;
  font-weight: bold;
}

.mini-calendar td:hover {
  background-color: #f0f8ff;
  cursor: pointer;
}

/* Responsive design */
@media (max-width: 768px) {
  .webform-submission-form .rendez-vous-section {
    padding: 15px;
  }
  
  .form-item-appointment-date input[type="date"],
  .form-item-appointment-time select {
    max-width: 100%;
  }
  
  .appointment-preview {
    padding: 10px;
  }
  
  .appointment-preview-content h4 {
    font-size: 16px;
  }
}

/* Success and error states */
.form-item-appointment-date.has-error input,
.form-item-appointment-time.has-error select {
  border-color: #d63384;
}

.form-item-appointment-date.has-success input,
.form-item-appointment-time.has-success select {
  border-color: #198754;
}

/* Loading spinner for AJAX */
.ajax-progress {
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-left: 5px;
}

.ajax-progress-throbber {
  width: 16px;
  height: 16px;
  background: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGNpcmNsZSBjeD0iOCIgY3k9IjgiIHI9IjciIHN0cm9rZT0iIzk5OTk5OSIgc3Ryb2tlLXdpZHRoPSIyIi8+CjxwYXRoIGQ9Ik0xNSA4QTE1IDggMCAwIDEgOCAyM0E3IDcgMCAwIDEgOCAxeiIgZmlsbD0iIzY2NjY2NiIvPgo8L3N2Zz4K") no-repeat center;
  animation: spin 1s linear infinite;
}

/* Form validation messages */
.form-item .form-item--error-message {
  color: #d63384;
  font-size: 12px;
  margin-top: 5px;
}

.form-item .form-item--help-text {
  color: #666;
  font-size: 12px;
  margin-top: 5px;
}

/* Admin calendar styles */
.appointment-calendar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #e0e0e0;
}

.calendar-header h2 {
  margin: 0;
  color: #333;
}

.calendar-navigation {
  display: flex;
  gap: 10px;
}

.calendar-navigation .btn {
  padding: 8px 16px;
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  text-decoration: none;
  color: #495057;
  transition: all 0.2s ease;
}

.calendar-navigation .btn:hover {
  background-color: #e9ecef;
  color: #212529;
}

.calendar-grid {
  border: 1px solid #dee2e6;
  border-radius: 8px;
  overflow: hidden;
  background-color: white;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background-color: #f8f9fa;
}

.weekday {
  padding: 12px;
  text-align: center;
  font-weight: bold;
  color: #495057;
  border-right: 1px solid #dee2e6;
}

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

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background-color: #dee2e6;
}

.calendar-day {
  min-height: 120px;
  background-color: white;
  padding: 8px;
  position: relative;
}

.calendar-day.other-month {
  background-color: #f8f9fa;
  color: #6c757d;
}

.calendar-day.today {
  background-color: #e3f2fd;
  border: 2px solid #2196f3;
}

.day-number {
  font-weight: bold;
  margin-bottom: 5px;
}

.day-appointments {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.appointment {
  padding: 2px 4px;
  border-radius: 3px;
  font-size: 11px;
  line-height: 1.2;
  border-left: 3px solid;
}

.appointment-pending {
  background-color: #fff3cd;
  border-color: #ffc107;
  color: #856404;
}

.appointment-confirmed {
  background-color: #d1ecf1;
  border-color: #17a2b8;
  color: #0c5460;
}

.appointment-completed {
  background-color: #d4edda;
  border-color: #28a745;
  color: #155724;
}

.appointment-cancelled {
  background-color: #f8d7da;
  border-color: #dc3545;
  color: #721c24;
}

.appointment-time {
  font-weight: bold;
}

.appointment-client {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-available {
  margin-top: 5px;
}

.add-appointment {
  color: #007bff;
  text-decoration: none;
  font-size: 11px;
  padding: 2px 4px;
  border: 1px dashed #007bff;
  border-radius: 3px;
  display: inline-block;
}

.add-appointment:hover {
  background-color: #e3f2fd;
  text-decoration: none;
}

.calendar-legend {
  margin-top: 20px;
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: 8px;
}

.calendar-legend h3 {
  margin-top: 0;
  margin-bottom: 10px;
}

.legend-items {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border-left: 3px solid;
}

/* Admin table styles */
.appointment-filters {
  display: flex;
  gap: 15px;
  align-items: end;
  margin-bottom: 20px;
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: 8px;
}

.appointment-filters .form-item {
  margin-bottom: 0;
}

.status-pending {
  color: #856404;
  background-color: #fff3cd;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
}

.status-confirmed {
  color: #0c5460;
  background-color: #d1ecf1;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
}

.status-completed {
  color: #155724;
  background-color: #d4edda;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
}

.status-cancelled {
  color: #721c24;
  background-color: #f8d7da;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
}

/* Responsive design for calendar */
@media (max-width: 768px) {
  .appointment-calendar {
    padding: 10px;
  }
  
  .calendar-header {
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
  }
  
  .calendar-navigation {
    justify-content: center;
  }
  
  .calendar-day {
    min-height: 80px;
    padding: 4px;
  }
  
  .appointment {
    font-size: 10px;
  }
  
  .legend-items {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .appointment-filters {
    flex-direction: column;
    align-items: stretch;
  }
}