/* ================================================================
   polish-final.css
   Pulido final premium:
   - TT widget arrastrable: cursor grab claro, zona drag, animación entrada
     con bounce, hover sutil sin tapar contenido.
   - Page cover con borde redondeado universal y trazo blanco fino premium.
   - Cover hint de reposicionar más elegante (glass + bounce).
   - Microanimaciones premium: scale on hover, glow on focus, slide-in.
   ================================================================ */

/* ──────────────────────────────────────────────────────────────
   TIME TRACKER WIDGET — drag visible, animación entrada
   ────────────────────────────────────────────────────────────── */
.tt-widget {
  cursor: grab;
  /* Animación de entrada (bounce sutil) */
  animation: tt-pop-in 380ms cubic-bezier(.34, 1.56, .64, 1);
  /* Sombra premium */
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.18),
    0 8px 24px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.10);
  /* Permite drag con touch sin scroll */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* Hover sutil que NO mueve el widget (evita "salto" durante drag intent) */
.tt-widget:hover {
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.20),
    0 12px 32px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.tt-widget.dragging {
  cursor: grabbing !important;
  transition: none !important;
  /* mientras arrastra, sombra mucho más pronunciada para feedback */
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.25),
    0 20px 48px rgba(0, 0, 0, 0.50),
    inset 0 1px 0 rgba(255, 255, 255, 0.16) !important;
}

/* Botones internos: cursor pointer (no grab) y respeto a la zona drag */
.tt-widget .tt-w-btn,
.tt-widget .tt-w-min-btn,
.tt-widget button {
  cursor: pointer !important;
}

/* La zona del dot+tiempo es la "drag handle" obvia */
.tt-widget .tt-w-info {
  cursor: grab;
}
.tt-widget.dragging .tt-w-info { cursor: grabbing; }

/* Animación entrada: scale-from-pequeño con bounce */
@keyframes tt-pop-in {
  0%   { opacity: 0; transform: translateX(-50%) translateY(-12px) scale(0.85); }
  60%  { opacity: 1; transform: translateX(-50%) translateY(2px) scale(1.04); }
  100% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

/* Si está positioned (movido), no usar translateX(-50%) */
.tt-widget.positioned {
  animation: tt-pop-in-positioned 380ms cubic-bezier(.34, 1.56, .64, 1);
}
@keyframes tt-pop-in-positioned {
  0%   { opacity: 0; transform: translateY(-12px) scale(0.85); }
  60%  { opacity: 1; transform: translateY(2px) scale(1.04); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  .tt-widget,
  .tt-widget.positioned {
    animation: none !important;
  }
  .tt-widget:hover {
    transform: translateX(-50%) !important;
  }
  .tt-widget.positioned:hover {
    transform: none !important;
  }
}

/* ──────────────────────────────────────────────────────────────
   PAGE COVER — redondeado universal con trazo blanco fino
   ────────────────────────────────────────────────────────────── */
.page-cover.has-cover {
  border-radius: 14px;
  margin: 8px 16px 0;
  overflow: hidden;
  /* Trazo blanco sutil (como en los screenshots de referencia) */
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.18),
    0 8px 28px rgba(0, 0, 0, 0.20);
  position: relative;
  transition: box-shadow 220ms cubic-bezier(.16, 1, .3, 1);
}

[data-theme="light"] .page-cover.has-cover {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.45),
    0 4px 18px rgba(0, 0, 0, 0.10);
}

.page-cover.has-cover img {
  border-radius: 14px;
}

.page-cover.has-cover:hover {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.28),
    0 12px 36px rgba(0, 0, 0, 0.28);
}

[data-theme="light"] .page-cover.has-cover:hover {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.65),
    0 6px 22px rgba(0, 0, 0, 0.14);
}

