/**
 * TASKMATE - Reminders CSS
 * =========================
 * Styling für Erinnerungen
 */

/* =====================
   REMINDER MODAL
   ===================== */

#reminder-modal .modal-content {
  max-width: 500px;
  width: 90vw;
}

/* Form Actions with Delete Button */
.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-md);
}

.form-actions-left {
  display: flex;
  gap: var(--spacing-md);
}

.btn-delete-reminder {
  /* Lösch-Button rechts */
}

/* Kompakte Color Picker */
.color-picker-wrapper {
  position: relative;
  display: inline-block;
}

.color-picker-trigger {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid var(--border-default);
  transition: all var(--transition-fast);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.color-picker-trigger:hover {
  border-color: var(--primary);
  transform: scale(1.05);
}

.color-picker-icon {
  color: white;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5));
}

.color-picker-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 4px;
  min-width: 160px;
}

.color-picker-dropdown.hidden {
  display: none;
}

.color-picker-dropdown .color-option {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--transition-fast);
  position: relative;
}

.color-picker-dropdown .color-option:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  border-color: var(--border-default);
}

.color-picker-dropdown .color-option.selected {
  border-color: var(--text-primary);
  transform: scale(1.1);
}

.color-picker-dropdown .color-option.selected::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 12px;
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
}

/* Time Input Styling - Match Date Input */
#reminder-modal input[type="time"] {
  width: 100%;
  padding: 10px 14px;
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
  min-width: 140px;
}

#reminder-modal input[type="time"]:hover {
  border-color: var(--border-dark);
}

#reminder-modal input[type="time"]:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
  outline: none;
}

/* Advance Options - Redesigned */
.advance-options {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-3);
  background: var(--bg-secondary);
  padding: var(--spacing-3);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
}

/* Reminder Advance Control */
.reminder-advance-control {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-2);
}

.reminder-advance-inputs {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  flex-wrap: wrap;
}

.reminder-number-input {
  width: 70px;
  text-align: center;
  padding: 10px 8px;
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  background: white;
  border: 2px solid var(--border-default);
  border-radius: var(--radius-md);
}

.reminder-number-input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: var(--shadow-focus);
}

.reminder-unit-select {
  flex: 1;
  min-width: 120px;
  max-width: 180px;
  padding: 10px 16px;
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  background: white;
  border: 2px solid var(--border-default);
  border-radius: var(--radius-md);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3e%3cpath d='M6 9l6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
}

.reminder-unit-select:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: var(--shadow-focus);
}

.reminder-advance-suffix {
  font-size: var(--text-base);
  color: var(--text-primary);
  font-weight: var(--font-semibold);
  white-space: nowrap;
}

.checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 14px;
  position: relative;
  padding-left: 28px;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.checkbox-label .checkmark {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 18px;
  width: 18px;
  background-color: #f8f9fa;
  border: 2px solid #d1d5db;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.checkbox-label:hover .checkmark {
  border-color: #3b82f6;
}

.checkbox-label input:checked ~ .checkmark {
  background-color: #3b82f6;
  border-color: #3b82f6;
}

.checkbox-label .checkmark::after {
  content: "";
  position: absolute;
  display: none;
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checkbox-label input:checked ~ .checkmark::after {
  display: block;
}

/* =====================
   CUSTOM SELECT (USER DROPDOWN) - Aligned with Multi-Select Design
   ===================== */

.custom-select {
  position: relative;
  width: 100%;
}

.custom-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: white;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 42px;
}

.custom-select-trigger:hover {
  border-color: var(--border-dark);
}

.custom-select-trigger.active {
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}

.custom-select-value {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  color: var(--text-primary);
  font-size: 14px;
}

.custom-select-arrow {
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.custom-select.open .custom-select-arrow {
  transform: rotate(180deg);
}

.custom-select-options {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: #ffffff;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: 1001;
  max-height: 240px;
  overflow-y: auto;
  min-width: 200px;
  display: none;
  /* Ensure opaque background */
  background-color: #ffffff !important;
}

.custom-select.open .custom-select-options {
  display: block;
}

.custom-select-option {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  padding: 8px 12px;
  cursor: pointer;
  transition: background-color var(--transition-fast);
  color: var(--text-primary);
  background-color: #ffffff;
  position: relative;
}

.custom-select-option:hover {
  background-color: #f3f4f6 !important;
}

.custom-select-option.selected {
  background-color: #e0e7ff !important;
}

.option-avatar {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}

.option-text {
  font-size: 14px;
  color: var(--text-primary);
  flex: 1;
}

.selected-user-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}

