/*
Theme Name: ASP Intranet Ille-sur-Têt
Theme URI: https://illesurtet.pompiers.pro
Author: Amicale des sapeurs-pompiers d'Ille-sur-Têt
Author URI: https://illesurtet.pompiers.pro
Description: Thème intranet minimal avec interface à onglets pour l'amicale (Membres / Trésorerie).
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.6
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: asp-intranet
*/

/* Material Icons support global */
.material-icons {
  font-family: 'Material Icons';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  vertical-align: middle;
}

/* Reset et base */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f3f4f6;
  color: #111827;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Layout principal intranet */
.asp-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  position: relative;
}

.asp-app-header {
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
}

.asp-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.asp-brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: radial-gradient(circle at 30% 30%, #dc2626, #991b1b 60%, #b91c1c);
  box-shadow: 0 0 18px rgba(185, 28, 28, 0.4);
}

.asp-brand-text {
  display: flex;
  flex-direction: column;
}

.asp-brand-title {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #0f172a;
}

.asp-brand-subtitle {
  font-size: 0.8125rem;
  color: #64748b;
  font-weight: 400;
}

.asp-user-meta {
  font-size: 0.85rem;
  color: #6b7280;
}

.asp-app-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  position: relative;
  align-items: flex-start;
}

.asp-sidebar {
  width: 260px;
  background: #ffffff;
  border-right: 1px solid rgba(226, 232, 240, 0.8);
  padding: 1.5rem 0;
  overflow-y: auto;
  flex-shrink: 0;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.02);
}

.asp-sidebar-nav {
  padding: 0 0.75rem;
}

.asp-menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

.asp-menu-item {
  margin-bottom: 0.25rem;
}

.asp-menu-link {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.75rem 1rem;
  color: #475569;
  text-decoration: none;
  border-radius: 10px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.9375rem;
  font-weight: 500;
  position: relative;
}

.asp-menu-link:hover {
  background: rgba(241, 245, 249, 0.8);
  color: #0f172a;
  transform: translateX(2px);
}

.asp-menu-link.is-active {
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(185, 28, 28, 0.4);
  font-weight: 600;
}

.asp-menu-link.is-active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: white;
  border-radius: 0 2px 2px 0;
}

.asp-menu-icon {
  font-size: 1.5rem;
  width: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Material Icons';
  font-weight: normal;
  font-style: normal;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
}

.asp-menu-text {
  flex: 1;
}

.asp-app-main {
  flex: 1;
  padding: 1.5rem 2rem 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}

/* Pages */
.asp-page {
  display: none;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.asp-page-header {
  margin-bottom: 2rem;
}

.asp-page-title {
  font-size: 2rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 0.5rem 0;
  letter-spacing: -0.02em;
}

.asp-page-subtitle {
  font-size: 1rem;
  color: #64748b;
  margin: 0;
  font-weight: 400;
}

.asp-page-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.asp-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  border: 1px solid rgba(226, 232, 240, 0.8);
  padding: 1.75rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
  transition: box-shadow 0.2s ease;
}

.asp-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.08);
}

.asp-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.asp-card-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #1f2937;
}

.asp-card-body {
  /* Contenu de la carte */
}

/* Onglets */
.asp-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.asp-tab-list {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem;
  border-radius: 999px;
  background: #f9fafb;
  box-shadow: 0 0 0 1px rgba(209, 213, 219, 0.9);
}

.asp-tab {
  position: relative;
  border: none;
  background: transparent;
  color: #64748b;
  padding: 0.5rem 1.25rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: 'Outfit', sans-serif;
}

.asp-tab:hover {
  color: #0f172a;
  background: rgba(241, 245, 249, 0.6);
}

.asp-tab.asp-tab--active,
.asp-tab.is-active {
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(185, 28, 28, 0.4);
  font-weight: 600;
}

.asp-tab-badge {
  margin-left: 0.4rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  font-size: 0.7rem;
  background: rgba(255, 255, 255, 0.75);
}

.asp-secondary-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.asp-secondary-actions button {
  border-radius: 999px;
  border: 1px solid rgba(209, 213, 219, 0.9);
  background: #ffffff;
  color: #111827;
  padding: 0.35rem 0.9rem;
  font-size: 0.75rem;
  cursor: pointer;
}

.asp-secondary-actions button:hover {
  border-color: #111827;
}

/* Contenu des onglets */
.asp-panels {
  margin-top: 0.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(0, 1.1fr);
  gap: 1.25rem;
}

