/* Global wrapper */
.ifd-auth-wrap,
.ifd-dashboard {
  max-width: 1100px;
  margin: 32px auto;
  padding: 0 16px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #111827;
}

/* Alerts */
.ifd-alert {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 14px;
}
.ifd-alert-error {
  background: #fff1f0;
  border: 1px solid #ffccc7;
  color: #a8071a;
}
.ifd-alert-warning {
  background: #fffbe6;
  border: 1px solid #ffe58f;
  color: #614700;
}

/* Auth */
.ifd-auth-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}
.ifd-auth-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
}
.ifd-auth-card h2 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 18px;
}

/* Fields */
.ifd-field {
  margin-bottom: 16px;
}

.ifd-field label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 14px;
  color: #111827;
}

/* Inputs / textarea / select de base */
.ifd-field input,
.ifd-field select,
.ifd-field textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #d4d4d8;
  font-size: 14px;
  outline: none;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background-color 0.2s ease,
    transform 0.08s ease;
  background-color: #ffffff;
  color: #111827;
}

.ifd-field input:focus,
.ifd-field select:focus,
.ifd-field textarea:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.18);
}

/* Textarea */
.ifd-field textarea {
  resize: vertical;
  min-height: 120px;
}

/* Checkbox / inline label */
.ifd-field.ifd-inline label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Select générique (utile ailleurs si besoin) */
.ifd-field select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 32px;
  background-color: #ffffff;
  background-image:
    linear-gradient(45deg, transparent 50%, #9ca3af 50%),
    linear-gradient(135deg, #9ca3af 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 13px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.ifd-field select:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.22);
}

/* Mobile : un peu plus compact */
@media (max-width: 480px) {
  .ifd-field input,
  .ifd-field select,
  .ifd-field textarea {
    padding: 9px 10px;
    font-size: 13px;
  }
}

/* Buttons */
.ifd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  background: #e4e4e7;
  color: #111827;
  transition: background 0.2s, transform 0.1s, box-shadow 0.1s, opacity 0.1s;
  text-decoration: none;
}
.ifd-btn-primary {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #ffffff;
  box-shadow: 0 10px 25px rgba(79, 70, 229, 0.35);
}
.ifd-btn-secondary {
  background: #f4f4f5;
  color: #111827;
  border: 1px solid #e4e4e7;
}
.ifd-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.18);
}
.ifd-btn:active {
  transform: translateY(0);
  box-shadow: none;
}
.ifd-btn[disabled],
.ifd-btn.ifd-btn-loading {
  opacity: 0.75;
  cursor: default;
  box-shadow: none;
}

/* Dashboard */
.ifd-dashboard-header h2 {
  margin-bottom: 4px;
  font-size: 22px;
}
.ifd-dashboard-header p {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 14px;
  color: #4b5563;
}

.ifd-dashboard-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 20px 0 10px;
}
.ifd-summary-card {
  background: #f9fafb;
  color: #111827;
  border-radius: 14px;
  padding: 14px 16px;
  border: 1px solid #e5e7eb;
}
.ifd-summary-label {
  font-size: 13px;
  opacity: 0.9;
}
.ifd-summary-value {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 22px;
  font-weight: 600;
  margin-top: 2px;
}
.ifd-summary-sub {
  font-size: 13px;
  color: #4b5563;
}

/* Progress bar */
.ifd-progress {
  margin-top: 8px;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}
.ifd-progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #22c55e, #4ade80);
}

/* Usage info */
.ifd-usage-info {
  font-size: 13px;
  color: #4b5563;
  margin-bottom: 18px;
}

/* Stats grid */
.ifd-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.ifd-stat-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 14px 14px 16px;
  border: 1px solid #e5e7eb;
}
.ifd-stat-card h4 {
  margin: 0 0 8px;
  font-size: 15px;
}
.ifd-stat-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.ifd-stat-list li {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
}
.ifd-stat-label {
  color: #111827;
}
.ifd-stat-value {
  font-weight: 500;
  color: #4b5563;
}
.ifd-stat-empty {
  font-size: 13px;
  color: #6b7280;
}
.ifd-stat-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.ifd-stat-note {
  margin-top: 8px;
  font-size: 12px;
  color: #6b7280;
}
.ifd-stat-text {
  font-size: 13px;
  color: #374151;
}

