/**
 * Partners UX Styles
 * États sélection, hover, responsive, accessibilité
 */

/* ========== LIST ITEM STATES ========== */
.szm-department-link {
  position: relative;
  transition: all 150ms ease-in-out;
}

/* Hover state */
.szm-department-link:hover {
  background: rgba(29, 78, 216, 0.08);
}

/* Focus visible (keyboard navigation) */
.szm-department-link:focus-visible {
  outline: 2px solid #1d4ed8;
  outline-offset: -2px;
}

/* Selected state */
.szm-department-link.szm-dept-selected {
  background: rgba(16, 185, 129, 0.1);
  border-left: 4px solid #10b981;
  padding-left: calc(12px - 4px);
}

.szm-department-link.szm-dept-selected::before {
  content: '✓';
  display: inline-block;
  margin-right: 8px;
  color: #10b981;
  font-weight: 700;
  font-size: 16px;
}

/* Hover + selected */
.szm-department-link.szm-dept-selected:hover {
  background: rgba(16, 185, 129, 0.15);
}

/* ========== LIST CONTAINER ========== */
#szm-departments-list {
  max-height: 500px;
  overflow-y: auto;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #ffffff;
}

/* Scrollbar styling */
#szm-departments-list::-webkit-scrollbar {
  width: 8px;
}

#szm-departments-list::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.03);
  border-radius: 4px;
}

#szm-departments-list::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 4px;
}

#szm-departments-list::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

/* ========== SEARCH INPUT ========== */
.szm-search-input {
  transition: all 150ms ease-in-out;
}

.szm-search-input:focus {
  outline: 2px solid #1d4ed8;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.1);
}

/* ========== RESET BUTTON (optional) ========== */
.szm-dept-reset-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  margin-top: 12px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 6px;
  background: #ffffff;
  color: #4b5563;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms ease-in-out;
}

.szm-dept-reset-btn:hover {
  background: #f3f4f6;
  border-color: rgba(0, 0, 0, 0.18);
}

.szm-dept-reset-btn:focus-visible {
  outline: 2px solid #1d4ed8;
  outline-offset: 2px;
}

/* ========== MOBILE RESPONSIVE ========== */
@media (max-width: 768px) {
  /* Prioritize list on mobile */
  .szm-main-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .szm-map-section {
    order: 2;
    max-height: 300px;
  }

  .szm-sidebar {
    order: 1;
  }

  /* Reduce padding and gaps on small screens */
  .szm-department-link {
    padding: 10px 12px;
    font-size: 14px;
  }

  .szm-department-link.szm-dept-selected {
    padding-left: 12px;
  }

  /* Make list taller on mobile since map is hidden */
  #szm-departments-list {
    max-height: 60vh;
  }

  /* Search box */
  .szm-search-box {
    margin-bottom: 12px;
  }

  .szm-search-input {
    width: 100%;
    padding: 12px;
    font-size: 16px; /* Prevent zoom on iOS */
    border-radius: 8px;
  }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .szm-map-section {
    max-height: 45vh;
  }

  #szm-departments-list {
    max-height: 40vh;
  }
}

/* ========== TABLET & UP ========== */
@media (min-width: 769px) {
  .szm-main-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    align-items: start;
  }

  .szm-sidebar {
    max-height: 800px;
    display: flex;
    flex-direction: column;
  }

  .szm-search-box {
    margin-bottom: 16px;
  }

  #szm-departments-list {
    flex: 1;
    max-height: 600px;
  }

  /* Desktop search */
  .szm-search-input {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
  }
}

/* ========== LARGE DESKTOP ========== */
@media (min-width: 1200px) {
  .szm-map-section {
    min-height: 700px;
  }

  #szm-departments-list {
    max-height: 650px;
  }
}

/* ========== ACCESSIBILITY ========== */

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .szm-department-link,
  .szm-search-input {
    transition: none !important;
  }
}

/* High contrast mode */
@media (prefers-contrast: more) {
  .szm-department-link.szm-dept-selected {
    border-left: 5px solid #10b981;
    font-weight: 600;
  }

  .szm-department-link:focus-visible {
    outline-width: 3px;
  }
}

/* Dark mode support (if site uses it) */
@media (prefers-color-scheme: dark) {
  #szm-departments-list {
    background: #1a1a1a;
    border-color: rgba(255, 255, 255, 0.1);
  }

  .szm-department-link:hover {
    background: rgba(29, 78, 216, 0.2);
  }

  .szm-department-link.szm-dept-selected {
    background: rgba(16, 185, 129, 0.15);
  }

  .szm-dept-reset-btn {
    background: #2a2a2a;
    border-color: rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
  }

  .szm-dept-reset-btn:hover {
    background: #3a3a3a;
    border-color: rgba(255, 255, 255, 0.2);
  }
}

/* ========== ANIMATIONS ========== */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.szm-departments-list {
  animation: slideDown 200ms ease-out;
}

/* Print styles */
@media print {
  .szm-search-box,
  .szm-map-section {
    display: none;
  }

  .szm-department-link.szm-dept-selected::before {
    content: '[SELECTED] ';
  }
}
