/* ── Reels Manager — hereda variables de igc-app si coexisten ─────────────── */
/* Fuentes — igual que canvas */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Variables (espejadas de canvas.css para consistencia) ──────────────── */
.rm-app {
  --igc-bg:        #f0f2f5;
  --igc-surface:   #ffffff;
  --igc-surface2:  #f5f6f8;
  --igc-surface3:  #ebedf0;
  --igc-border:    #dde1e7;
  --igc-border2:   #c8cdd6;
  --igc-text:      #1a1d23;
  --igc-text2:     #4a5060;
  --igc-muted:     #8a90a0;
  --igc-accent:    #5b5ef4;
  --igc-accent-h:  #4a4dd8;
  --igc-accent-lt: #eeeeff;
  --igc-danger:    #e53e3e;
  --igc-success:   #38a169;
  --igc-radius:    8px;
  --igc-topbar-h:  54px;
  --igc-shadow:    0 1px 3px rgba(0,0,0,.08),0 1px 2px rgba(0,0,0,.06);
  --igc-shadow-lg: 0 4px 16px rgba(0,0,0,.10);
}

/* ── Reset scoped ─────────────────────────────────────────────────────────── */
.rm-app *, .rm-app *::before, .rm-app *::after { box-sizing: border-box; margin: 0; padding: 0; }
.rm-app {
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 13px;
  color: var(--igc-text);
  background: var(--igc-bg);
  border-radius: 14px;
  overflow: hidden;
  /* Misma altura dinámica que igc-app */
  height: calc(100vh - 80px);
  min-height: 580px;
  max-height: 900px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 24px rgba(0,0,0,.10), 0 0 0 1px var(--igc-border);
}

/* ── Topbar — idéntico a igc-topbar ──────────────────────────────────────── */
.rm-topbar {
  height: var(--igc-topbar-h);
  background: var(--igc-surface);
  border-bottom: 1px solid var(--igc-border);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  flex-shrink: 0;
  box-shadow: 0 1px 0 var(--igc-border);
}

.rm-topbar__brand {
  display: flex; align-items: center; gap: 6px;
  font-weight: 700; font-size: 13px; color: var(--igc-text);
  white-space: nowrap; margin-right: 8px; flex-shrink: 0;
}
.rm-topbar__brand svg { color: var(--igc-accent); }

/* Tabs en la topbar — igual que igc-btn--format */
.rm-topbar__tabs { display: flex; gap: 2px; flex: 1; justify-content: center; }
.rm-tab {
  display: inline-flex; align-items: center; gap: 5px;
  background: transparent; color: var(--igc-muted);
  border: 1.5px solid transparent;
  padding: 5px 12px; border-radius: 4px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: all .14s; white-space: nowrap; font-family: inherit;
}
.rm-tab:hover { background: var(--igc-surface2); color: var(--igc-text2); }
.rm-tab.active { background: var(--igc-surface); color: var(--igc-accent); border-color: var(--igc-accent); }
.rm-tab svg { stroke: currentColor; flex-shrink: 0; }

.rm-topbar__right { display: flex; align-items: center; gap: 6px; margin-left: 8px; flex-shrink: 0; }
.rm-client-label { font-size: 11px; color: var(--igc-muted); }

/* ── Body ─────────────────────────────────────────────────────────────────── */
.rm-body { flex: 1; overflow: hidden; position: relative; }

/* ── Panels ───────────────────────────────────────────────────────────────── */
.rm-panel {
  display: none; height: 100%; overflow-y: auto; padding: 14px;
}
.rm-panel.active { display: block; }
.rm-panel::-webkit-scrollbar { width: 4px; }
.rm-panel::-webkit-scrollbar-thumb { background: var(--igc-border); border-radius: 2px; }

/* ── Section label — igual que igc-section-label ─────────────────────────── */
.rm-section-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--igc-muted); margin: 0 0 8px;
  display: flex; align-items: center; gap: 6px;
}

.rm-divider {
  height: 1px; background: var(--igc-border); margin: 14px 0;
}

