/**
 * ===================================================
 * Potential-Matcher - Mobile CSS
 * ===================================================
 * 
 * Mobile-optimierte Styles für kleine Bildschirme
 * 
 * @copyright (c) 2025 Potential-Matcher
 * @license   Proprietär - Alle Rechte vorbehalten
 * 
 * Diese Software ist urheberrechtlich geschützt.
 * Die Nutzung ist nur mit ausdrücklicher schriftlicher
 * Erlaubnis des Autors gestattet.
 * ===================================================
 */

/* ==============================================
   MOBILE INTERFACE OPTIMIERUNGEN
   ============================================== */

/* Mobile Header Layout */
#header-mobile {
  background: #ffffff;
  border-bottom: 1px solid #dee2e6;
  padding: 1rem 0.5rem;
  margin-bottom: 1rem !important;
}

#header-mobile #logo {
  max-height: 150px !important;
}

#header-mobile .input-group {
  border-radius: 0.375rem;
}

#header-mobile .dropdown-toggle {
  font-size: 0.875rem;
  padding: 0.375rem 0.75rem;
}

#header-mobile .dropdown-menu {
  border-radius: 0.5rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

#header-mobile .dropdown-item {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

#header-mobile .dropdown-item:hover {
  background-color: rgba(0, 123, 255, 0.1);
}

/* Container-Anpassungen für Mobile */
.mobile-interface {
  padding: 0.5rem 0;
}

/* Potential Legend - MOBILE (identisch mit Desktop-Design) */
.potential-legend-compact {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.potential-legend-compact .legend-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    border-bottom: 1px solid #d1d5db;
    cursor: pointer;
    user-select: none;
}

.potential-legend-compact .legend-header:hover {
    background: linear-gradient(135deg, #cbd5e1 0%, #b4b9c7 100%);
}

.potential-legend-compact .legend-header-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 8px;
}

.potential-legend-compact .legend-toggle-btn {
    background: none;
    border: none;
    color: #6b7280;
    font-size: 0.9rem;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.15s ease;
    cursor: pointer;
}

.potential-legend-compact .legend-toggle-btn:hover {
    background-color: rgba(107, 114, 128, 0.1);
    color: #374151;
}

.potential-legend-compact .legend-content {
    padding: 12px 16px;
    transition: all 0.3s ease;
    overflow: hidden;
    max-height: 500px;
    opacity: 1;
}

.potential-legend-compact .legend-content.collapsed {
    max-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    opacity: 0;
}

.potential-legend-compact .legend-container {
    display: block; /* Einspaltig für mobile Version */
}

.potential-legend-compact .legend-horizontal {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.potential-legend-compact .legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: #64748b;
    padding: 4px 8px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.potential-legend-compact .legend-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    border-color: #cbd5e1;
}

.potential-legend-compact .legend-item i {
    font-size: 0.9rem;
}

/* Alte Mobile Legende (falls noch verwendet) */
.potential-legend-mobile {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.potential-legend-mobile h6 {
  color: #495057;
  font-weight: 600;
  margin-bottom: 0.75rem;
  font-size: 1rem;
}

.legend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.5rem;
}

/* Horizontale Legende für mobile Ansicht */
.legend-horizontal {
  max-width: 100%;
}

.legend-horizontal .legend-item {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 0.25rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  white-space: nowrap;
  flex-shrink: 0;
}

.legend-horizontal .legend-item i {
  font-size: 0.7rem;
}

