/* KAW Sponsoring Admin Styles – v2.0 */

/* === Card Layout === */
.kaw-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  transition: box-shadow 0.2s ease;
  overflow: hidden; /* Verhindert dass Inhalte den Card-Container vergrößern */
}

.kaw-card:hover {
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.kaw-card-title {
  margin: 0 0 16px 0;
  padding: 0 0 12px 0;
  border-bottom: 2px solid #0073aa;
  font-size: 1.3em;
  font-weight: 600;
  color: #23282d;
}

/* === Modern Tables === */
.kaw-table-responsive {
  overflow-x: auto;
  margin: 16px 0;
  max-width: 100%; /* Wichtig: nicht breiter als Container */
  width: 100%; /* Explizit 100% Breite */
  display: block; /* Block-Element für korrekte Breiten-Berechnung */
  -webkit-overflow-scrolling: touch;
  /* Moderne Scrollbar - verschwindet wenn nicht genutzt */
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 115, 170, 0.3) transparent;
}

.kaw-table-responsive::-webkit-scrollbar {
  height: 8px;
}

.kaw-table-responsive::-webkit-scrollbar-track {
  background: transparent;
}

.kaw-table-responsive::-webkit-scrollbar-thumb {
  background: rgba(0, 115, 170, 0.3);
  border-radius: 4px;
  transition: background 0.2s ease;
}

.kaw-table-responsive::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 115, 170, 0.5);
}

.kaw-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: #fff;
  min-width: 800px; /* Mindestbreite für Tabellen - triggert Scroll wenn Container kleiner ist */
  table-layout: auto; /* Spaltenbreiten automatisch anpassen */
}

.kaw-table thead {
  background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
  color: #fff;
}

.kaw-table thead th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border: none;
}

.kaw-table tbody tr {
  border-bottom: 1px solid #e8e8e8;
  transition: background-color 0.15s ease;
}

.kaw-table tbody tr:hover {
  background-color: #f7f9fa;
}

.kaw-table tbody td {
  padding: 12px 16px;
  vertical-align: top;
}

.kaw-table-compact tbody td {
  font-size: 13px;
  padding: 8px 12px;
}

.kaw-td-strong {
  font-weight: 600;
  color: #23282d;
}

/* === Spaltenbreiten für Desktop === */
.kaw-table th:nth-child(1),
.kaw-table td:nth-child(1) {
  width: 20%; /* Firma */
  min-width: 150px;
}

.kaw-table th:nth-child(2),
.kaw-table td:nth-child(2) {
  width: 12%; /* Status Sponsoring */
  min-width: 100px;
}

.kaw-table th:nth-child(3),
.kaw-table td:nth-child(3) {
  width: 12%; /* Sponsoring-Option/Programm */
  min-width: 90px;
}

.kaw-table th:nth-child(4),
.kaw-table td:nth-child(4) {
  width: 12%; /* Status Zahlung */
  min-width: 100px;
}

.kaw-table th:nth-child(5),
.kaw-table td:nth-child(5) {
  width: 10%; /* Betrag */
  min-width: 80px;
  text-align: right;
}

.kaw-table th:nth-child(6),
.kaw-table td:nth-child(6) {
  width: 15%; /* Magic Link */
  min-width: 120px;
  text-align: center;
}

/* Letzte Spalte (Actions/Links) zentrieren */
.kaw-magic-link-cell {
  text-align: center !important;
}

/* === Status Badges === */
.kaw-status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: lowercase;
  white-space: nowrap;
}

.kaw-status-badge.status-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.kaw-status-badge.status-pending {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
}

.kaw-status-badge.status-warning {
  background: #ffe5cc;
  color: #cc5500;
  border: 1px solid #ffd4a3;
}

.kaw-status-badge.status-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.kaw-status-badge.status-neutral {
  background: #e9ecef;
  color: #495057;
  border: 1px solid #dee2e6;
}

/* === Modern Buttons === */
.button.button-primary {
  background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
  border: none;
  border-radius: 6px;
  padding: 10px 24px;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0, 115, 170, 0.2);
  transition: all 0.2s ease;
  text-shadow: none;
}

.button.button-primary:hover {
  background: linear-gradient(135deg, #005a87 0%, #004666 100%);
  box-shadow: 0 4px 8px rgba(0, 115, 170, 0.3);
  transform: translateY(-1px);
}

.button.button-primary:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 115, 170, 0.2);
}

.button.button-secondary {
  background: #fff;
  border: 2px solid #0073aa;
  color: #0073aa;
  border-radius: 6px;
  padding: 8px 22px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.button.button-secondary:hover {
  background: #f0f8ff;
  border-color: #005a87;
  color: #005a87;
  transform: translateY(-1px);
}

.kaw-action-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

/* === Forms === */
.kaw-form {
  margin-top: 16px;
}

.kaw-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px; /* Erhöht von 16px auf 20px für bessere Abstände */
  margin-bottom: 16px;
}

