/* ==========================================================================
   Annotation Studio Styles - Giffú Entrega
   Visual markup system for comments on video frames & photos
   ========================================================================== */

/* Comment Bar Integration */
.comment-input-left-tools {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-comment-markup {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: var(--radius-md, 8px);
  background: var(--bg-tertiary, #1f232b);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
  color: var(--text-secondary, #94a3b8);
  cursor: pointer;
  transition: all var(--transition-fast, 0.15s ease);
  padding: 0;
  margin-top: 1px;
}

.btn-comment-markup:hover {
  background: var(--bg-card, #23272e);
  color: var(--brand-orange, #ff5400);
  border-color: var(--brand-orange, #ff5400);
  transform: translateY(-1px);
}

.annotation-studio-modal {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: annotationFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #f1f5f9;
}

.annotation-studio-modal.closing {
  animation: annotationFadeOut 0.18s ease-in forwards;
}

@keyframes annotationFadeIn {
  from { opacity: 0; transform: scale(0.99); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes annotationFadeOut {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.99); }
}

.annotation-studio-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 15, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.annotation-studio-dialog {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  z-index: 1;
}

/* ==========================================================================
   Studio Header & Toolbar
   ========================================================================== */
.annotation-studio-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  background: rgba(18, 22, 30, 0.92);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.annotation-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.annotation-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 84, 0, 0.15);
  border: 1px solid rgba(255, 84, 0, 0.35);
  color: var(--brand-orange, #ff5400);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.annotation-frame-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.annotation-frame-tag svg {
  color: var(--brand-orange, #ff5400);
}

/* Central Tools Group */
.annotation-tools-group {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(26, 32, 44, 0.7);
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.annotation-toolset {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-annotation-tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #94a3b8;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-annotation-tool:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
}

.btn-annotation-tool.is-active {
  background: rgba(255, 84, 0, 0.18);
  border-color: rgba(255, 84, 0, 0.45);
  color: var(--brand-orange, #ff5400);
  box-shadow: 0 0 12px rgba(255, 84, 0, 0.2);
}

.annotation-divider {
  width: 1px;
  height: 22px;
  background: rgba(255, 255, 255, 0.12);
  margin: 0 2px;
}

/* Color Palette Swatches */
.annotation-colors {
  display: flex;
  align-items: center;
  gap: 6px;
}

.color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: var(--swatch-color);
  border: 2px solid rgba(0, 0, 0, 0.35);
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  position: relative;
}

.color-swatch:hover {
  transform: scale(1.15);
}

.color-swatch.is-active {
  transform: scale(1.18);
  box-shadow: 0 0 0 2px #181d26, 0 0 0 4px var(--swatch-color);
  border-color: #ffffff;
}

/* Stroke Width Controls */
.annotation-stroke-widths {
  display: flex;
  align-items: center;
  gap: 4px;
}

.stroke-width-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
  transition: all 0.15s ease;
}

.stroke-width-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.stroke-width-btn.is-active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
}

.stroke-dot {
  display: block;
  border-radius: 50%;
  background: #cbd5e1;
  transition: background-color 0.15s ease;
}

.stroke-width-btn.is-active .stroke-dot {
  background: var(--brand-orange, #ff5400);
}

/* Right Header Controls */
.annotation-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.annotation-history-btns {
  display: flex;
  align-items: center;
  gap: 3px;
  background: rgba(26, 32, 44, 0.7);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.btn-annotation-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: #94a3b8;
  cursor: pointer;
  padding: 0;
  transition: all 0.15s ease;
}

.btn-annotation-action:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.btn-annotation-action.btn-delete-selected:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.22);
  color: #ef4444;
}

.btn-annotation-action:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-annotation-cancel {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  padding: 7px 14px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-annotation-cancel:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

.btn-annotation-complete {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--brand-orange, #ff5400);
  border: none;
  color: #ffffff;
  padding: 7px 16px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(255, 84, 0, 0.35);
  transition: all 0.15s ease;
}

.btn-annotation-complete:hover {
  background: #e04a00;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(255, 84, 0, 0.45);
}

.btn-annotation-complete:active {
  transform: translateY(0);
}

/* ==========================================================================
   Interactive Viewport & Canvas
   ========================================================================== */
.annotation-viewport {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 16px;
  user-select: none;
  -webkit-user-select: none;
}

.annotation-canvas-wrap {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  overflow: hidden;
  background: #000000;
}

.annotation-canvas {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 130px);
  width: auto;
  height: auto;
  object-fit: contain;
  cursor: crosshair;
  touch-action: none;
}

/* ==========================================================================
   Inline Floating Text Box Editor
   ========================================================================== */
.annotation-text-input-wrap {
  position: fixed;
  z-index: 1000000;
  transform: translate(-10px, -10px);
  animation: annotationCardPop 0.15s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes annotationCardPop {
  from { opacity: 0; transform: translate(-10px, -15px) scale(0.96); }
  to { opacity: 1; transform: translate(-10px, -10px) scale(1); }
}

.annotation-text-input-card {
  background: rgba(18, 22, 30, 0.95);
  border: 2px solid var(--text-accent-color, #ff5400);
  border-radius: 10px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.65), 0 0 16px rgba(255, 84, 0, 0.25);
  padding: 10px;
  width: 250px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.annotation-text-input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #ffffff;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  padding: 8px 10px;
  resize: vertical;
  outline: none;
  min-height: 48px;
}

.annotation-text-input:focus {
  border-color: var(--text-accent-color, #ff5400);
}

.annotation-text-input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.text-hint {
  font-size: 11px;
  color: #94a3b8;
}

.text-btns {
  display: flex;
  gap: 6px;
}

.btn-text-cancel,
.btn-text-ok {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  transition: all 0.12s ease;
}

.btn-text-cancel {
  background: rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
}

.btn-text-cancel:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #ef4444;
}

.btn-text-ok {
  background: var(--brand-orange, #ff5400);
  color: #ffffff;
}

.btn-text-ok:hover {
  background: #e04a00;
}

/* ==========================================================================
   Studio Footer
   ========================================================================== */
.annotation-studio-footer {
  padding: 8px 16px;
  background: rgba(14, 17, 24, 0.85);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  text-align: center;
  flex-shrink: 0;
}

.annotation-hint-text {
  font-size: 11.5px;
  color: #64748b;
}

.annotation-hint-text strong {
  color: #94a3b8;
}

/* ==========================================================================
   Light Mode Theme Adaptation
   ========================================================================== */
html[data-theme="light"] .annotation-studio-backdrop {
  background: rgba(240, 243, 248, 0.94);
}

html[data-theme="light"] .annotation-studio-header {
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.06);
  color: #1e293b;
}

html[data-theme="light"] .annotation-frame-tag {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #475569;
}

html[data-theme="light"] .annotation-tools-group,
html[data-theme="light"] .annotation-history-btns {
  background: #f1f5f9;
  border-color: #e2e8f0;
}

html[data-theme="light"] .btn-annotation-tool {
  color: #475569;
}

html[data-theme="light"] .btn-annotation-tool:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #0f172a;
}

html[data-theme="light"] .btn-annotation-tool.is-active {
  background: rgba(255, 84, 0, 0.12);
  border-color: rgba(255, 84, 0, 0.4);
  color: var(--brand-orange, #ff5400);
}

html[data-theme="light"] .annotation-divider {
  background: #e2e8f0;
}

html[data-theme="light"] .stroke-dot {
  background: #64748b;
}

html[data-theme="light"] .btn-annotation-action {
  color: #475569;
}

html[data-theme="light"] .btn-annotation-action:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.06);
  color: #0f172a;
}

html[data-theme="light"] .btn-annotation-action.btn-delete-selected:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

html[data-theme="light"] .btn-annotation-cancel {
  border-color: #cbd5e1;
  color: #475569;
}

html[data-theme="light"] .btn-annotation-cancel:hover {
  background: #f1f5f9;
  color: #0f172a;
}

html[data-theme="light"] .annotation-studio-footer {
  background: rgba(255, 255, 255, 0.9);
  border-top: 1px solid #e2e8f0;
}

html[data-theme="light"] .annotation-hint-text {
  color: #64748b;
}

html[data-theme="light"] .annotation-hint-text strong {
  color: #334155;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 900px) {
  .annotation-studio-header {
    padding: 8px 12px;
    gap: 8px;
  }
  .tool-label {
    display: none;
  }
  .btn-annotation-tool {
    padding: 6px 8px;
  }
  .annotation-brand-badge span {
    display: none;
  }
}
