/* ============================================================================
 * Binovax — Professional Chart Drawings Tools UI & Overlay Styles
 * ============================================================================ */

/* ── Toolbar Button ── */
.drawings-toolbar-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text, #cbd5e1);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.drawings-toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
  transform: translateY(-1px);
}

.drawings-toolbar-btn.active {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.25), rgba(59, 130, 246, 0.25));
  border-color: #3b82f6;
  color: #60a5fa;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.35);
}

.drawings-toolbar-btn svg {
  transition: transform 0.2s ease;
}

.drawings-toolbar-btn:hover svg {
  transform: scale(1.1);
}

/* Mobile toolbar icon button */
.m-ind-btn#mDrawingsBtn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.m-ind-btn#mDrawingsBtn.active {
  background: rgba(59, 130, 246, 0.3);
  border-color: #3b82f6;
  color: #60a5fa;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
}

/* ── Overlay Canvas inside Chart Containers ── */
.chart-drawings-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 15;
}

.chart-drawings-canvas.active-tool {
  pointer-events: auto !important;
  cursor: crosshair;
}

.chart-drawings-canvas.hover-grab {
  pointer-events: auto !important;
  cursor: grab;
}

.chart-drawings-canvas.hover-pointer {
  pointer-events: auto !important;
  cursor: pointer;
}

.chart-drawings-canvas.dragging-drawing {
  pointer-events: auto !important;
  cursor: grabbing !important;
}

/* ── Floating Drawing Helper Toast / Instruction Banner ── */
.dw-instruction-toast {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 500;
  padding: 7px 16px;
  border-radius: 30px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.45), 0 0 15px rgba(59, 130, 246, 0.2);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: dwToastFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}

@keyframes dwToastFadeIn {
  from { opacity: 0; transform: translate(-50%, -10px) scale(0.95); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

.dw-instruction-toast .dw-toast-cancel {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #cbd5e1;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.dw-instruction-toast .dw-toast-cancel:hover {
  background: rgba(239, 68, 68, 0.8);
  color: #fff;
}

/* ── Floating Drawing Properties Bar (When selected) ── */
.drawing-properties-bar {
  position: absolute;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.65), 0 0 12px rgba(255, 255, 255, 0.05);
  z-index: 110;
  animation: dwBarPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

@keyframes dwBarPop {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.dw-color-swatches {
  display: flex;
  align-items: center;
  gap: 5px;
  padding-right: 8px;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
}

.dw-color-circle {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.dw-color-circle:hover {
  transform: scale(1.2);
}

.dw-color-circle.active {
  border-color: #fff;
  box-shadow: 0 0 8px currentColor;
  transform: scale(1.15);
}

.dw-select-group {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-right: 8px;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
}

.dw-bar-select {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 5px;
  cursor: pointer;
  outline: none;
}

.dw-bar-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 13px;
}

.dw-bar-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.dw-bar-btn.active {
  background: rgba(59, 130, 246, 0.3);
  border-color: #3b82f6;
  color: #60a5fa;
}

.dw-bar-btn.dw-delete-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
  color: #f87171;
}

/* ── Drawings Popup / Sidebar Panel Overlay ── */
.drawings-panel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.drawings-panel-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.drawings-panel {
  background: var(--bg2, #111827);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  width: 92%;
  max-width: 660px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 25px rgba(59, 130, 246, 0.15);
  overflow: hidden;
  transform: scale(0.92) translateY(15px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.drawings-panel-overlay.show .drawings-panel {
  transform: scale(1) translateY(0);
}

/* Panel Header */
.dw-panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent);
}

.dw-panel-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dw-panel-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.25), rgba(59, 130, 246, 0.4));
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #60a5fa;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.dw-panel-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
}

.dw-panel-subtitle {
  margin: 0;
  font-size: 11px;
  color: var(--text3, #94a3b8);
}

.dw-panel-close {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 14px;
}

.dw-panel-close:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fff;
}

/* Category Filter Pills */
.dw-category-pills {
  padding: 10px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.dw-category-pills::-webkit-scrollbar {
  display: none;
}

.dw-cat-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text, #cbd5e1);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.dw-cat-pill:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.dw-cat-pill.active {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  border-color: #3b82f6;
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

/* Panel Body / Grid */
.dw-panel-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.dw-category-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dw-category-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text3, #64748b);
  display: flex;
  align-items: center;
  gap: 8px;
}

.dw-category-header::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
}

.dw-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

/* Tool Item Card */
.drawing-tool-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.drawing-tool-item:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.35);
}

.drawing-tool-item.active {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.25), rgba(59, 130, 246, 0.15));
  border-color: #3b82f6;
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.25);
}

.dw-tool-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #93c5fd;
  transition: all 0.2s ease;
}

.drawing-tool-item:hover .dw-tool-icon-wrap {
  background: rgba(59, 130, 246, 0.2);
  color: #fff;
  transform: scale(1.08);
}

.drawing-tool-item.active .dw-tool-icon-wrap {
  background: #3b82f6;
  color: #fff;
}

.dw-tool-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text, #e2e8f0);
  line-height: 1.3;
}

.dw-tool-desc {
  font-size: 9.5px;
  color: var(--text3, #94a3b8);
}

/* Panel Footer / Delete All */
.dw-panel-footer {
  padding: 12px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dw-footer-info {
  font-size: 11px;
  color: var(--text3, #94a3b8);
}

.drawings-clear-all-btn {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 15px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.drawings-clear-all-btn:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: #ef4444;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Responsive for Mobile & Tablet */
@media (max-width: 768px) {
  .drawings-panel {
    width: 96%;
    max-height: 88vh;
  }
  
  .dw-tools-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  
  .drawing-tool-item {
    padding: 10px 6px;
  }
  
  .dw-tool-name {
    font-size: 11px;
  }
  
  .dw-tool-desc {
    display: none;
  }

  .drawing-properties-bar {
    top: 50px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    max-width: 95%;
    flex-wrap: wrap;
    justify-content: center;
  }
}
