/* app.css v3 — Ralfe Media 2.0 — mesmo padrão infobip */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg:           #0d0d14;
  --surface:      #13131f;
  --surface2:     #181826;
  --surface3:     #1e1e2e;
  --border:       #2a2a3e;
  --border2:      #363650;
  --accent:       #7c3aed;
  --accent2:      #9b6dff;
  --accent-dim:   rgba(124,58,237,0.12);
  --orange:       #f97316;
  --orange-h:     #ea6c0a;
  --orange-dim:   rgba(249,115,22,0.12);
  --green:        #10b981;
  --green-dim:    rgba(16,185,129,0.08);
  --green-border: rgba(16,185,129,0.2);
  --red:          #ef4444;
  --red-dim:      rgba(239,68,68,0.08);
  --amber:        #f59e0b;
  --amber-dim:    rgba(245,158,11,0.1);
  --text:         #e8e8f0;
  --text2:        #9090b0;
  --text3:        #55556a;
  --mono:         'JetBrains Mono', monospace;
  --r:            12px;
  --r-sm:         8px;
  --shadow:       0 4px 24px rgba(0,0,0,0.5);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background-image: radial-gradient(ellipse 80% 40% at 50% -10%, rgba(124,58,237,0.08) 0%, transparent 60%);
}

/* ── HEADER ── */
.header {
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: 58px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  z-index: 100;
}
.header-inner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.header-logo { display: flex; align-items: center; gap: 8px; }
.logo-icon   { font-size: 20px; }
.logo-text   { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
.logo-version {
  font-size: 10px; font-weight: 700;
  background: var(--accent-dim);
  color: var(--accent2);
  padding: 2px 8px; border-radius: 99px;
  border: 1px solid rgba(155,109,255,0.25);
}
.header-right { display: flex; align-items: center; gap: 8px; }

.filter-tabs { display: flex; gap: 4px; }
.tab {
  padding: 6px 16px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text2);
  font-size: 13px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
}
.tab:hover  { border-color: var(--border2); color: var(--text); }
.tab.active { background: var(--accent-dim); border-color: var(--accent2); color: var(--accent2); font-weight: 600; }

.icon-btn {
  width: 34px; height: 34px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.icon-btn:hover { background: var(--surface3); color: var(--text); border-color: var(--border2); }
.logout-btn:hover { border-color: var(--red); color: var(--red); background: var(--red-dim); }

/* ── LAYOUT ── */
.layout { flex: 1; display: flex; overflow: hidden; }

/* ── LEFT PANEL ── */
.left-panel {
  width: 300px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* DROP ZONE */
.drop-zone {
  border: 1.5px dashed var(--border2);
  border-radius: var(--r);
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--surface2);
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent2);
  background: var(--accent-dim);
}
.drop-icon   { color: var(--text3); margin-bottom: 10px; }
.drop-title  { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.drop-sub    { font-size: 12px; color: var(--text2); }

/* FILE CHOSEN */
.file-chosen {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  padding: 10px 12px;
}
.file-chosen-icon { font-size: 20px; flex-shrink: 0; }
.file-chosen-info { flex: 1; min-width: 0; }
.file-chosen-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-chosen-size { font-size: 11px; color: var(--text2); margin-top: 2px; }
.clear-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text3); font-size: 14px; padding: 2px 4px;
  flex-shrink: 0; transition: color 0.15s;
}
.clear-btn:hover { color: var(--red); }

/* SIZE WARNING */
.size-warning {
  background: var(--amber-dim);
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  font-size: 12px;
  color: var(--amber);
  line-height: 1.5;
}

/* SEND BUTTON */
.send-btn {
  width: 100%;
  padding: 12px;
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: var(--r);
  font-size: 15px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all 0.18s;
  box-shadow: 0 3px 12px rgba(249,115,22,0.3);
}
.send-btn:hover:not(:disabled) { background: var(--orange-h); box-shadow: 0 4px 16px rgba(249,115,22,0.45); transform: translateY(-1px); }
.send-btn:active:not(:disabled) { transform: scale(0.98); }
.send-btn:disabled { opacity: 0.35; cursor: not-allowed; box-shadow: none; }
.send-btn.sending  { opacity: 0.7; cursor: not-allowed; }

/* COMPRESS BUTTON */
.compress-btn {
  width: 100%;
  padding: 11px;
  background: var(--amber-dim);
  color: var(--amber);
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
}
.compress-btn:hover { background: rgba(245,158,11,0.18); }
.compress-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* PROGRESS */
.progress-wrap { }
.progress-label {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--text2); margin-bottom: 6px;
  font-family: var(--mono);
}
.progress-track {
  height: 5px; background: var(--surface3);
  border-radius: 99px; overflow: hidden;
  border: 1px solid var(--border);
}
.progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--orange), #fb923c);
  border-radius: 99px;
  transition: width 0.25s ease;
}

/* RESULT BOX */
.result-box {
  background: var(--green-dim);
  border: 1px solid var(--green-border);
  border-radius: var(--r);
  padding: 14px;
}
.result-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.result-check  { font-size: 18px; }
.result-title  { font-size: 14px; font-weight: 600; color: var(--green); }

.result-url-wrap {
  display: flex; align-items: center; gap: 6px;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 7px 10px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.result-url-wrap:hover { border-color: var(--green-border); }
.result-url {
  flex: 1; min-width: 0;
  font-size: 11px; color: var(--text2);
  font-family: var(--mono);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.copy-inline-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text3); flex-shrink: 0;
  padding: 2px; transition: color 0.15s;
}
.copy-inline-btn:hover { color: var(--green); }