.kaw-form-group {
  display: flex;
  flex-direction: column;
}

.kaw-form-group-full {
  grid-column: 1 / -1;
  max-width: 600px; /* Begrenzt die Breite von full-width Feldern */
}

/* Spezifische Breiten-Begrenzungen für Einzelfelder */
.kaw-form-group select {
  max-width: 500px; /* Dropdown-Felder nicht zu breit */
}

.kaw-form-group input[type="text"],
.kaw-form-group input[type="email"] {
  max-width: 500px; /* Text-Felder nicht zu breit */
}

.kaw-form-group label {
  font-weight: 600;
  margin-bottom: 6px;
  color: #23282d;
  font-size: 14px;
}

.kaw-form-group input[type="text"],
.kaw-form-group input[type="email"],
.kaw-form-group input[type="url"],
.kaw-form-group input[type="date"],
.kaw-form-group input[type="number"],
.kaw-form-group select,
.kaw-form-group textarea {
  padding: 10px 12px; /* Erhöht von 8px auf 10px für einheitliche Höhe */
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.4; /* Einheitliche Zeilenhöhe */
  height: 42px; /* Feste Höhe für Inputs und Selects */
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  width: 100%;
  box-sizing: border-box;
}

.kaw-form-group textarea {
  height: auto; /* Textarea darf variable Höhe haben */
  min-height: 80px;
}

.kaw-form-group input:focus,
.kaw-form-group select:focus,
.kaw-form-group textarea:focus {
  border-color: #0073aa;
  box-shadow: 0 0 0 1px #0073aa;
  outline: none;
}

.kaw-form-group textarea {
  resize: vertical;
  font-family: inherit;
}

.kaw-form-group small {
  margin-top: 4px;
  color: #666;
  font-size: 12px;
}

/* === Action Buttons === */
.kaw-action-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* === Invoice List === */
.kaw-invoice-list {
  margin-top: 16px;
}

.kaw-invoice-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px;
  background: #f9f9f9;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  margin-bottom: 8px;
}

.kaw-invoice-item:hover {
  background: #f0f0f0;
}

.kaw-invoice-info {
  flex: 1;
}

.kaw-invoice-info strong {
  color: #23282d;
  font-size: 14px;
}

/* === Responsive === */
@media (max-width: 782px) {
  .kaw-card {
    padding: 16px;
    margin-bottom: 16px;
  }

  .kaw-card-title {
    font-size: 1.1em;
  }

  .kaw-table {
    font-size: 13px;
  }

  .kaw-table thead th,
  .kaw-table tbody td {
    padding: 8px 10px;
  }

  /* Horizontal Scroll für große Tabellen */
  .kaw-table-responsive {
    -webkit-overflow-scrolling: touch;
  }

  .kaw-form-grid {
    grid-template-columns: 1fr;
  }

  .kaw-invoice-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .kaw-invoice-item form {
    width: 100%;
  }

  .kaw-invoice-item button {
    width: 100%;
  }
}

@media (max-width: 600px) {
  .kaw-card {
    padding: 12px;
  }

  .kaw-table thead th {
    font-size: 11px;
    padding: 6px 8px;
  }

  .kaw-table tbody td {
    font-size: 12px;
    padding: 6px 8px;
  }

  .kaw-action-buttons {
    flex-direction: column;
  }

  .kaw-action-buttons form {
    width: 100%;
  }

  .kaw-action-buttons button {
    width: 100%;
  }
}

/* === WordPress Admin Compatibility === */
.kaw-wrap h1 {
  font-size: 1.8em;
  margin-bottom: 24px;
  color: #23282d;
}

.kaw-wrap .notice {
  margin: 0 0 20px 0;
}

/* === Button Enhancements === */
.kaw-card .button-primary {
  background: #0073aa;
  border-color: #0073aa;
  box-shadow: 0 1px 3px rgba(0,115,170,0.3);
  transition: all 0.2s ease;
}

.kaw-card .button-primary:hover {
  background: #005a87;
  border-color: #005a87;
  box-shadow: 0 2px 6px rgba(0,115,170,0.4);
}

.kaw-card .button {
  transition: all 0.2s ease;
}
/* === Magic Link Column === */
.kaw-magic-link-cell {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.kaw-magic-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #0073aa;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.kaw-magic-link:hover {
  color: #005a87;
  text-decoration: underline;
}

.kaw-magic-link .dashicons {
  font-size: 16px;
  width: 16px;
  height: 16px;
}

.kaw-copy-btn {
  padding: 4px 8px;
  min-height: 28px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
}

.kaw-copy-btn .dashicons {
  font-size: 14px;
  width: 14px;
  height: 14px;
  line-height: 1;
}

.kaw-copy-btn:hover {
  background: #f0f0f0;
  border-color: #999;
}

@media (max-width: 782px) {
  .kaw-magic-link-cell {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  
  .kaw-copy-btn {
    width: 100%;
  }
}
