/* Styles communs pour toutes les pages */

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  top: 0; 
  left: 0;
  width: 100%; 
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  animation: modalFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background: white;
  border-radius: 24px;
  max-width: 800px;
  width: 100%;
  max-height: 100vh;
  overflow: hidden;
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(255, 255, 255, 0.1);
  animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: center bottom;
}

@keyframes modalFadeIn {
  from { 
    opacity: 0;
  }
  to { 
    opacity: 1;
  }
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Modal closing animation */
.modal.closing {
  animation: modalFadeOut 0.3s cubic-bezier(0.4, 0, 1, 1);
}

.modal.closing .modal-content {
  animation: modalSlideDown 0.3s cubic-bezier(0.4, 0, 1, 1);
}

@keyframes modalFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes modalSlideDown {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
}

.modal-content pre strong {
  font-size: 16px;
  font-weight: 600;
  color: #1c140d;
  display: block;
  margin-bottom: 8px;
}

.modal-content pre code {
  display: inline-block;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  padding: 8px 12px;
  border-radius: 8px;
  font-family: monospace;
  font-size: 13px;
  color: #1c140d;
  border: 1px solid #e2e8f0;
  margin: 4px 0;
  word-break: break-all;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.modal-content pre button.btn-primary {
  margin-top: 16px;
  background: linear-gradient(135deg, #f27f0c 0%, #e06d00 100%);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(242, 127, 12, 0.3);
}

.modal-content pre button.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(242, 127, 12, 0.4);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 32px 20px;
  border-bottom: 1px solid #f1f5f9;
  background: linear-gradient(135deg, #fefefe 0%, #f8fafc 100%);
  position: relative;
}

.modal-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 32px;
  right: 32px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #e2e8f0, transparent);
}

.modal-header h3 {
  font-size: 22px;
  font-weight: 800;
  color: #1c140d;
  margin: 0;
  letter-spacing: -0.025em;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #64748b;
  padding: 8px;
  border-radius: 12px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
}

.modal-close:hover {
  background: #f1f5f9;
  color: #475569;
  transform: rotate(90deg);
}

.modal-body {
  padding: 32px;
  max-height: 500px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.modal-body pre {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  padding: 24px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

.modal-body pre::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, #f27f0c 0%, #e06d00 100%);
}

/* Success/Error states */
.modal-content.success .modal-header {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

.modal-content.success .modal-body pre::before {
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
}

.modal-content.error .modal-header {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
}

.modal-content.error .modal-body pre::before {
  background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
}

/* Copy button styling */
.copy-icon {
  display: inline-flex;
  align-items: center;
  margin-left: 12px;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: all 0.2s ease;
  background: rgba(242, 127, 12, 0.1);
  border: 1px solid rgba(242, 127, 12, 0.2);
}

.copy-icon:hover {
  background: rgba(242, 127, 12, 0.2);
  transform: scale(1.1);
}

.copy-icon svg {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}

.copy-icon:hover svg {
  transform: scale(1.1);
}

/* Modal content sections */
.modal-info-section {
  margin: 16px 0;
  padding: 16px;
  background: #f8fafc;
  border-radius: 12px;
  border-left: 4px solid #f27f0c;
}

.modal-info-item {
  display: flex;
  align-items: center;
  margin: 12px 0;
  padding: 8px 0;
  border-bottom: 1px solid #e2e8f0;
}

.modal-info-item:last-child {
  border-bottom: none;
}

.modal-info-label {
  font-weight: 600;
  color: #374151;
  min-width: 100px;
  margin-right: 12px;
}

.modal-info-value {
  flex: 1;
  font-family: 'Monaco', 'Menlo', monospace;
  background: white;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  font-size: 13px;
  word-break: break-all;
  min-width: 0;
  overflow-wrap: break-word;
}

/* Style spécial pour les longues clés */
.modal-info-value.long-key {
  font-size: 11px;
  line-height: 1.4;
  padding: 10px 12px;
}

/* Lien de backup stylisé */
.backup-link {
  color: #f27f0c !important;
  text-decoration: none !important;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.backup-link:hover {
  background: #fef7ed;
  border-color: #f27f0c;
  transform: translateY(-1px);
}

/* Action buttons in modal */
.modal-action-button {
  width: 100%;
  margin-top: 20px;
  background: linear-gradient(135deg, #f27f0c 0%, #e06d00 100%);
  color: white;
  font-weight: 700;
  padding: 16px 24px;
  border-radius: 16px;
  border: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 16px;
  letter-spacing: 0.025em;
  box-shadow: 0 8px 25px rgba(242, 127, 12, 0.3);
  position: relative;
  overflow: hidden;
}

.modal-action-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.6s;
}

.modal-action-button:hover::before {
  left: 100%;
}

.modal-action-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 35px rgba(242, 127, 12, 0.4);
}

.modal-action-button:active {
  transform: translateY(-1px);
}

/* Notification System */
.notifications {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 400px;
}

.notification {
  padding: 16px 20px;
  border-radius: 8px;
  color: white;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: slideIn 0.3s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  max-width: 400px;
  word-wrap: break-word;
}

.notification-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.notification-message {
  line-height: 1.4;
  font-size: 14px;
}

.notification-expand {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  align-self: flex-start;
  transition: background 0.2s;
}

.notification-expand:hover {
  background: rgba(255, 255, 255, 0.3);
}

.notification.success {
  background: linear-gradient(135deg, #10b981, #059669);
}

.notification.error {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.notification.info {
  background: linear-gradient(135deg, #14b8a6, #0d9488);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Copy Icon Styles */
p {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

p strong {
  margin-right: 4px;
}

p code {
  display: inline;
  vertical-align: middle;
}

/* Button Styles */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
}

.btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-success {
  background: #10b981;
  color: white;
}

.btn-success:hover:not(:disabled) {
  background: #059669;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

/* Enhanced Button Styles */
.btn-enhanced {
  position: relative;
  overflow: hidden;
}

.btn-enhanced::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.btn-enhanced:hover::before {
  left: 100%;
}

/* Card Hover Effects */
.card-hover {
  transition: all 0.3s ease;
}

.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* Form Enhancements */
.form-group {
  position: relative;
}

.form-group input:focus + .form-label,
.form-group textarea:focus + .form-label,
.form-group select:focus + .form-label {
  color: #f27f0c;
}

/* Loading States */
.loading {
  position: relative;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
  .px-40 {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  .grid {
    grid-template-columns: 1fr !important;
  }
  
  .notifications {
    right: 16px;
    left: 16px;
    max-width: none;
  }
  
  .modal-content {
    width: 95%;
    margin: 16px;
  }
}