/* Share · Holonet — Aubui extensions */

.aub-share {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--aub-bg);
  color: var(--aub-fg);
}

.aub-share-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--aub-border);
  background: color-mix(in srgb, var(--aub-bg) 92%, var(--aub-bg-muted));
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(8px);
}

.aub-share-top__brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: inherit;
  text-decoration: none;
}

.aub-share-top__brand img {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.aub-share-main {
  flex: 1;
  padding: 1.75rem 1rem 3rem;
  max-width: 40rem;
  margin: 0 auto;
  width: 100%;
}

.aub-share-main--wide {
  max-width: 48rem;
}

.aub-share-main > h1 {
  font-size: clamp(1.5rem, 3vw, 1.85rem);
  font-weight: 750;
  letter-spacing: -0.03em;
  margin: 0 0 0.25rem;
}

/* Drop zone */
.aub-drop {
  border: 2px dashed var(--aub-border);
  border-radius: 14px;
  padding: 2.25rem 1.25rem;
  text-align: center;
  cursor: pointer;
  color: var(--aub-fg-muted);
  transition: border-color 0.15s, background 0.15s;
  background: color-mix(in srgb, var(--aub-bg-muted) 55%, transparent);
}

.aub-drop:hover,
.aub-drop.is-drag {
  border-color: var(--aub-accent);
  background: color-mix(in srgb, var(--aub-accent) 8%, var(--aub-bg));
}

.aub-drop input[type=file] {
  display: none;
}

.aub-progress {
  margin-top: 1rem;
  display: none;
}

.aub-progress.is-on {
  display: block !important;
}

.aub-progress progress {
  width: 100%;
  height: 0.7rem;
  border-radius: 99px;
  overflow: hidden;
}

.aub-result {
  margin-top: 1rem;
  display: none;
  padding: 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--aub-border);
  background: var(--aub-bg-muted);
}

.aub-result.is-on {
  display: block;
}

/* Options */
.aub-share-options {
  margin-bottom: 1rem;
  border: 1px solid var(--aub-border);
  border-radius: 12px;
  background: var(--aub-bg-muted);
  overflow: hidden;
}

.aub-share-options > summary {
  cursor: pointer;
  padding: 0.65rem 0.9rem;
  font-weight: 650;
  list-style: none;
}

.aub-share-options > summary::-webkit-details-marker {
  display: none;
}

.aub-share-options__body {
  padding: 0 0.9rem 0.95rem;
}

.aub-share-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.aub-share-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
}

/* Destinataires */
.aub-share-recipients {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
  min-height: 0.25rem;
}

.aub-share-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  background: var(--aub-bg);
  font-size: 0.8125rem;
  font-weight: 550;
  border: 1px solid var(--aub-border);
}

.aub-share-chip.is-aubota {
  border-color: var(--aub-accent);
  background: color-mix(in srgb, var(--aub-accent) 12%, var(--aub-bg));
}

.aub-share-recipient-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.aub-share-recipient-input-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.aub-share-suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 30;
  margin-top: 0.25rem;
  background: var(--aub-bg);
  border: 1px solid var(--aub-border);
  border-radius: 10px;
  max-height: 220px;
  overflow: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.aub-share-suggest button {
  display: block;
  width: 100%;
  text-align: left;
  background: 0;
  border: 0;
  color: var(--aub-fg);
  padding: 0.55rem 0.75rem;
  cursor: pointer;
  font: inherit;
}

.aub-share-suggest button:hover {
  background: var(--aub-bg-muted);
}

/* Log transfert */
.aub-share-log {
  margin-top: 0.75rem;
  border: 1px solid var(--aub-border);
  border-radius: 10px;
  background: var(--aub-bg);
  font-size: 0.875rem;
}

.aub-share-log > summary {
  cursor: pointer;
  padding: 0.45rem 0.7rem;
  font-weight: 600;
}

.aub-share-log__body {
  max-height: calc(1.4em * 4 + 0.6rem);
  overflow-y: auto;
  padding: 0.35rem 0.7rem 0.55rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  line-height: 1.4;
  color: var(--aub-fg-muted);
  font-size: 0.8rem;
}

/* Preview */
.aub-preview-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 1.25rem 0;
  font-size: 0.875rem;
}