/* Grid panels */
.ifd-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.25fr);
  gap: 24px;
}
@media (max-width: 900px) {
  .ifd-dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.ifd-panel {
  background: #ffffff;
  border-radius: 14px;
  padding: 18px 16px 20px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}
.ifd-panel h3 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 17px;
}

/* Tags / Symboles principaux – version pill buttons */
.ifd-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.ifd-tag {
  position: relative;
  display: inline-flex;
}

/* On cache la checkbox / radio native, mais on la laisse accessible */
.ifd-tag input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* Le pill visuel */
.ifd-tag span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  border-radius: 999px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  font-size: 13px;
  font-weight: 500;
  color: #111827;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.08s ease;
}

/* Groupe de pills pour "Type de rêve" */
.ifd-tags-mood {
  margin-top: 6px;
  margin-bottom: 4px;
}

.ifd-tag-mood span {
  font-weight: 600;
}

/* Hover: léger effet bouton */
.ifd-tag:hover span {
  background: #e5e7eb;
  border-color: #d4d4d8;
}

/* État sélectionné (checkbox ou radio cochée) */
.ifd-tag input:checked + span {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(79, 70, 229, 0.35);
  transform: translateY(-1px);
}

/* Focus clavier (accessibilité) */
.ifd-tag input:focus-visible + span {
  box-shadow: 0 0 0 2px #e0e7ff, 0 0 0 4px rgba(79, 70, 229, 0.7);
}

/* Mobile : resserrer un peu pour éviter que ça déborde trop */
@media (max-width: 480px) {
  .ifd-tag span {
    padding: 5px 10px;
    font-size: 12px;
  }
}

/* Chips */
.ifd-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  background: #4f46e5;
  color: #f9fafb;
  margin-right: 6px;
}
.ifd-chip-outline {
  background: transparent;
  border: 1px solid #e4e4e7;
  color: #111827;
}

/* Dream list */
.ifd-dream-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.ifd-dream-card {
  border-radius: 12px;
  padding: 14px 14px 16px;
  border: 1px solid #e4e4e7;
  background: #f9fafb;
}
.ifd-dream-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  flex-wrap: wrap;
}
.ifd-dream-header h4 {
  margin: 0;
  font-size: 15px;
}
.ifd-dream-date {
  font-size: 12px;
  color: #6b7280;
}
.ifd-dream-excerpt {
  margin: 8px 0 8px;
  font-size: 13px;
  color: #374151;
}
.ifd-dream-meta {
  margin-bottom: 6px;
}

/* Dream AI details */
.ifd-dream-ai-details {
  margin-top: 6px;
  font-size: 13px;
}
.ifd-dream-ai-details > summary {
  cursor: pointer;
  list-style: none;
  font-weight: 500;
  color: #4f46e5;
}
.ifd-dream-ai-details > summary::-webkit-details-marker {
  display: none;
}
.ifd-dream-ai-details > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 6px;
  font-size: 11px;
  transform: translateY(-1px);
}
.ifd-dream-ai-details[open] > summary::before {
  content: "▾";
}
.ifd-dream-ai {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #d4d4d8;
  font-size: 13px;
  color: #111827;
}
.ifd-dream-ai p {
  margin: 0;
  white-space: pre-wrap;
}

/* AI wait message */
.ifd-ai-wait {
  margin-top: 6px;
  font-size: 12px;
  color: #4b5563;
}

/* Pagination */
.ifd-pagination {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.ifd-page-link {
  font-size: 13px;
  color: #4f46e5;
  text-decoration: none;
}
.ifd-page-link:hover {
  text-decoration: underline;
}
.ifd-page-link-right {
  margin-left: auto;
}

/* Admin styling simple */
.ifd-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 20px 0;
}
.ifd-admin-card {
  background: #ffffff;
  border-radius: 10px;
  padding: 14px 16px;
  border: 1px solid #e5e7eb;
}
.ifd-admin-big {
  margin: 6px 0 0;
  font-size: 22px;
  font-weight: 600;
}

/* Responsiveness */
@media (max-width: 640px) {
  .ifd-auth-card,
  .ifd-panel {
    padding: 16px 14px;
  }

  .ifd-dashboard-header h2 {
    font-size: 20px;
  }

  .ifd-summary-card {
    padding: 12px 12px;
  }

  .ifd-summary-value {
    font-size: 18px;
  }
}