/* ── Fields — idénticos a igc-field ──────────────────────────────────────── */
.rm-field { margin-bottom: 8px; }
.rm-field label {
  display: block; font-size: 10px; color: var(--igc-muted);
  margin-bottom: 3px; font-weight: 600;
}
.rm-field input[type="text"],
.rm-field select,
.rm-field textarea,
.rm-field__input {
  width: 100%; background: var(--igc-surface2); border: 1.5px solid var(--igc-border);
  border-radius: 4px; color: var(--igc-text); font-size: 12px; padding: 6px 8px;
  outline: none; transition: border-color .14s; font-family: inherit;
}
.rm-field input:focus, .rm-field select:focus, .rm-field textarea:focus,
.rm-field__input:focus { border-color: var(--igc-accent); background: #fff; box-shadow: 0 0 0 3px rgba(91,94,244,.10); }
.rm-field textarea { resize: vertical; min-height: 48px; }
.rm-field__input--mono { font-family: monospace; font-size: 11px; }
.rm-field-row { display: flex; gap: 8px; flex-wrap: wrap; }
.rm-field--sm { flex: 0 0 180px; min-width: 140px; }
.rm-field--inline { display: flex; align-items: center; gap: 8px; margin: 0; }
.rm-field--inline label { white-space: nowrap; margin: 0; }
.rm-field--inline select { margin: 0; width: auto; }
select option { background: #fff; }

/* ── Buttons — idénticos a igc-btn ───────────────────────────────────────── */
.rm-btn {
  display: inline-flex; align-items: center; gap: 5px;
  border: none; border-radius: 4px; cursor: pointer;
  font-size: 12px; font-weight: 500; transition: all .14s;
  white-space: nowrap; font-family: inherit; text-decoration: none;
}
.rm-btn--primary { background: var(--igc-accent); color: #fff; padding: 7px 14px; }
.rm-btn--primary:hover { background: var(--igc-accent-h); transform: translateY(-1px); box-shadow: 0 3px 10px rgba(91,94,244,.30); }
.rm-btn--ghost {
  background: var(--igc-surface); color: var(--igc-text2);
  border: 1px solid var(--igc-border); padding: 6px 12px;
}
.rm-btn--ghost:hover { background: var(--igc-surface2); border-color: var(--igc-border2); color: var(--igc-text); }
.rm-btn--danger { background: #fff5f5; color: var(--igc-danger); border: 1px solid #fed7d7; padding: 5px 10px; }
.rm-btn--danger:hover { background: #fed7d7; }
.rm-btn--sm { padding: 5px 10px; font-size: 11px; }
.rm-btn--full { width: 100%; justify-content: center; padding: 8px; }

/* ── Upload Form ──────────────────────────────────────────────────────────── */
.rm-upload-form { background: var(--igc-surface); border: 1.5px solid var(--igc-border); border-radius: 4px; padding: 12px; margin-bottom: 14px; }

/* ── Dropzone ─────────────────────────────────────────────────────────────── */
.rm-dropzone {
  border: 1.5px dashed var(--igc-border);
  border-radius: 4px;
  padding: 28px 16px;
  text-align: center;
  transition: border-color .15s, background .15s;
  cursor: default;
  margin-bottom: 4px;
}
.rm-dropzone.dragover {
  border-color: var(--igc-accent);
  background: var(--igc-accent-lt);
}
.rm-drop-title { font-weight: 600; font-size: 13px; margin-bottom: 4px; color: var(--igc-text2); }
.rm-drop-sub { font-size: 11px; color: var(--igc-muted); margin-bottom: 12px; }

/* ── Badge ────────────────────────────────────────────────────────────────── */
.rm-badge {
  background: var(--igc-accent); color: #fff; font-size: 10px; font-weight: 700;
  padding: 1px 7px; border-radius: 99px; margin-left: 4px;
}

/* ── Queue grid ───────────────────────────────────────────────────────────── */
.rm-queue-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(200px,1fr)); gap: 10px; }

/* ── Queue card ───────────────────────────────────────────────────────────── */
.rm-queue-card {
  background: var(--igc-surface); border: 1.5px solid var(--igc-border); border-radius: 4px;
  overflow: hidden; position: relative;
}
.rm-queue-card__thumb {
  position: relative; aspect-ratio: 9/16; max-height: 220px; background: var(--igc-surface3); overflow: hidden;
}
.rm-queue-card__thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.rm-queue-card__thumb .rm-queue-rm {
  position: absolute; top: 6px; right: 6px;
  width: 22px; height: 22px; border-radius: 3px;
  background: rgba(0,0,0,.55); border: none; color: rgba(255,255,255,.8);
  font-size: 11px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .13s;
}
.rm-queue-card__thumb .rm-queue-rm:hover { background: var(--igc-danger); color: #fff; }
.rm-queue-card__body { padding: 8px 8px 6px; }
.rm-queue-card__body input[type="text"],
.rm-queue-card__body select {
  width: 100%; background: var(--igc-surface2); border: 1.5px solid var(--igc-border);
  border-radius: 4px; color: var(--igc-text); font-size: 11px; padding: 5px 7px;
  outline: none; transition: border-color .14s; font-family: inherit; margin-bottom: 5px;
}
.rm-queue-card__body input:focus, .rm-queue-card__body select:focus { border-color: var(--igc-accent); }
.rm-queue-card__meta { font-size: 10px; color: var(--igc-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-queue-card__status { display: flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 600; margin-top: 4px; }
.rm-status--ok { color: var(--igc-success); }
.rm-status--uploading { color: var(--igc-accent); }
.rm-status--error { color: var(--igc-danger); }

/* Progress bar */
.rm-progress { height: 3px; background: var(--igc-border); margin-top: 5px; border-radius: 99px; overflow: hidden; display: none; }
.rm-progress.active { display: block; }
.rm-progress__bar { height: 100%; background: var(--igc-accent); width: 0; transition: width .3s; border-radius: 99px; }

/* ── Library ──────────────────────────────────────────────────────────────── */
.rm-library-top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.rm-lib-day-group { margin-bottom: 20px; }
.rm-lib-day-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
  padding-bottom: 8px; border-bottom: 1px solid var(--igc-border);
}
.rm-lib-day-bar { width: 3px; height: 16px; background: var(--igc-accent); border-radius: 2px; flex-shrink: 0; }
.rm-lib-day-name { font-weight: 700; font-size: 13px; }
.rm-lib-day-count {
  background: var(--igc-accent-lt); color: var(--igc-accent);
  font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 4px;
  border: 1px solid rgba(91,94,244,.2);
}
.rm-lib-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(160px,1fr)); gap: 8px; }

/* Reel card biblioteca — igc-tpl-card style */
.rm-lib-card {
  background: var(--igc-surface2); border: 1.5px solid var(--igc-border); border-radius: 4px;
  cursor: pointer; overflow: hidden; transition: all .15s; box-shadow: var(--igc-shadow);
}
.rm-lib-card:hover { border-color: var(--igc-accent); box-shadow: 0 4px 14px rgba(91,94,244,.22); transform: translateY(-2px); }
.rm-lib-card__thumb { position: relative; aspect-ratio: 9/16; max-height: 200px; background: var(--igc-surface3); overflow: hidden; }
.rm-lib-card__thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.rm-lib-card__thumb .rm-lib-play {
  position: absolute; inset: 0; background: rgba(0,0,0,.3);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .14s;
}
.rm-lib-card:hover .rm-lib-play { opacity: 1; }
.rm-lib-play-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,.2); border: 1.5px solid rgba(255,255,255,.5);
  display: flex; align-items: center; justify-content: center;
}
.rm-lib-play-btn svg { fill: #fff; width: 14px; height: 14px; margin-left: 2px; }
.rm-lib-fmt { position: absolute; top: 6px; left: 6px; background: var(--igc-accent); color: #fff; font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 3px; text-transform: uppercase; }
.rm-lib-card__info { padding: 7px 8px 6px; }
.rm-lib-card__name { font-weight: 600; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 2px; }
.rm-lib-card__meta { font-size: 10px; color: var(--igc-muted); display: flex; justify-content: space-between; }
.rm-lib-card__actions { padding: 0 8px 8px; display: flex; gap: 4px; }
.rm-lib-card__actions .rm-btn { flex: 1; justify-content: center; font-size: 10px; padding: 4px 6px; }

/* ── Links tab ────────────────────────────────────────────────────────────── */
.rm-share-form { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 0; flex-wrap: wrap; }
.rm-link-row {
  background: var(--igc-surface); border: 1.5px solid var(--igc-border); border-radius: 4px;
  padding: 10px 12px; margin-bottom: 8px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.rm-link-row:hover { border-color: var(--igc-border2); }
.rm-link-info { flex: 1; min-width: 0; }
.rm-link-folder { font-weight: 600; font-size: 12px; margin-bottom: 2px; }
.rm-link-meta { font-size: 10px; color: var(--igc-muted); }
.rm-link-url-row { display: flex; gap: 6px; align-items: center; flex: 2; min-width: 200px; }
.rm-link-url-row input { flex: 1; background: var(--igc-surface2); border: 1.5px solid var(--igc-border); border-radius: 4px; font-size: 11px; padding: 5px 8px; color: var(--igc-text); outline: none; font-family: monospace; }

/* ── Empty ────────────────────────────────────────────────────────────────── */
.rm-empty {
  text-align: center; padding: 32px; color: var(--igc-muted); font-size: 12px;
  background: var(--igc-surface2); border: 1.5px dashed var(--igc-border); border-radius: 4px;
}

/* ── Modal ────────────────────────────────────────────────────────────────── */
.rm-modal {
  display: none; position: fixed; inset: 0; z-index: 999999;
  align-items: center; justify-content: center;
}
.rm-modal.open { display: flex; }
.rm-modal__backdrop {
  position: absolute; inset: 0; background: rgba(26,29,35,.75); backdrop-filter: blur(4px);
}
.rm-modal__box {
  position: relative; z-index: 1;
  background: var(--igc-surface); border: 1px solid var(--igc-border); border-radius: 12px;
  padding: 20px; max-width: 480px; width: 92%;
  box-shadow: var(--igc-shadow-lg);
}
.rm-modal__box--video { max-width: 420px; }
.rm-modal__header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px; font-weight: 700; font-size: 14px;
}
.rm-modal__close {
  background: var(--igc-surface2); border: 1px solid var(--igc-border); border-radius: 4px;
  color: var(--igc-muted); width: 28px; height: 28px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
  transition: all .13s;
}
.rm-modal__close:hover { background: var(--igc-surface3); color: var(--igc-text); }
.rm-modal__sub { font-size: 12px; color: var(--igc-text2); margin-bottom: 12px; }