.asp-panel {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  border: 1px solid rgba(226, 232, 240, 0.8);
  box-shadow:
    0 4px 16px rgba(15, 23, 42, 0.06),
    0 2px 4px rgba(15, 23, 42, 0.04);
  padding: 1.5rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.asp-panel:hover {
  transform: translateY(-2px);
  box-shadow:
    0 8px 24px rgba(15, 23, 42, 0.1),
    0 4px 8px rgba(15, 23, 42, 0.06);
}

.asp-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.asp-panel-title {
  font-size: 0.95rem;
  font-weight: 600;
}

.asp-panel-subtitle {
  font-size: 0.8rem;
  color: #6b7280;
}

.asp-panel-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.asp-chip {
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.75rem;
  border: 1px solid rgba(209, 213, 219, 0.9);
  background: #f9fafb;
}

.asp-chip--warning {
  border-color: rgba(248, 113, 113, 0.9);
  color: #b91c1c;
}

.asp-chip--success {
  border-color: rgba(34, 197, 94, 0.9);
  color: #166534;
}

/* Tableaux simples */
.asp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.asp-table thead {
  background: #f3f4f6;
}

.asp-table th,
.asp-table td {
  padding: 0.45rem 0.5rem;
  text-align: left;
}

.asp-table th {
  font-weight: 500;
  color: #6b7280;
  border-bottom: 1px solid rgba(209, 213, 219, 0.9);
}

.asp-table tbody tr:nth-child(odd) {
  background: #ffffff;
}

.asp-table tbody tr:nth-child(even) {
  background: #f9fafb;
}

.asp-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem;
  color: #111827;
}

.asp-tag--active {
  background: rgba(22, 163, 74, 0.18);
  border: 1px solid rgba(34, 197, 94, 0.9);
}

.asp-tag--pending {
  background: rgba(234, 179, 8, 0.18);
  border: 1px solid rgba(234, 179, 8, 0.9);
}

.asp-tag--disabled {
  background: rgba(148, 163, 184, 0.18);
  border: 1px solid rgba(148, 163, 184, 0.9);
}

.asp-highlight-number {
  font-variant-numeric: tabular-nums;
  font-size: 1.35rem;
  font-weight: 600;
}

.asp-highlight-label {
  font-size: 0.8rem;
  color: #9ca3af;
}

.asp-highlight {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.asp-footer {
  padding: 0.75rem 2rem 1.25rem;
  font-size: 0.75rem;
  color: #9ca3af;
  border-top: 1px solid rgba(229, 231, 235, 0.9);
  background: radial-gradient(circle at bottom right, #ffffff, #f3f4f6 60%);
}

/* Modale membre */
.asp-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.asp-modal-backdrop.is-open {
  display: flex;
}

/* Les assistants doivent être au-dessus du modal de tournée */
#asp-assistant-paiements-backdrop,
#asp-assistant-souche-backdrop {
  z-index: 60;
}

.asp-modal {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  box-shadow:
    0 32px 64px rgba(15, 23, 42, 0.2),
    0 0 0 1px rgba(226, 232, 240, 0.8);
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.asp-modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(229, 231, 235, 0.9);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.asp-modal-title {
  font-size: 1rem;
  font-weight: 600;
}

.asp-modal-body {
  padding: 1rem 1.25rem 1.25rem;
  overflow-y: auto;
}

.asp-modal-close {
  border: none;
  background: transparent;
  cursor: pointer;
  color: #9ca3af;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.asp-modal-close:hover {
  color: #111827;
  background: rgba(241, 245, 249, 0.8);
}

.asp-modal-close .material-icons {
  font-size: 1.25rem;
}

/* Styles pour le formulaire membre */
.asp-member-modal {
  max-width: 800px;
}

.asp-beneficiaries-list-modal {
  max-width: 900px;
}

.asp-beneficiaries-list-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.asp-beneficiary-member-section {
  background: #f9fafb;
  border-radius: 12px;
  padding: 1.25rem;
  border: 1.5px solid #e5e7eb;
}

.asp-beneficiary-member-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e5e7eb;
}

.asp-beneficiary-member-name {
  font-size: 1.125rem;
  font-weight: 600;
  color: #0f172a;
}

.asp-beneficiary-member-info {
  font-size: 0.875rem;
  color: #64748b;
  margin-left: auto;
}

.asp-beneficiary-type-section {
  margin-top: 1rem;
}

.asp-beneficiary-type-section:first-child {
  margin-top: 0;
}

.asp-beneficiary-type-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.75rem;
}

.asp-beneficiary-type-title .material-icons {
  font-size: 1.125rem;
  color: #dc2626;
}

.asp-beneficiary-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.asp-beneficiary-list-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: white;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.asp-beneficiary-list-item-name {
  flex: 1;
  font-weight: 500;
  color: #111827;
}