.result-actions { display: flex; gap: 8px; }
.btn-open, .btn-copy {
  flex: 1; padding: 8px 10px;
  border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: all 0.15s;
}
.btn-open {
  background: transparent; color: var(--text2);
  border: 1px solid var(--border2);
}
.btn-open:hover { background: var(--surface3); color: var(--text); }
.btn-copy {
  background: var(--green); color: #fff; border: none;
}
.btn-copy:hover { opacity: 0.85; }

/* FORMATS INFO */
.formats-info {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.formats-title {
  font-size: 10px; color: var(--text3);
  text-transform: uppercase; letter-spacing: 0.8px;
  margin-bottom: 8px; font-weight: 700;
}
.formats-list { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }
.fmt-badge {
  font-size: 10px; font-weight: 700;
  padding: 3px 8px; border-radius: 5px;
}
.fmt-badge.img { background: var(--accent-dim); color: var(--accent2); border: 1px solid rgba(155,109,255,0.2); }
.fmt-badge.vid { background: var(--amber-dim); color: var(--amber); border: 1px solid rgba(245,158,11,0.2); }

/* ── RIGHT PANEL ── */
.right-panel {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.gallery-header {
  display: flex; align-items: center;
  justify-content: space-between; flex-shrink: 0;
}
.gallery-title {
  font-size: 16px; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
.gallery-count { font-size: 12px; color: var(--text3); font-weight: 400; }

.load-more-btn {
  padding: 7px 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--text2);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.load-more-btn:hover { background: var(--surface2); color: var(--text); border-color: var(--accent2); }

/* GRID */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  align-content: start;
}
.grid-state {
  grid-column: 1 / -1;
  display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 4rem 0; color: var(--text2); font-size: 14px;
}
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border2);
  border-top-color: var(--accent2);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── MEDIA CARD ── */
.media-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
  cursor: default;
}
.media-card:hover {
  border-color: var(--border2);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

/* PREVIEW */
.card-preview {
  position: relative;
  width: 100%; aspect-ratio: 16/9;
  background: var(--surface3); overflow: hidden;
}
.card-preview img, .card-preview video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.card-preview .play-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.35);
  opacity: 0; transition: opacity 0.2s; pointer-events: none;
}
.card-preview:hover .play-overlay { opacity: 1; }
.play-btn-circle {
  width: 42px; height: 42px;
  background: rgba(255,255,255,0.9);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.type-badge {
  position: absolute; top: 7px; left: 7px;
  font-size: 9px; font-weight: 700; letter-spacing: 0.08em;
  padding: 2px 8px; border-radius: 99px;
}
.type-badge.IMAGE { background: rgba(155,109,255,0.9); color: #fff; }
.type-badge.VIDEO { background: rgba(249,115,22,0.92); color: #fff; }

/* CARD BODY */
.card-body { padding: 11px 12px; }
.card-meta {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--text2); margin-bottom: 5px;
}
.card-date { font-size: 11px; color: var(--text3); margin-bottom: 8px; }

.card-url {
  font-size: 10px; font-family: var(--mono);
  color: var(--text3);
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 5px 8px; margin-bottom: 9px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; transition: border-color 0.15s, color 0.15s;
}
.card-url:hover { border-color: var(--border2); color: var(--text2); }

/* CARD ACTIONS */
.card-actions { display: flex; gap: 6px; }
.card-btn {
  flex: 1; padding: 7px 8px;
  border-radius: var(--r-sm);
  font-size: 12px; font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  transition: all 0.15s; white-space: nowrap;
}
.card-btn-open {
  background: transparent; color: var(--text2);
  border: 1px solid var(--border2);
}
.card-btn-open:hover { background: var(--surface3); color: var(--text); }
.card-btn-copy {
  background: var(--accent); color: #fff; border: none;
}
.card-btn-copy:hover { background: #6d28d9; }
.card-btn-del {
  flex: 0; padding: 7px 9px;
  background: transparent; color: var(--text3);
  border: 1px solid var(--border);
}
.card-btn-del:hover { background: var(--red-dim); color: var(--red); border-color: var(--red); }

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 20px; right: 20px; z-index: 9999;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  padding: 11px 18px; font-size: 13px;
  box-shadow: var(--shadow);
  animation: toastIn 0.2s ease;
  max-width: 300px;
}
.toast.success { border-color: rgba(16,185,129,0.4); color: var(--green); }
.toast.error   { border-color: rgba(239,68,68,0.4); color: var(--red); }
@keyframes toastIn { from { opacity:0; transform: translateY(8px); } }

.hidden { display: none !important; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  body { overflow: auto; }
  .layout { flex-direction: column; overflow: visible; }
  .left-panel { width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
  .right-panel { overflow: visible; }
  .filter-tabs { display: none; }
  .media-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
@media (max-width: 480px) {
  .media-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .header { padding: 0 1rem; }
  .right-panel { padding: 1rem; }
  .toast { left: 1rem; right: 1rem; bottom: 1rem; }
}

/* ── AJUSTES SIDEBAR ── */
.left-panel { width: 280px; }
:root { --orange: #f97316; --orange-h: #ea6c0a; --red: #ef4444; --red-dim: rgba(239,68,68,0.08); --accent2: #9b6dff; }
