/* ===================================================================
   BLAZOR CUSTOM CSS - Extranet Partenaires
   Styles spécifiques Blazor et composants personnalisés
   =================================================================== */

/* === VARIABLES CSS === */
:root {
  /* Couleurs brand CD974 */
  --color-primary: #0066cc;
  --color-secondary: #6c757d;
  --color-success: #28a745;
  --color-danger: #dc3545;
  --color-warning: #ffc107;
  --color-info: #17a2b8;
  
  /* Couleurs grises */
  --color-gray-100: #f8f9fa;
  --color-gray-200: #e9ecef;
  --color-gray-300: #dee2e6;
  --color-gray-400: #ced4da;
  --color-gray-500: #adb5bd;
  --color-gray-600: #6c757d;
  --color-gray-700: #495057;
  --color-gray-800: #343a40;
  --color-gray-900: #212529;
  
  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  
  /* Typography */
  --font-family-base: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --font-size-base: 1rem;
  --line-height-base: 1.5;
  
  /* Border */
  --border-radius: 0.375rem;
  --border-radius-sm: 0.25rem;
  --border-radius-lg: 0.5rem;
  --border-radius-xl: 1rem;
  
  /* Shadows */
  --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  --shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
  
  /* Transitions */
  --transition-base: all 0.2s ease-in-out;
  --transition-fast: all 0.15s ease-in-out;
  --transition-slow: all 0.3s ease-in-out;
}

/* === LAYOUT === */

.page-container {
  min-height: calc(100vh - 60px - 120px); /* viewport - header - footer */
  padding: var(--spacing-lg) 0;
}

.content-wrapper {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

/* === LOADING SPINNER === */

.loading-spinner-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-2xl);
}

.loading-spinner {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

/* === VALIDATION & FORMS === */

.validation-message {
  display: block;
  color: var(--color-danger);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.invalid-feedback {
  display: block;
}

.form-control.is-invalid,
.form-select.is-invalid {
  border-color: var(--color-danger);
  padding-right: calc(1.5em + 0.75rem);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right calc(0.375em + 0.1875rem) center;
  background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.form-control.is-valid,
.form-select.is-valid {
  border-color: var(--color-success);
  padding-right: calc(1.5em + 0.75rem);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right calc(0.375em + 0.1875rem) center;
  background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

/* === CARDS === */

.card-hover {
  transition: var(--transition-base);
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.stats-card {
  border: none;
  border-radius: var(--border-radius-lg);
  transition: var(--transition-base);
  overflow: hidden;
}

.stats-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius);
  font-size: 2rem;
}

/* === BUTTONS === */

.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-loading {
  position: relative;
  pointer-events: none;
}

.btn-loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid currentColor;
  border-radius: 50%;
  border-right-color: transparent;
  animation: spin 0.75s linear infinite;
}

/* === WIZARD / STEPPER === */

.wizard-steps {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--spacing-xl);
  position: relative;
}

.wizard-step {
  flex: 1;
  text-align: center;
  position: relative;
}

.wizard-step::before {
  content: '';
  position: absolute;
  top: 20px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-gray-300);
  z-index: 0;
}

.wizard-step:first-child::before {
  left: 50%;
}

.wizard-step:last-child::before {
  right: 50%;
}

.wizard-step.completed::before {
  background: var(--color-success);
}

.step-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-gray-200);
  color: var(--color-gray-600);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  position: relative;
  z-index: 1;
  transition: var(--transition-base);
}

.wizard-step.active .step-circle {
  background: var(--color-primary);
  color: white;
  box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.2);
}

.wizard-step.completed .step-circle {
  background: var(--color-success);
  color: white;
}

.step-label {
  display: block;
  margin-top: var(--spacing-sm);
  font-size: 0.875rem;
  color: var(--color-gray-600);
}

.wizard-step.active .step-label {
  color: var(--color-primary);
  font-weight: 600;
}

.wizard-step.completed .step-label {
  color: var(--color-success);
}

/* === PASSWORD STRENGTH === */

.password-strength {
  margin-top: var(--spacing-sm);
}

.password-strength .progress {
  height: 8px;
  border-radius: var(--border-radius-sm);
}

.password-strength-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

/* === DATATABLE === */

.datatable-wrapper {
  position: relative;
}

.datatable-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-md);
  gap: var(--spacing-md);
  flex-wrap: wrap;
}

.datatable-search {
  flex: 1;
  min-width: 250px;
  max-width: 400px;
}

.datatable-actions {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
}

.table-hover tbody tr {
  cursor: pointer;
  transition: var(--transition-fast);
}

.table-hover tbody tr:hover {
  background-color: var(--color-gray-100);
}

.table-sortable th {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 1.5rem;
}