/* =====================
   MODAL HEADER FIX
   ===================== */

#reminder-modal .modal-header h3 {
  color: #000000 !important;
  background: transparent !important;
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
}

#reminder-modal .modal-header h3:hover {
  color: #000000 !important;
  background: transparent !important;
}

#reminder-modal .modal-header {
  background: var(--bg-card);
}

/* Verhindere Orange-Hover-Effekte auf Modal-Inhalten */
#reminder-modal * {
  transition: background-color 0.2s ease, color 0.2s ease;
}

#reminder-modal *:not(.btn):not(.custom-select-option):not(.option-avatar):not(.option-text):hover {
  background: transparent !important;
  color: inherit !important;
}

/* Ensure dropdown options have solid background */
#reminder-modal .custom-select-options {
  background-color: #ffffff !important;
  isolation: isolate;
}

/* Keep text elements transparent but allow avatars to have background */
#reminder-modal .custom-select-option .option-text {
  background: transparent !important;
}

/* Stelle sicher, dass Text im Modal immer lesbar bleibt */
#reminder-modal .modal-content {
  background: var(--bg-card) !important;
  color: #000000 !important;
}

#reminder-modal label,
#reminder-modal .form-control,
#reminder-modal input,
#reminder-modal textarea,
#reminder-modal p,
#reminder-modal span:not(.btn):not(.option-avatar):not(.selected-user-avatar) {
  color: #000000 !important;
  background: var(--bg-primary) !important;
}

#reminder-modal .form-group label {
  color: #000000 !important;
  font-weight: 500;
}

#reminder-modal .checkbox-label {
  color: #000000 !important;
}

/* =====================
   MODAL BUTTONS
   ===================== */

#reminder-modal .btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white !important;
  border: 1px solid #3b82f6;
  padding: 10px 20px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

#reminder-modal .btn-primary:hover,
#reminder-modal .btn-primary:focus {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  border-color: #1d4ed8;
  color: white !important;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(200, 168, 81, 0.4);
}

#reminder-modal .btn-secondary {
  background: #6b7280;
  color: white;
  border: 1px solid #6b7280;
}

#reminder-modal .btn-secondary:hover {
  background: #4b5563;
  border-color: #4b5563;
  color: white;
}

/* =====================
   CALENDAR INTEGRATION
   ===================== */

/* Reminder Button in Calendar Toolbar */
.btn-reminder,
.btn-secondary.btn-reminder {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%) !important;
  color: white !important;
  border: 2px solid #ea580c !important;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
}