.legend-item {
  display: flex;
  align-items: center;
  font-size: 0.8rem;
  padding: 0.25rem 0.5rem;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 0.25rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.legend-item i {
  margin-right: 0.4rem;
  font-size: 0.7rem;
  flex-shrink: 0;
}

/* Mobile Filter-Interface */
.mobile-filters .accordion-button {
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.mobile-filters .accordion-body {
  padding: 1rem;
}

.mobile-filters select {
  font-size: 0.85rem;
  padding: 0.5rem;
}

/* Mobile Filter Stack - Checkboxen */
.mobile-filters-stack {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem;
  background: rgba(248, 249, 250, 0.8);
  border-radius: 0.5rem;
  border: 1px solid #dee2e6;
  margin: 0.5rem 0;
}

.mobile-filters-stack .form-check {
  margin-bottom: 0;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 0.375rem;
  display: flex !important;
  align-items: center;
  transition: all 0.2s ease;
}

.mobile-filters-stack .form-check:hover {
  background: rgba(255, 255, 255, 1);
  border-color: rgba(0, 0, 0, 0.15);
}

.mobile-filters-stack .form-check-label {
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  margin-left: 0.5rem;
}

/* ==============================================
   MOBILE SUCHFELD OPTIMIERUNGEN
   ============================================== */

/* Mobile Suchcontainer */
@media (max-width: 768px) {
  .search-container .input-group {
    flex-wrap: nowrap !important;
  }
  
  /* Suchfeld Input - mobile Optimierung */
  .search-container .form-control {
    min-width: 0 !important;
    flex: 1 !important;
    font-size: 16px !important; /* Verhindert Zoom auf iOS */
  }
  
  /* Such-Buttons kompakter machen */
  .search-container .btn {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 0.375rem 0.5rem;
  }
  
  .search-container .input-group-text {
    flex-shrink: 0;
    padding: 0.375rem 0.5rem;
  }
}

/* ==============================================
   MOBILE JAHRGÄNGE CHECKBOXEN
   ============================================== */

/* Jahrgänge-Container für mobile Ansicht */
@media (max-width: 768px) {
  .grades-checkbox-container .d-flex {
    justify-content: flex-start !important;
    flex-wrap: wrap;
  }
  
  .grades-checkbox-container .form-check {
    flex: 0 0 auto !important;
    margin-right: 1rem;
    margin-bottom: 0.5rem;
  }
  
  /* Erste Zeile: 5, 6 - linksbündig */
  .grades-checkbox-container .d-flex:first-child {
    gap: 1rem !important;
  }
  
  /* Zweite Zeile: 7, 8, 9, 10 - linksbündig */
  .grades-checkbox-container .d-flex:nth-child(2) {
    gap: 1rem !important;
  }
  
  /* Dritte Zeile: 11, 12, 13 - linksbündig */
  .grades-checkbox-container .d-flex:last-child {
    gap: 1rem !important;
  }
}

/* Activity Details - Vertikale Ausrichtung */
.activity-details .detail-row {
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.activity-details .detail-row:last-child {
  border-bottom: none;
}

.activity-details .detail-label {
  font-size: 0.8rem;
  color: #6c757d;
  margin-bottom: 0.25rem;
}

.activity-details .detail-value {
  font-size: 0.9rem;
  font-weight: 500;
  color: #333;
  word-wrap: break-word;
}

/* Details Grid für perfekte Ausrichtung */
.details-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.1rem 0.5rem;
  align-items: baseline;
}

.details-grid .detail-label {
  color: #6c757d;
  font-size: 0.85rem;
  white-space: nowrap;
}

.details-grid .detail-value {
  font-weight: 500;
}

.mobile-checkbox-stack {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mobile-checkbox-stack .form-check {
  margin-bottom: 0;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 0.25rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  display: block !important; /* Überschreibt form-check-inline */
}

.mobile-checkbox-stack .form-check-inline {
  display: block !important; /* Überschreibt form-check-inline */
  margin-right: 0 !important;
}

.mobile-checkbox-stack .form-check-label {
  font-size: 0.85rem;
  font-weight: 500;
}

/* ==============================================
   MOBILE CARD LAYOUT
   ============================================== */

/* Ergebnis-Info */
.results-info {
  background: #f8f9fa;
  border-radius: 0.25rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid #e9ecef;
}

/* Activity Cards */
.mobile-cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.activity-card .card {
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.2s ease;
}

.activity-card .card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.activity-card .card-header {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-bottom: 1px solid #dee2e6;
  padding: 0.75rem 1rem;
}

.activity-card .card-title {
  font-size: 1rem;
  font-weight: 600;
  color: #495057;
  line-height: 1.3;
}

.activity-type-mobile {
  flex-shrink: 0;
  margin-left: 0.5rem;
}

.activity-card .card-body {
  padding: 1rem;
}

/* Potentiale nebeneinander */
.potentials-flex {
  margin-top: 0.5rem;
}

.potential-badge-mobile {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  color: white;
  font-weight: 500;
}

/* Activity Flags ohne Rahmen */
.activity-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.activity-flags span {
  display: inline-flex;
  align-items: center;
}

.activity-flags i {
  font-size: 1rem;
}

/* Potenziale untereinander */
.potentials-mobile {
  border-bottom: 1px solid #f0f0f0;
  padding-bottom: 0.75rem;
}

.potentials-mobile .field-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #495057;
  margin-bottom: 0.5rem;
}

.potentials-stack {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  align-items: flex-start;
}

.potential-badge-mobile {
  font-size: 0.75rem;
  padding: 0.3rem 0.6rem;
  border-radius: 1rem;
  color: white !important;
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: inline-block;
  max-width: 100%;
  word-wrap: break-word;
}

/* Aktivitäts-Details */
.activity-details {
  margin-top: 0.75rem;
}

.detail-row {
  display: flex;
  margin-bottom: 0.4rem;
  align-items: flex-start;
}

.detail-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #6c757d;
  min-width: 80px;
  flex-shrink: 0;
  margin-right: 0.5rem;
}

.detail-value {
  font-size: 0.8rem;
  color: #495057;
  line-height: 1.3;
  word-break: break-word;
}

/* Activity Flags */
.activity-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.flag-badge {
  font-size: 0.7rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.75rem;
}

/* Beziehungen */
.activity-relations {
  border-top: 1px solid #f0f0f0;
  padding-top: 0.5rem;
}

.relation-item {
  margin-bottom: 0.25rem;
  display: flex;
  align-items: flex-start;
}

.relation-item i {
  margin-right: 0.25rem;
  margin-top: 0.1rem;
  flex-shrink: 0;
}

/* Admin-Aktionen */
.activity-actions {
  margin-top: 0.75rem;
}

.activity-actions .btn {
  font-size: 0.75rem;
  padding: 0.4rem 0.8rem;
}

/* ==============================================
   MOBILE PAGINATION
   ============================================== */

.mobile-pagination {
  background: #f8f9fa;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-top: 1rem;
}

.mobile-pagination .pagination {
  margin-bottom: 0;
}

.mobile-pagination .page-link {
  font-size: 0.8rem;
  padding: 0.4rem 0.6rem;
}

/* ==============================================
   RESPONSIVE ANPASSUNGEN
   ============================================== */

/* Sehr kleine Bildschirme (< 576px) */
@media (max-width: 575.98px) {
  .mobile-interface {
    padding: 0.25rem 0;
  }
  
  .potential-legend-mobile {
    padding: 0.75rem;
  }
  
  .legend-grid {
    grid-template-columns: 1fr;
  }
  
  .legend-item {
    font-size: 0.75rem;
  }
  
  .activity-card .card-header,
  .activity-card .card-body {
    padding: 0.75rem;
  }
  
  .activity-card .card-title {
    font-size: 0.9rem;
  }
  
  .potential-badge-mobile {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
  }
  
  .detail-label {
    min-width: 70px;
    font-size: 0.75rem;
  }
  
  .detail-value {
    font-size: 0.75rem;
  }
  
  .mobile-pagination {
    padding: 0.75rem;
  }
}

/* Mittlere mobile Bildschirme (576px - 767.98px) */
@media (min-width: 576px) and (max-width: 767.98px) {
  .legend-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .potentials-stack {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.3rem;
  }
}

/* Größere mobile Bildschirme / Tablets (768px+) */
@media (min-width: 768px) {
  .legend-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .mobile-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }
  
  .potentials-stack {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.3rem;
  }
}

/* ==============================================
   TOUCH-OPTIMIERUNGEN
   ============================================== */

/* Größere Touch-Targets */
.mobile-filters .accordion-button,
.activity-actions .btn,
.mobile-pagination .page-link {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Hover-Effekte nur für Geräte mit Hover-Capability */
@media (hover: hover) {
  .activity-card .card:hover {
    transform: translateY(-1px);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }
  
  .potential-badge-mobile:hover {
    transform: scale(1.05);
    transition: transform 0.2s ease;
  }
}

/* ==============================================
   ACCESSIBILITY VERBESSERUNGEN
   ============================================== */

/* Fokus-Styles für Touch-Navigation */
.mobile-filters .accordion-button:focus,
.activity-actions .btn:focus,
.mobile-pagination .page-link:focus {
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
  outline: none;
}

/* Kontrast-Verbesserungen */
.detail-label,
.potential-legend-mobile h6 {
  color: #343a40;
}

/* Loading States für bessere UX */
.loading-card {
  opacity: 0.6;
  pointer-events: none;
}

.loading-card::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