.table-sortable th:hover {
  background-color: var(--color-gray-100);
}

.sort-icon {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.4;
  transition: var(--transition-fast);
}

.sort-icon.active {
  opacity: 1;
  color: var(--color-primary);
}

/* === PAGINATION === */

.pagination-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--spacing-md);
  flex-wrap: wrap;
  gap: var(--spacing-md);
}

.pagination-info {
  font-size: 0.875rem;
  color: var(--color-gray-600);
}

/* === TOAST NOTIFICATIONS === */

.toast-container {
  position: fixed;
  z-index: 10000;
  pointer-events: none;
}

.toast-container.top-right {
  top: var(--spacing-md);
  right: var(--spacing-md);
}

.toast-container.top-left {
  top: var(--spacing-md);
  left: var(--spacing-md);
}

.toast-container.top-center {
  top: var(--spacing-md);
  left: 50%;
  transform: translateX(-50%);
}

.toast-container.bottom-right {
  bottom: var(--spacing-md);
  right: var(--spacing-md);
}

.toast-container.bottom-left {
  bottom: var(--spacing-md);
  left: var(--spacing-md);
}

.toast-container.bottom-center {
  bottom: var(--spacing-md);
  left: 50%;
  transform: translateX(-50%);
}

.toast {
  pointer-events: auto;
  animation: slideIn 0.3s ease-out;
  margin-bottom: var(--spacing-sm);
  box-shadow: var(--shadow);
}

.toast.removing {
  animation: slideOut 0.3s ease-in;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(20px);
  }
}

/* === MODAL / DIALOG === */

.modal-backdrop.show {
  opacity: 0.5;
}

.modal.fade .modal-dialog {
  transition: transform 0.3s ease-out;
  transform: translate(0, -50px);
}

.modal.show .modal-dialog {
  transform: none;
}

/* === FILE UPLOAD === */

.file-upload-area {
  border: 2px dashed var(--color-gray-300);
  border-radius: var(--border-radius);
  padding: var(--spacing-xl);
  text-align: center;
  transition: var(--transition-base);
  cursor: pointer;
}

.file-upload-area:hover {
  border-color: var(--color-primary);
  background-color: rgba(0, 102, 204, 0.05);
}

.file-upload-area.drag-over {
  border-color: var(--color-primary);
  background-color: rgba(0, 102, 204, 0.1);
}

.file-list {
  list-style: none;
  padding: 0;
  margin: var(--spacing-md) 0 0;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-sm);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--border-radius-sm);
  margin-bottom: var(--spacing-sm);
}

.file-item:hover {
  background-color: var(--color-gray-100);
}

.file-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-gray-200);
  border-radius: var(--border-radius-sm);
  margin-right: var(--spacing-sm);
}

/* === PROGRESS BAR === */

.progress-indeterminate {
  overflow: hidden;
}

.progress-indeterminate .progress-bar {
  animation: progress-indeterminate 1.5s infinite;
  width: 50%;
}

@keyframes progress-indeterminate {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(300%); }
}

/* === BADGES === */

.badge-lg {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
}

.badge-xl {
  padding: 0.625rem 1rem;
  font-size: 1rem;
}

/* === UTILITIES === */

.cursor-pointer {
  cursor: pointer;
}

.cursor-not-allowed {
  cursor: not-allowed;
}

.shadow-hover {
  transition: var(--transition-base);
}

.shadow-hover:hover {
  box-shadow: var(--shadow) !important;
}

.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.text-truncate-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fade-in {
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-in-left {
  animation: slideInLeft 0.3s ease-out;
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
/* === RESPONSIVE === */

html, body {
  overflow-x: hidden;
  max-width: 100%;
}

*, *::before, *::after {
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .wizard-steps {
    flex-direction: column;
    gap: var(--spacing-md);
  }
  
  .wizard-step::before {
    display: none;
  }
  
  .datatable-header {
    flex-direction: column;
    align-items: stretch;
  }
  
  .datatable-search {
    max-width: none;
  }
  
  .pagination-wrapper {
    flex-direction: column;
    align-items: center;
  }
}

@media (max-width: 576px) {
  :root {
    --spacing-xl: 1.5rem;
    --spacing-2xl: 2rem;
  }
  
  .stats-card {
    margin-bottom: var(--spacing-md);
  }
  
  .toast-container {
    left: var(--spacing-sm) !important;
    right: var(--spacing-sm) !important;
    transform: none !important;
  }
}

/* === PRINT === */

@media print {
  .no-print {
    display: none !important;
  }
  
  .page-container {
    min-height: auto;
  }
  
  .card {
    border: 1px solid var(--color-gray-300);
    box-shadow: none;
  }
}