.btn-reminder:hover,
.btn-reminder:focus,
.btn-secondary.btn-reminder:hover,
.btn-secondary.btn-reminder:focus {
  background: linear-gradient(135deg, #ea580c 0%, #dc2626 100%) !important;
  color: white !important;
  border-color: #dc2626 !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.4);
  text-decoration: none;
}

.btn-reminder:active {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(234, 88, 12, 0.3);
}

.btn-reminder .icon {
  animation: reminderBell 2s ease-in-out infinite;
}

@keyframes reminderBell {
  0%, 50%, 100% { transform: rotate(0deg); }
  10%, 30% { transform: rotate(-10deg); }
  20%, 40% { transform: rotate(10deg); }
}

/* Reminder Icons in Calendar - DEPRECATED (reminders now shown as tasks) */
/*
.calendar-reminder {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  background: var(--reminder-color, #F59E0B);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: white;
  z-index: 2;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.calendar-reminder::before {
  content: '🔔';
  font-size: 8px;
}

.calendar-reminder:hover {
  transform: scale(1.2);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
*/

/* Day Detail Popup - Reminder Button */
.calendar-day-detail .btn:not(.btn-primary) {
  background: linear-gradient(135deg, #6B7280 0%, #4B5563 100%);
  color: white;
  border: none;
}

/* Calendar Reminder Add Button - Orange styling */
.calendar-week-add-reminder {
  margin: var(--spacing-2) var(--spacing-3) var(--spacing-3);
  padding: var(--spacing-2);
  background: #f97316;
  border: 1px solid #f97316;
  border-radius: var(--radius-lg);
  color: white !important;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.calendar-week-add-reminder:hover {
  background: #ea580c;
  border-color: #dc2626;
  color: white !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.4);
}

/* Secondary reminder button - orange variant */
.btn-reminder-secondary,
.btn.btn-reminder-secondary {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%) !important;
  color: white !important;
  border: 2px solid #ea580c !important;
  font-weight: var(--font-medium);
  transition: all var(--transition-fast);
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
}

.btn-reminder-secondary .icon,
.btn.btn-reminder-secondary .icon {
  color: white !important;
  width: 18px !important;
  height: 18px !important;
}

.btn-reminder-secondary:hover,
.btn-reminder-secondary:focus,
.btn.btn-reminder-secondary:hover,
.btn.btn-reminder-secondary:focus {
  background: linear-gradient(135deg, #ea580c 0%, #dc2626 100%) !important;
  color: white !important;
  border-color: #dc2626 !important;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(249, 115, 22, 0.4);
}

.btn-reminder-secondary:active,
.btn.btn-reminder-secondary:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(249, 115, 22, 0.3);
}

/* Reminder Detail Popup */
.calendar-reminder-detail {
  min-width: 300px;
  max-width: 400px;
}

.calendar-detail-reminders {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: var(--spacing-md) 0;
}

.calendar-detail-reminder {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: 6px;
  border-left: 3px solid var(--reminder-color, #F59E0B);
  transition: all 0.2s ease;
}

.reminder-content {
  flex: 1;
  cursor: pointer;
  min-width: 0; /* Allows text truncation */
}

.calendar-detail-reminder:hover {
  background: var(--bg-tertiary);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Reminder Delete Button */
.reminder-delete-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.reminder-delete-btn:hover {
  background: var(--error-bg);
  border-color: var(--error);
  color: var(--error);
  transform: scale(1.05);
}

.reminder-delete-btn:active {
  transform: scale(0.95);
}

.calendar-detail-reminder .reminder-time {
  font-size: 14px;
  font-weight: 600;
  color: var(--reminder-color, #F59E0B);
  margin-bottom: 4px;
}

.calendar-detail-reminder .reminder-title {
  font-weight: 500;
  margin-bottom: 2px;
  color: var(--text-primary);
}

.calendar-detail-reminder .reminder-description {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  #reminder-modal .modal-content {
    max-width: none;
    width: 95vw;
    margin: 20px auto;
  }
  
  .color-picker {
    justify-content: center;
  }
  
  .advance-options {
    gap: 12px;
  }
  
  .checkbox-label {
    font-size: 16px;
    padding-left: 32px;
  }
  
  .checkbox-label .checkmark {
    width: 20px;
    height: 20px;
  }
}

/* =====================
   EINHEITLICHE CHECKBOX STYLES
   ===================== */

/* ALTERNATIVER ANSATZ: Direktes Checkbox-Styling */
.advance-options .checklist-item {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 8px 0 !important;
  cursor: pointer !important;
}

.advance-options input[type="checkbox"] {
  width: 20px !important;
  height: 20px !important;
  margin: 0 !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  border: 2px solid #d1d5db !important;
  border-radius: 4px !important;
  background-color: white !important;
  cursor: pointer !important;
  position: relative !important;
  flex-shrink: 0 !important;
}

.advance-options input[type="checkbox"]:checked {
  background-color: #3B82F6 !important;
  border-color: #3B82F6 !important;
}

.advance-options input[type="checkbox"]:checked::after {
  content: '✓' !important;
  position: absolute !important;
  top: -3px !important;
  left: 2px !important;
  color: white !important;
  font-size: 16px !important;
  font-weight: bold !important;
  line-height: 20px !important;
}

.advance-options .checklist-text {
  font-size: 14px !important;
  color: #374151 !important;
  text-decoration: none !important;
  cursor: pointer !important;
}

/* Verstecke die fake checkbox spans */
.advance-options .checklist-checkbox {
  display: none !important;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .checkbox-label .checkmark {
    background-color: var(--bg-tertiary);
    border-color: var(--border-secondary);
  }
  
  .calendar-reminder {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  }
}