/* En modo reposición: borde animado más fuerte */
.page-cover.has-cover.cover-repositioning {
  outline: 2px solid color-mix(in srgb, var(--primary, #5b8def) 70%, transparent) !important;
  outline-offset: 2px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.30),
    0 0 0 4px color-mix(in srgb, var(--primary, #5b8def) 22%, transparent),
    0 12px 40px rgba(0, 0, 0, 0.32) !important;
  animation: cover-reposition-pulse 1.6s ease-in-out infinite;
}

@keyframes cover-reposition-pulse {
  0%, 100% {
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.30),
      0 0 0 4px color-mix(in srgb, var(--primary, #5b8def) 22%, transparent),
      0 12px 40px rgba(0, 0, 0, 0.32);
  }
  50% {
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.45),
      0 0 0 8px color-mix(in srgb, var(--primary, #5b8def) 30%, transparent),
      0 12px 40px rgba(0, 0, 0, 0.32);
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-cover.has-cover.cover-repositioning {
    animation: none !important;
  }
}

/* Cover-actions más premium */
.page-cover-actions {
  bottom: 14px !important;
  right: 14px !important;
  gap: 8px !important;
}

.cover-action-btn {
  background: rgba(255, 255, 255, 0.92) !important;
  color: #222 !important;
  border-radius: 8px !important;
  padding: 6px 12px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  border: none !important;
  cursor: pointer;
  transition: all 180ms cubic-bezier(.16, 1, .3, 1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.12),
    0 4px 12px rgba(0, 0, 0, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.50);
}

.cover-action-btn:hover {
  transform: translateY(-1px);
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.14),
    0 8px 18px rgba(0, 0, 0, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.60);
}

.cover-action-btn:active {
  transform: translateY(0) scale(0.98);
}

.cover-action-btn.active {
  background: var(--primary, #5b8def) !important;
  color: white !important;
}

/* Hint de reposicionar más elegante */
.cover-reposition-hint {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 15, 20, 0.88);
  color: rgba(255, 255, 255, 0.95);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.40),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  animation: hint-slide-up 320ms cubic-bezier(.34, 1.56, .64, 1) both;
  z-index: 10;
}

@keyframes hint-slide-up {
  0%   { opacity: 0; transform: translateX(-50%) translateY(8px); }
  100% { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .cover-reposition-hint {
    animation: none !important;
  }
}

/* ──────────────────────────────────────────────────────────────
   GLASS MODE — refuerza redondeo cover y trazo blanco premium
   ────────────────────────────────────────────────────────────── */
html[data-visual="liquid-glass"] .page-cover.has-cover {
  border-radius: 18px;
  margin: 12px 18px 0;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.30),
    0 12px 36px rgba(0, 0, 0, 0.28);
}

html[data-visual="liquid-glass"][data-theme="light"] .page-cover.has-cover {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.65),
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    0 6px 22px rgba(0, 0, 0, 0.10);
}

html[data-visual="liquid-glass"] .page-cover.has-cover img {
  border-radius: 18px;
}

/* Botones cover más glass */
html[data-visual="liquid-glass"] .cover-action-btn {
  background: rgba(255, 255, 255, 0.78) !important;
  border: 1px solid rgba(255, 255, 255, 0.50) !important;
  color: #1a1a1a !important;
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
}

html[data-visual="liquid-glass"][data-theme="dark"] .cover-action-btn {
  background: rgba(28, 28, 32, 0.78) !important;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  color: rgba(255, 255, 255, 0.95) !important;
}


/* ================================================================
   TT tabs: scroll horizontal en cualquier viewport cuando no caben.
   ================================================================ */
.tt-tabs {
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  /* Permite arrastrar lateralmente con cursor (Chrome/Firefox respetan touch-action) */
  touch-action: pan-x pan-y;
  /* Suaviza el final del scroll para que no se corte abruptamente la pestaña */
  mask-image: linear-gradient(to right, rgba(0,0,0,1) 0, rgba(0,0,0,1) calc(100% - 24px), rgba(0,0,0,0) 100%);
  -webkit-mask-image: linear-gradient(to right, rgba(0,0,0,1) 0, rgba(0,0,0,1) calc(100% - 24px), rgba(0,0,0,0) 100%);
}
.tt-tabs::-webkit-scrollbar { height: 4px; }
.tt-tabs::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--text) 22%, transparent); border-radius: 2px; }
.tt-tab {
  flex: 0 0 auto;
  scroll-snap-align: start;
  white-space: nowrap;
}

/* ================================================================
   Workspace switcher: acciones por workspace (rename / delete) en hover
   ================================================================ */
.workspace-menu .wm-ws {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 6px;
}
.workspace-menu .wm-ws .wm-ws-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.workspace-menu .wm-ws .wm-ws-actions {
  display: inline-flex;
  gap: 2px;
  margin-left: auto;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.workspace-menu .wm-ws:hover .wm-ws-actions,
.workspace-menu .wm-ws:focus-within .wm-ws-actions {
  opacity: 1;
}
@media (hover: none) and (pointer: coarse) {
  /* En táctil (móvil/iPad) los botones siempre visibles para que se puedan tocar */
  .workspace-menu .wm-ws .wm-ws-actions { opacity: 1; }
}
.workspace-menu .wm-ws-action {
  background: transparent;
  border: none;
  width: 28px; height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.workspace-menu .wm-ws-action:hover {
  background: color-mix(in srgb, var(--text) 10%, transparent);
  color: var(--text);
}
.workspace-menu .wm-ws-action.danger:hover {
  background: color-mix(in srgb, var(--danger, #d33) 14%, transparent);
  color: var(--danger, #d33);
}
.workspace-menu .wm-ws-action svg {
  pointer-events: none;
}
.workspace-menu .wm-ws-check {
  margin-left: 4px;
  color: var(--primary, #5b8def);
}
@media (hover: none) and (pointer: coarse) {
  .workspace-menu .wm-ws-action {
    min-width: 36px;
    min-height: 36px;
  }
}

/* ================================================================
   Row detail modal: footer con botón Eliminar
   ================================================================ */
.row-detail-foot {
  display: flex;
  justify-content: flex-end;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}
.row-detail-delete {
  color: var(--danger, #d33) !important;
  border: 1px solid color-mix(in srgb, var(--danger, #d33) 35%, transparent) !important;
  background: transparent !important;
  padding: 8px 16px !important;
  border-radius: 8px !important;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.row-detail-delete:hover {
  background: color-mix(in srgb, var(--danger, #d33) 10%, transparent) !important;
  border-color: color-mix(in srgb, var(--danger, #d33) 60%, transparent) !important;
}