.asp-beneficiary-list-item-birthdate {
  font-size: 0.875rem;
  color: #6b7280;
}

.asp-beneficiary-empty {
  padding: 1rem;
  text-align: center;
  color: #9ca3af;
  font-size: 0.875rem;
  font-style: italic;
}

.asp-member-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.asp-form-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.asp-form-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.asp-form-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: #0f172a;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.asp-form-section-title .material-icons {
  font-size: 1.125rem;
  color: #dc2626;
}

.asp-form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.asp-form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.asp-form-group--span-2 {
  grid-column: span 2;
}

.asp-form-group--span-3 {
  grid-column: span 3;
}

.asp-form-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.asp-required {
  color: #dc2626;
}

.asp-form-input,
.asp-form-textarea,
.asp-form-select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.9375rem;
  font-family: 'Outfit', sans-serif;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  background: #ffffff;
  color: #111827;
  transition: all 0.2s ease;
}

.asp-form-input:focus,
.asp-form-textarea:focus,
.asp-form-select:focus {
  outline: none;
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.1);
}

.asp-form-textarea {
  resize: vertical;
  min-height: 80px;
}

.asp-form-select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 12px;
  padding-right: 2.5rem;
  appearance: none;
}

.asp-form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}

.asp-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 500;
  font-family: 'Outfit', sans-serif;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.asp-btn--primary {
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(185, 28, 28, 0.3);
}

.asp-btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(185, 28, 28, 0.4);
}

.asp-btn--secondary {
  background: #f9fafb;
  color: #374151;
  border: 1.5px solid #e5e7eb;
}

.asp-btn--secondary:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.asp-btn--small {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

/* Styles pour les bénéficiaires */
.asp-beneficiaries-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.asp-beneficiary-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  background: #f9fafb;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  transition: all 0.2s ease;
}

.asp-beneficiary-item:hover {
  border-color: #dc2626;
  background: #fef2f2;
}

.asp-beneficiary-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
  color: white;
}

.asp-beneficiary-icon .material-icons {
  font-size: 1.25rem;
}

.asp-beneficiary-content {
  flex: 1;
  display: grid;
  grid-template-columns: 120px 1fr 1fr 140px;
  gap: 0.75rem;
  align-items: start;
}

.asp-beneficiary-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.asp-beneficiary-delete {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: #ef4444;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.asp-beneficiary-delete:hover {
  background: #fee2e2;
  color: #dc2626;
}

.asp-beneficiary-delete .material-icons {
  font-size: 1.125rem;
}

@media (max-width: 768px) {
  .asp-form-grid {
    grid-template-columns: 1fr;
  }
  
  .asp-form-group--span-2,
  .asp-form-group--span-3 {
    grid-column: span 1;
  }
  
  .asp-beneficiary-content {
    grid-template-columns: 1fr;
  }
}

/* Responsif */
@media (max-width: 960px) {
  .asp-app-header {
    padding: 1rem 1.25rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .asp-app-main {
    padding: 1rem 1.25rem 1.5rem;
  }

  .asp-panels {
    grid-template-columns: minmax(0, 1fr);
  }

  .asp-secondary-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

/* Styles pour les assistants de saisie */
.asp-assistant-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.asp-assistant-item {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.75rem;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}

.asp-assistant-item-input {
  flex: 1;
  min-width: 0;
}

.asp-assistant-item-label {
  min-width: 80px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #6b7280;
}

.asp-assistant-item-value {
  min-width: 100px;
  font-weight: 600;
  color: #111827;
  text-align: right;
}

.asp-assistant-item-remove {
  padding: 0.25rem;
  color: #dc2626;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.asp-assistant-item-remove:hover {
  background: rgba(220, 38, 38, 0.1);
}

.asp-assistant-item .material-icons {
  flex-shrink: 0;
}

.asp-assistant-item-icon-container {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* S'assurer que les modals assistant sont centrés comme les autres modals */
#asp-assistant-paiements-backdrop,
#asp-assistant-souche-backdrop {
  display: none; /* Caché par défaut */
  align-items: center;
  justify-content: center;
}

#asp-assistant-paiements-backdrop.is-open,
#asp-assistant-souche-backdrop.is-open {
  display: flex; /* Affiché seulement quand is-open est présent */
}

/* Style pour le champ "À restituer par l'agent" */
#asp-tournee-a-restituer {
  border: 1px solid #e5e7eb;
  transition: all 0.2s ease;
}

.asp-restituer-ok-message {
  display: inline-block;
  font-size: 0.875rem;
}


