/**
 * Checklist Démarches Administratives - Styles V2
 * @version 2.0.0
 */

/* ═══════════════════════════════════════════════════════════════════
   HEADER & CONFIGURATION
   ═══════════════════════════════════════════════════════════════════ */

.demarches-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #eee;
}

.dates-config {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.date-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.date-field label {
  font-size: 0.875rem;
  color: #666;
  font-weight: 500;
}

.date-field input {
  padding: 0.625rem 0.875rem;
  border: 1px solid #ddd;
  border-radius: 0.5rem;
  font-size: 0.9375rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.date-field input:focus {
  outline: none;
  border-color: var(--pfm-primary, #9360F7);
  box-shadow: 0 0 0 3px rgba(97, 51, 75, 0.1);
}

/* ═══════════════════════════════════════════════════════════════════
   PROGRESS
   ═══════════════════════════════════════════════════════════════════ */

.progress-summary {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.progress-circle {
  position: relative;
  width: 70px;
  height: 70px;
}

.progress-circle svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.progress-bg {
  fill: none;
  stroke: #e0e0e0;
  stroke-width: 3;
}

.progress-fill {
  fill: none;
  stroke: var(--pfm-primary, #9360F7);
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dasharray 0.5s ease;
}

.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--pfm-primary, #9360F7);
}

.progress-label {
  font-size: 0.875rem;
  color: #666;
}

/* ═══════════════════════════════════════════════════════════════════
   FILTRES
   ═══════════════════════════════════════════════════════════════════ */

.demarches-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.filter-btn {
  padding: 0.5rem 1rem;
  border: 1px solid #ddd;
  background: white;
  border-radius: 2rem;
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.filter-btn:hover {
  border-color: var(--pfm-primary, #9360F7);
}

.filter-btn.active {
  background: var(--pfm-primary, #9360F7);
  border-color: var(--pfm-primary, #9360F7);
  color: white;
}

.filter-btn .count {
  background: rgba(0,0,0,0.1);
  padding: 0.125rem 0.5rem;
  border-radius: 1rem;
  font-size: 0.75rem;
}

.filter-btn.active .count {
  background: rgba(255,255,255,0.2);
}

/* ═══════════════════════════════════════════════════════════════════
   SECTIONS & PERIODS
   ═══════════════════════════════════════════════════════════════════ */

.demarches-section {
  margin-bottom: 2rem;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background: var(--section-color);
}

.section-icon {
  font-size: 1.5rem;
}

.section-header h2 {
  margin: 0;
  font-size: 1.25rem;
  color: #333;
}

.section-stats {
  margin-left: auto;
  font-size: 0.875rem;
  color: #666;
  background: rgba(255,255,255,0.7);
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
}

.period-group {
  background: #f8f9fa;
  padding: 1rem 1.5rem;
  border-left: 3px solid var(--section-color);
}

.period-group:last-child {
  border-radius: 0 0 1rem 1rem;
}

.period-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.period-title {
  margin: 0;
  font-size: 1rem;
  color: var(--pfm-primary, #9360F7);
}

.period-countdown {
  font-size: 0.8125rem;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-weight: 500;
}

.period-countdown.urgent {
  background: #FFEBEE;
  color: #C62828;
}

.period-countdown.soon {
  background: #FFF3E0;
  color: #E65100;
}

.period-countdown.ok {
  background: #E8F5E9;
  color: #2E7D32;
}

.period-countdown.past {
  background: #ECEFF1;
  color: #607D8B;
}

/* ═══════════════════════════════════════════════════════════════════
   ITEMS
   ═══════════════════════════════════════════════════════════════════ */

.demarche-items {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.demarche-item {
  display: flex;
  gap: 1rem;
  padding: 1.25rem;
  background: white;
  border-radius: 0.75rem;
  border: 2px solid transparent;
  transition: all 0.2s;
  position: relative;
}

.demarche-item:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.demarche-item.completed {
  opacity: 0.6;
  background: #f5f5f5;
}

.demarche-item.completed .demarche-title {
  text-decoration: line-through;
}

.demarche-item.urgency-critical {
  border-color: #f44336;
  background: #FFEBEE;
}

.demarche-item.urgency-urgent {
  border-color: #ff9800;
}

.demarche-item.urgency-soon {
  border-left: 4px solid #FFC107;
}

.demarche-item.hidden {
  display: none;
}

/* Checkbox */
.demarche-check {
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
}

.demarche-check input {
  opacity: 0;
  position: absolute;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.check-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 2px solid #ccc;
  border-radius: 50%;
  color: transparent;
  font-weight: bold;
  transition: all 0.2s;
}

.demarche-check:hover .check-icon {
  border-color: var(--pfm-primary, #9360F7);
}

.demarche-item.completed .check-icon {
  background: #4CAF50;
  border-color: #4CAF50;
  color: white;
}

/* Content */
.demarche-content {
  flex: 1;
  min-width: 0;
}

.demarche-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.demarche-title {
  font-weight: 600;
  font-size: 1.0625rem;
  color: #333;
}

.demarche-desc {
  margin: 0 0 0.75rem;
  font-size: 0.9375rem;
  color: #666;
  line-height: 1.5;
}

/* Badges */
.badge {
  padding: 0.25rem 0.625rem;
  border-radius: 1rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge--essential {
  background: #FFEBEE;
  color: #C62828;
}

.badge--urgent {
  background: #FFF3E0;
  color: #E65100;
  animation: pulse 2s infinite;
}

.badge--days {
  background: #E3F2FD;
  color: #1565C0;
}

.badge--overdue {
  background: #f44336;
  color: white;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Details */
.demarche-details {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  font-size: 0.8125rem;
}

.detail-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  color: #888;
}

.detail-row a {
  color: var(--pfm-primary, #9360F7);
  text-decoration: none;
}

.detail-row a:hover {
  text-decoration: underline;
}

.detail-icon {
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}

.deadline-calculated {
  font-weight: 600;
  color: var(--pfm-primary, #9360F7);
}

/* Tips */
.demarche-tip {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: #FFF8E1;
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  color: #F57C00;
  line-height: 1.4;
}

/* ═══════════════════════════════════════════════════════════════════
   ACTIONS
   ═══════════════════════════════════════════════════════════════════ */

.demarches-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #eee;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: 1px solid #ddd;
  background: white;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 0.9375rem;
  transition: all 0.2s;
}

.action-btn:hover {
  background: #f5f5f5;
  border-color: #ccc;
}

.action-btn--primary {
  background: var(--pfm-primary, #9360F7);
  border-color: var(--pfm-primary, #9360F7);
  color: white;
}

.action-btn--primary:hover {
  background: #4a2639;
}

.action-btn--danger {
  color: #d32f2f;
  border-color: #ffcdd2;
}

.action-btn--danger:hover {
  background: #FFEBEE;
}

/* ═══════════════════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════════════════ */

.demarches-empty {
  text-align: center;
  padding: 3rem;
  color: #888;
}

.demarches-empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 640px) {
  .demarches-header {
    flex-direction: column;
    align-items: stretch;
  }

  .progress-summary {
    justify-content: center;
  }

  .dates-config {
    flex-direction: column;
  }

  .demarche-item {
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
  }

  .demarche-check {
    position: absolute;
    top: 1rem;
    right: 1rem;
  }

  .demarche-content {
    padding-right: 3rem;
  }

  .demarches-filters {
    justify-content: center;
  }

  .demarches-actions {
    flex-direction: column;
  }

  .action-btn {
    justify-content: center;
  }
}
