/**
 * campaign-clipboard.css — Prancheta de Campanhas
 * Dog-ear + FAB + Bottom Sheet + Toast
 * @version 1.0.0
 */

/* ═══════════════════════════════════════
   DOG-EAR (orelha dobrada no card)
   ═══════════════════════════════════════ */

.dog-ear {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 5;
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s;
}
.dog-ear:active { transform: scale(1.2); }

/* Triângulo — estado normal (sutil) */
.dog-ear::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 32px 32px 0;
  border-color: transparent rgba(148, 163, 184, 0.25) transparent transparent;
  transition: border-color 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              filter 0.3s;
  border-radius: 0 0.95rem 0 0;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.06));
}

/* Ícone dentro (pequeno clip/bookmark) */
.dog-ear::after {
  content: '';
  position: absolute;
  top: 5px;
  right: 5px;
  width: 10px;
  height: 10px;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' fill='%2394a3b8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 2.5A1.5 1.5 0 014.5 1h7A1.5 1.5 0 0113 2.5v12.207a.5.5 0 01-.777.416L8 12.118l-4.223 3.005A.5.5 0 013 14.707V2.5z'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  transition: background-image 0.3s, transform 0.3s;
  transform: rotate(0deg);
}

/* Hover */
.dog-ear:hover::before {
  border-color: transparent rgba(34, 197, 94, 0.4) transparent transparent;
}

/* ATIVO — orelha dobrada (salvo na prancheta) */
.dog-ear--active::before {
  border-color: transparent #22c55e transparent transparent;
  filter: drop-shadow(-1px 1px 3px rgba(34, 197, 94, 0.35));
}
.dog-ear--active::after {
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' fill='%23ffffff' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 2.5A1.5 1.5 0 014.5 1h7A1.5 1.5 0 0113 2.5v12.207a.5.5 0 01-.777.416L8 12.118l-4.223 3.005A.5.5 0 013 14.707V2.5z'/%3E%3C/svg%3E");
  transform: rotate(-8deg);
}
.dog-ear--active:hover::before {
  border-color: transparent #16a34a transparent transparent;
}

/* Animação ao salvar */
@keyframes dogEarFold {
  0%   { border-width: 0 0 0 0; }
  50%  { border-width: 0 38px 38px 0; }
  100% { border-width: 0 32px 32px 0; }
}
.dog-ear--active::before {
  animation: dogEarFold 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Card colapsado: dog-ear acima do overlay */
.campaign-card.collapsed .dog-ear {
  z-index: 12;
}

/* ═══════════════════════════════════════
   FAB (Floating Action Button)
   ═══════════════════════════════════════ */

.clip-fab {
  position: fixed;
  bottom: 90px;
  right: 16px;
  z-index: 900;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  box-shadow: 0 4px 16px -4px rgba(22, 163, 74, 0.5),
              0 2px 4px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, opacity 0.3s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.clip-fab:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 20px -4px rgba(22, 163, 74, 0.6),
              0 3px 8px rgba(0,0,0,0.12);
}
.clip-fab:active { transform: scale(0.95); }

.clip-fab--empty {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.7);
}
.clip-fab--has-items {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.clip-fab__icon {
  width: 24px;
  height: 24px;
  stroke: #fff;
  fill: none;
}

/* Badge */
.clip-fab__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 99px;
  background: #ef4444;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  opacity: 0;
  transform: scale(0);
  transition: opacity 0.2s, transform 0.2s;
}
.clip-fab__badge--visible {
  opacity: 1;
  transform: scale(1);
}
@keyframes badgeBounce {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.35); }
  100% { transform: scale(1); }
}
.clip-fab__badge--bounce {
  animation: badgeBounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Mobile: acima do floating menu */
@media (max-width: 768px) {
  .clip-fab {
    bottom: 80px;
    right: 12px;
    width: 48px;
    height: 48px;
    border-radius: 14px;
  }
  .clip-fab__icon { width: 22px; height: 22px; }
}

/* ═══════════════════════════════════════
   BACKDROP
   ═══════════════════════════════════════ */

.clip-backdrop {
  position: fixed;
  inset: 0;
  z-index: 950;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.clip-backdrop--visible {
  opacity: 1;
  pointer-events: auto;
}

/* ═══════════════════════════════════════
   BOTTOM SHEET (mobile) / SIDE DRAWER (desktop)
   ═══════════════════════════════════════ */

.clip-sheet {
  position: fixed;
  z-index: 960;
  background: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);

  /* Mobile: bottom sheet */
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 80vh;
  border-radius: 20px 20px 0 0;
  transform: translateY(100%);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.12);
}
.clip-sheet--open {
  transform: translateY(0);
}

/* Desktop: side drawer */
@media (min-width: 769px) {
  .clip-sheet {
    top: 0;
    bottom: 0;
    right: 0;
    left: auto;
    width: 380px;
    max-height: 100vh;
    border-radius: 0;
    transform: translateX(100%);
    box-shadow: -4px 0 24px rgba(0,0,0,0.1);
  }
  .clip-sheet--open {
    transform: translateX(0);
  }
}