.aub-preview-meta div {
  background: var(--aub-bg-muted);
  border-radius: 10px;
  padding: 0.75rem;
  text-align: center;
}

.aub-preview-box {
  background: var(--aub-bg-muted);
  border-radius: 14px;
  padding: 1rem;
  text-align: center;
  margin-bottom: 1.25rem;
}

.aub-preview-box img,
.aub-preview-box video {
  max-width: 100%;
  border-radius: 10px;
}

.aub-preview-box--protected {
  user-select: none;
}

.aub-share-message {
  margin: 0.75rem 0 0;
  padding: 0.75rem 1rem;
  background: color-mix(in srgb, var(--aub-accent) 14%, var(--aub-bg));
  border-radius: 10px;
  font-size: 0.875rem;
  border-left: 3px solid var(--aub-accent);
}

/* Mes partages */
.aub-share-mine {
  list-style: none;
  padding: 0;
  margin: 0;
}

.aub-share-mine-item {
  display: block;
  padding: 1rem 0;
  border-bottom: 1px solid var(--aub-border);
}

.aub-share-mine-item:last-child {
  border-bottom: none;
}

.aub-share-mine-item__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
}

.aub-share-mine-item__link {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
}

.aub-share-mine-item__link .aub-input {
  flex: 1;
  min-width: 0;
  font-size: 0.8rem;
}

.aub-share-mine-item__stats {
  margin-bottom: 0.35rem;
}

.aub-share-mine-item__recipients {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0.35rem 0;
}

.aub-share-mine__badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  background: var(--aub-bg-muted);
  border: 1px solid var(--aub-border);
  white-space: nowrap;
}

.aub-share-mine__badge.is-used {
  background: color-mix(in srgb, var(--aub-accent) 16%, var(--aub-bg));
  color: var(--aub-accent);
  border-color: color-mix(in srgb, var(--aub-accent) 35%, var(--aub-border));
}

.aub-share-mine__badge.is-expired {
  opacity: 0.7;
}

.aub-share-mine__badge.is-exhausted {
  background: color-mix(in srgb, #f0a060 18%, var(--aub-bg));
  color: #e09050;
}

.aub-share-mine__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.aub-share-mine-filters {
  margin-bottom: 0.5rem;
}

/* Landing */
.aub-share-landing .aub-share-hero {
  text-align: center;
  padding: 3rem 1.25rem 2.5rem;
  max-width: 40rem;
  margin: 0 auto;
}

.aub-share-hero__eyebrow {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--aub-accent);
  margin-bottom: 0.75rem;
}

.aub-share-hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0 0 1rem;
}

.aub-share-hero__lead {
  color: var(--aub-fg-muted);
  font-size: 1.05rem;
  line-height: 1.5;
  margin: 0 0 1.5rem;
}

.aub-share-hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.aub-share-section {
  max-width: 52rem;
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

.aub-share-section h2 {
  text-align: center;
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 1.25rem;
}

.aub-share-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1rem;
}

.aub-share-grid h3 {
  font-size: 1rem;
  font-weight: 650;
  margin: 0 0 0.35rem;
}

.aub-share-grid p {
  margin: 0;
  font-size: 0.9rem;
}

.aub-share-steps {
  max-width: 28rem;
  margin: 0 auto;
  padding-left: 1.25rem;
  line-height: 1.7;
}

.aub-share-footer {
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: 0.8rem;
  color: var(--aub-fg-muted);
  border-top: 1px solid var(--aub-border);
}

.aub-share-footer a {
  color: inherit;
  text-decoration: underline;
}

@media (max-width: 520px) {
  .aub-share-options-grid {
    grid-template-columns: 1fr;
  }
  .aub-preview-meta {
    grid-template-columns: 1fr;
  }
  .aub-share-recipient-row {
    flex-wrap: wrap;
  }
}

/* Name + extension bubble */
.aub-share-name-split {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
}
.aub-share-ext-bubble {
  display: inline-flex;
  align-items: center;
  padding: 0 0.7rem;
  border-radius: 8px;
  background: var(--aub-bg-muted);
  border: 1px solid var(--aub-border);
  color: var(--aub-fg-muted);
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  user-select: none;
}

