/**
 * LYVRE V3 - Composant Bug Reporter
 * 
 * Formulaire flottant de signalement de bugs
 */

.bug-reporter-container {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 9999;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  margin: 0;
  padding: 0;
  width: auto;
  height: auto;
}

/* Onglet flottant */
.bug-reporter-tab {
  position: absolute;
  right: 0;
  top: 50%;
  /* Après rotation de -90deg, la largeur devient la hauteur et vice versa
     On compense en décalant de la moitié de la hauteur (après rotation) vers la gauche
     pour que le bord gauche soit visible */
  transform: translateY(-50%) rotate(-90deg) translateX(calc(-100% + 48px));
  transform-origin: bottom right;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  z-index: 2;
  white-space: nowrap;
  margin: 0;
  width: auto;
  height: auto;
}

.bug-reporter-tab:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  transform: translateY(-50%) rotate(-90deg) translateX(calc(-100% + 44px));
}

.bug-reporter-tab i {
  font-size: 16px;
}

.bug-reporter-tab-label {
  display: inline-block;
}

/* Panneau du formulaire */
.bug-reporter-panel {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%) translateX(100%);
  width: 420px;
  max-width: calc(100vw - 40px);
  max-height: 90vh;
  background: #1a1a2e;
  border-radius: 12px 0 0 12px;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.bug-reporter-container.bug-reporter-open .bug-reporter-panel {
  transform: translateY(-50%) translateX(0);
}

/* Header */
.bug-reporter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
}

.bug-reporter-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #e5e7eb;
  display: flex;
  align-items: center;
  gap: 8px;
}

.bug-reporter-header h3 i {
  color: #ef4444;
}

.bug-reporter-close {
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s;
}

.bug-reporter-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #e5e7eb;
}

/* Formulaire */
.bug-reporter-form {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bug-reporter-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 0;
}

.bug-reporter-form label {
  font-size: 13px;
  font-weight: 500;
  color: #ffffff !important;
  margin-bottom: 0.375rem;
}

.bug-reporter-form .required {
  color: #ef4444;
}

.bug-reporter-form input[type="text"],
.bug-reporter-form input[type="url"],
.bug-reporter-form select,
.bug-reporter-form textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.1);
  color: #e5e7eb;
  transition: border-color 0.2s;
}

.bug-reporter-form select {
  color: #e5e7eb !important;
  background-color: rgba(255, 255, 255, 0.1) !important;
}

.bug-reporter-form select option {
  background: #1a1a2e !important;
  color: #e5e7eb !important;
  padding: 8px;
}

.bug-reporter-form select option:checked,
.bug-reporter-form select option:hover {
  background: #252540 !important;
  color: #ffffff !important;
}

.bug-reporter-form input::placeholder,
.bug-reporter-form textarea::placeholder {
  color: #9ca3af;
  opacity: 1;
}

.bug-reporter-form input[readonly] {
  background: rgba(255, 255, 255, 0.05);
  cursor: not-allowed;
  color: #9ca3af;
}

.bug-reporter-form input:focus,
.bug-reporter-form select:focus,
.bug-reporter-form textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

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

.bug-reporter-form .form-help {
  font-size: 12px;
  color: #9ca3af;
}

/* File input */
.file-input-wrapper {
  position: relative;
}

.file-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.file-input-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px;
  border: 2px dashed rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: #d1d5db;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
  font-weight: 500;
}

.file-input-label:hover {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.05);
  color: #3b82f6;
}

.file-input-label i {
  font-size: 16px;
}

.file-preview {
  margin-top: 8px;
}

.file-preview-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.file-preview-item img {
  max-width: 100px;
  max-height: 100px;
  border-radius: 4px;
  object-fit: cover;
}

.file-preview-name {
  font-size: 13px;
  color: #e5e7eb;
  font-weight: 500;
}

.file-preview-size {
  font-size: 12px;
  color: #9ca3af;
}

.file-preview-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ef4444;
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
}

.file-preview-remove:hover {
  transform: scale(1.1);
}

/* Actions */
.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.form-actions button {
  flex: 1;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
}

.bug-reporter-panel .btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
}

.bug-reporter-panel .btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.bug-reporter-panel .btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.bug-reporter-panel .btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #e5e7eb;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.bug-reporter-panel .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Le formulaire utilise toujours un thème sombre avec texte clair pour être visible dans tous les contextes */

/* Responsive */
@media (max-width: 768px) {
  /* Désactiver complètement le bug reporter sur mobile */
  .bug-reporter-container {
    display: none !important;
  }
  
  .bug-reporter-panel {
    width: 100vw;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height pour mobile */
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
    top: 0;
    transform: translateX(100%);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .bug-reporter-container.bug-reporter-open .bug-reporter-panel {
    transform: translateX(0);
  }
  
  .bug-reporter-tab {
    transform: translateY(-50%) rotate(-90deg);
    padding: 10px 20px;
    font-size: 12px;
  }
  
  .bug-reporter-form {
    padding-bottom: 20px;
    min-height: min-content;
  }
}