/* Drag handle (mobile only) */
.clip-sheet__handle {
  width: 36px;
  height: 4px;
  background: #cbd5e1;
  border-radius: 4px;
  margin: 10px auto 4px;
  flex-shrink: 0;
}
@media (min-width: 769px) {
  .clip-sheet__handle { display: none; }
}

/* Header */
.clip-sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 10px;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.clip-sheet__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
}
.clip-sheet__title-icon {
  width: 20px;
  height: 20px;
  stroke: #22c55e;
}
.clip-sheet__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 99px;
  background: #f0fdf4;
  color: #16a34a;
  font-size: 0.7rem;
  font-weight: 700;
}
.clip-sheet__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.clip-sheet__clear {
  font-size: 0.72rem;
  font-weight: 600;
  color: #ef4444;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}
.clip-sheet__clear:hover { background: #fef2f2; }
.clip-sheet__close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  color: #64748b;
  transition: background 0.15s, color 0.15s;
}
.clip-sheet__close:hover { background: #f1f5f9; color: #1e293b; }

/* Body */
.clip-sheet__body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px 20px;
  overscroll-behavior: contain;
}

/* Lista de itens */
.clip-sheet__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Item */
.clip-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  transition: background 0.15s, transform 0.15s;
}
.clip-item:hover { background: #f0fdf4; }

.clip-item--missing {
  opacity: 0.5;
  border-style: dashed;
}

.clip-item__icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0fdf4;
  border-radius: 8px;
}

.clip-item__info {
  flex: 1;
  min-width: 0;
}
.clip-item__title {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #1e293b;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.clip-item__title:hover { color: #16a34a; }
.clip-item__meta {
  display: block;
  font-size: 0.65rem;
  color: #64748b;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.clip-item__loc,
.clip-item__dist {
  /* inline styles via parent */
}

.clip-item__remove {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  color: #94a3b8;
  transition: color 0.15s, background 0.15s;
}
.clip-item__remove:hover { color: #ef4444; background: #fef2f2; }

/* Empty state */
.clip-sheet__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  text-align: center;
  gap: 12px;
  padding: 20px;
}
.clip-sheet__empty-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #475569;
  margin: 0;
}
.clip-sheet__empty-hint {
  font-size: 0.78rem;
  color: #94a3b8;
  margin: 0;
  line-height: 1.4;
}

/* ═══════════════════════════════════════
   TOAST (inline)
   ═══════════════════════════════════════ */

.clip-toast {
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #fff;
  background: #1e293b;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}
.clip-toast--visible {
  opacity: 1;
  transform: translateY(0);
}
.clip-toast--warn {
  background: #d97706;
}

/* ═══════════════════════════════════════
   DARK MODE
   ═══════════════════════════════════════ */

@media (prefers-color-scheme: dark) {
  .dog-ear::before {
    border-color: transparent rgba(100, 116, 139, 0.3) transparent transparent;
  }
  .dog-ear:hover::before {
    border-color: transparent rgba(74, 222, 128, 0.4) transparent transparent;
  }
  .dog-ear--active::before {
    border-color: transparent #22c55e transparent transparent;
  }

  .clip-fab {
    background: linear-gradient(135deg, #16a34a, #15803d);
    box-shadow: 0 4px 16px -4px rgba(22, 163, 74, 0.6);
  }
  .clip-fab__badge { border-color: #1e293b; }

  .clip-backdrop { background: rgba(0, 0, 0, 0.6); }

  .clip-sheet {
    background: #1e293b;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.3);
  }
  .clip-sheet__header { border-bottom-color: #334155; }
  .clip-sheet__title { color: #e2e8f0; }
  .clip-sheet__count { background: #14532d; color: #4ade80; }
  .clip-sheet__handle { background: #475569; }
  .clip-sheet__clear:hover { background: rgba(239, 68, 68, 0.15); }
  .clip-sheet__close { color: #94a3b8; }
  .clip-sheet__close:hover { background: #334155; color: #e2e8f0; }

  .clip-item {
    background: #0f172a;
    border-color: #334155;
  }
  .clip-item:hover { background: #14532d33; }
  .clip-item__icon { background: #14532d; }
  .clip-item__title { color: #e2e8f0; }
  .clip-item__title:hover { color: #4ade80; }
  .clip-item__meta { color: #94a3b8; }
  .clip-item__remove { color: #64748b; }
  .clip-item__remove:hover { color: #ef4444; background: rgba(239, 68, 68, 0.15); }

  .clip-sheet__empty-title { color: #cbd5e1; }
  .clip-sheet__empty-hint { color: #64748b; }
  .clip-sheet__empty svg { stroke: #475569; }

  .clip-toast { background: #334155; }
}