/* Modal / lightbox */
.aub-share-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.aub-share-modal[hidden] {
  display: none !important;
}
.aub-share-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}
.aub-share-modal__card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 26rem;
  max-height: 90vh;
  overflow: auto;
}

.aub-preview-meta {
  grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
}

/* Badges fallback si aubui absents */
.aub-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
}
.aub-badge--accent {
  background: color-mix(in srgb, var(--aub-accent) 20%, var(--aub-bg));
  color: var(--aub-accent);
}
.aub-badge--danger {
  background: color-mix(in srgb, #e85d5d 18%, var(--aub-bg));
  color: #e85d5d;
}

/* File rows (Holonet + preview + mes partages) */
.aub-share-file-rows {
  list-style: none;
  margin: 0;
  padding: 0;
}
.aub-share-file-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--aub-border);
  flex-wrap: wrap;
}
.aub-share-file-row.is-active {
  background: color-mix(in srgb, var(--aub-accent) 8%, transparent);
  border-radius: 8px;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
}
.aub-share-file-name {
  flex: 1;
  min-width: 8rem;
  font-size: 0.9rem;
  color: inherit;
  text-decoration: none;
  word-break: break-all;
}
.aub-share-file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.aub-share-file-check {
  display: flex;
  align-items: center;
}
.aub-file-status {
  width: 1.25rem;
  text-align: center;
  font-weight: 700;
}
.aub-file-status--ok { color: #3ecf8e; }
.aub-file-status--err { color: #e85d5d; }
.aub-file-status--spin {
  display: inline-block;
  animation: aub-spin 1s linear infinite;
  color: var(--aub-accent);
}
@keyframes aub-spin {
  to { transform: rotate(360deg); }
}

/* Mes partages — cartes Aubui */
.aub-share-mine {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.aub-share-mine-card {
  border: 1px solid var(--aub-border);
  border-radius: 14px;
  padding: 1rem 1.1rem !important;
  background: var(--aub-bg-muted);
  border-bottom: 1px solid var(--aub-border) !important;
}
.aub-share-mine-card:last-child {
  border-bottom: 1px solid var(--aub-border) !important;
}
.aub-share-file-pick:hover {
  color: var(--aub-accent);
}

.aub-pdf-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.aub-dl-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}
.aub-dl-icon svg {
  flex-shrink: 0;
}

/* Lightbox au-dessus de TOUT (nav AubotaNav incluse) */
.aub-share-modal {
  z-index: 2147483000 !important;
  position: fixed !important;
  inset: 0 !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  box-sizing: border-box;
}
.aub-share-modal[hidden] {
  display: none !important;
}
.aub-share-modal__backdrop {
  z-index: 0;
}
.aub-share-modal__card {
  z-index: 1;
  max-width: min(56rem, 96vw) !important;
  max-height: min(92vh, 100%) !important;
  overflow: auto;
  display: flex;
  flex-direction: column;
}
#preview-lb-body {
  flex: 1;
  min-height: 0;
  max-height: min(75vh, 100%);
  overflow: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
#preview-lb-body canvas {
  max-width: 100% !important;
  max-height: min(70vh, 100%) !important;
  width: auto !important;
  height: auto !important;
}

/* Mes partages — vue plus propre */
.aub-mine-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.aub-mine-card {
  border: 1px solid var(--aub-border);
  border-radius: 16px;
  background: var(--aub-bg);
  padding: 1.1rem 1.2rem;
  box-shadow: 0 1px 0 rgba(255,255,255,0.03);
}
.aub-mine-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}
.aub-mine-card__title {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
  word-break: break-word;
}
.aub-mine-card__meta {
  font-size: 0.8rem;
  color: var(--aub-fg-muted);
  margin-top: 0.2rem;
}
.aub-mine-card__link {
  display: flex;
  gap: 0.4rem;
  margin: 0.5rem 0;
}
.aub-mine-card__link .aub-input {
  font-size: 0.8rem;
}
.aub-mine-card__footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--aub-border);
}
.aub-tooltip-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.aub-tooltip-wrap[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  z-index: 20;
  max-width: 16rem;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  background: var(--aub-bg);
  border: 1px solid var(--aub-border);
  color: var(--aub-fg);
  font-size: 0.75rem;
  line-height: 1.35;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  white-space: normal;
}

.aub-preview-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  margin-top: 0.75rem;
}
.aub-preview-canvas {
  max-width: min(100%, 72vw) !important;
  max-height: min(58vh, 100%) !important;
}
.aub-dnd-row {
  cursor: grab;
}
.aub-dnd-row.is-dragging {
  opacity: 0.55;
}
.aub-dnd-row.is-dragover {
  outline: 2px dashed var(--aub-accent);
  outline-offset: 2px;
}

/* Aperçu strictement contenu dans la lightbox */
#preview-lightbox .aub-share-modal__card {
  max-width: min(40rem, 94vw) !important;
  max-height: min(88vh, 100%) !important;
  overflow: hidden;
}
#preview-lb-body {
  max-height: min(55vh, 70vw) !important;
  overflow: hidden !important;
  padding: 0.25rem;
}
#preview-lb-body canvas,
.aub-preview-canvas {
  max-width: 100% !important;
  max-height: min(50vh, 100%) !important;
  object-fit: contain !important;
}
.aub-folder-select {
  max-width: 7.5rem;
  font-size: 0.75rem;
  padding: 0.2rem 0.35rem;
}
.aub-folder-badge {
  font-size: 0.7rem;
  opacity: 0.9;
}

/* Tree dossiers / fichiers */
.aub-tree {
  margin: 0.5rem 0 1rem;
}
.aub-tree-folder {
  border: 1px solid var(--aub-border);
  border-radius: 10px;
  margin-bottom: 0.5rem;
  padding: 0.25rem 0.5rem 0.5rem;
  background: var(--aub-bg-muted);
}
.aub-tree-folder__sum {
  cursor: pointer;
  list-style: none;
  padding: 0.35rem 0;
  font-size: 0.95rem;
}
.aub-tree-folder__sum::-webkit-details-marker { display: none; }
.aub-tree-children {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0 0 0.75rem;
  min-height: 1.5rem;
}
.aub-tree-children.is-dragover {
  outline: 2px dashed var(--aub-accent);
  border-radius: 8px;
}
.aub-tree-file {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--aub-border);
}
.aub-tree-file:last-child { border-bottom: 0; }
.aub-tree-file.is-dragging { opacity: 0.5; }
.aub-tree-file__name { flex: 1; min-width: 8rem; font-size: 0.9rem; }
.aub-tree-file__actions { display: flex; gap: 0.3rem; }
.aub-tree-icon { margin-right: 0.2rem; }
.aub-tree-root-label { margin: 0.75rem 0 0.25rem; }
.aub-autosave-ok {
  color: var(--aub-accent);
  font-size: 0.8rem;
}

/* Chips destinataires — validation */
.aub-share-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  font-size: 0.85rem;
  border: 1px solid var(--aub-border);
  background: var(--aub-bg-muted);
}
.aub-share-chip.is-pending {
  border-color: color-mix(in srgb, var(--aub-accent) 35%, var(--aub-border));
}
.aub-share-chip.is-sent {
  border-color: #3ecf8e;
  background: color-mix(in srgb, #3ecf8e 16%, transparent);
  color: #b8f5d4;
}
.aub-share-chip.is-sent .aub-share-chip__status {
  color: #3ecf8e;
  font-weight: 800;
}
.aub-share-chip.is-error {
  border-color: #e85d5d;
  background: color-mix(in srgb, #e85d5d 14%, transparent);
}
.aub-share-chip.is-error .aub-share-chip__status {
  color: #e85d5d;
  font-weight: 800;
}
.aub-share-chip__remove {
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  line-height: 1;
  padding: 0 0.1rem;
  opacity: 0.75;
}
.aub-share-chip__remove:hover { opacity: 1; }

/* Nom long : scroll horizontal + bulle extension */
.aub-tree-file__name {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  flex: 1;
  max-width: 100%;
}
.aub-tree-file__scroll {
  min-width: 0;
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 12rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.aub-tree-file__base {
  display: inline-block;
  white-space: nowrap;
  font-size: 0.9rem;
}
.aub-tree-file__ext {
  flex-shrink: 0;
  font-size: 0.75rem;
}
.aub-share-file-row .aub-share-name-split {
  flex: 1;
  min-width: 0;
  max-width: 14rem;
}
.aub-share-file-row .aub-share-name-split input {
  min-width: 0;
  overflow-x: auto;
}
