/* Usenti - Dark Mode Glassmorphism Styles */

/* ====== Core Theme Variables ====== */
:root {
  --gradient-start: #2D1810;  /* Dark burnt umber */
  --gradient-end: #A86232;    /* Terracotta/copper */
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.10);
  --glass-shadow: rgba(0, 0, 0, 0.3);
  --text-primary: #FFFFFF;
  --text-secondary: rgba(255, 255, 255, 0.70);
  --text-muted: rgba(255, 255, 255, 0.50);
  --accent-cream: #F5E6D3;
  --accent-gold: #D99A5C;
}

/* ====== Base Styles ====== */
body {
  background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
}

/* Alternative: Horizontal gradient like reference */
.bg-gradient-warm {
  background: linear-gradient(90deg, #2D1810 0%, #6B3A1F 50%, #A86232 100%);
}

/* ====== Custom Scrollbar (Dark Theme) ====== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.20);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.30);
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Selection */
::selection {
  background-color: #F5E6D3;
  color: #2D1810;
}

::-moz-selection {
  background-color: #F5E6D3;
  color: #2D1810;
}

/* ====== Glassmorphism Utilities ====== */
.glass-card {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 20px;
}

.glass-card-light {
  background: rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
}

.glass-card-dark {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
}

.glass-sidebar {
  background: rgba(0, 0, 0, 0.20);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.glass-header {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.glass-modal {
  background: rgba(45, 24, 16, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 24px;
}

.glass-input {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: white;
}

.glass-input:focus {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  outline: none;
}

.glass-input::placeholder {
  color: rgba(255, 255, 255, 0.40);
}

/* ====== Button Styles ====== */
.btn-primary {
  background: #F5E6D3;
  color: #2D1810;
  border-radius: 9999px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background: #EBD9C4;
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.10);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ====== Navigation Active State ====== */
.nav-item-active {
  background: #F5E6D3;
  color: #2D1810;
  border-radius: 12px;
}

.nav-item {
  color: rgba(255, 255, 255, 0.60);
  border-radius: 12px;
  transition: all 0.2s ease;
}

.nav-item:hover {
  color: white;
  background: rgba(255, 255, 255, 0.08);
}

/* ====== Table Styles (Dark Theme) ====== */
.glass-table {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  overflow: hidden;
}

.glass-table thead {
  background: rgba(255, 255, 255, 0.08);
}

.glass-table th {
  color: rgba(255, 255, 255, 0.60);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.glass-table td {
  color: rgba(255, 255, 255, 0.90);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.glass-table tr:hover td {
  background: rgba(255, 255, 255, 0.05);
}

/* ====== Status Badges (Dark Theme) ====== */
.badge-active {
  background: rgba(34, 197, 94, 0.20);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.30);
}

.badge-warning {
  background: rgba(251, 191, 36, 0.20);
  color: #fde047;
  border: 1px solid rgba(251, 191, 36, 0.30);
}

.badge-error {
  background: rgba(239, 68, 68, 0.20);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.30);
}

.badge-neutral {
  background: rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.70);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* ====== Highlighted Metric Card ====== */
.metric-highlight {
  background: rgba(245, 230, 211, 0.15);
  border: 1px solid rgba(245, 230, 211, 0.30);
}

/* ====== Canvas Workflow Builder Styles (Dark Glassmorphism) ====== */

/* Canvas container */
.canvas-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(45, 24, 16, 0.5) 0%, rgba(107, 58, 31, 0.3) 100%);
  cursor: grab;
}

.canvas-container.grabbing {
  cursor: grabbing;
}

.canvas-container.selecting {
  cursor: crosshair;
}

/* Canvas grid background */
.canvas-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.15) 1px, transparent 1px);
  background-size: 20px 20px;
}

/* Canvas viewport (the transformable layer) */
.canvas-viewport {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
}

/* Node base styles */
.canvas-node {
  position: absolute;
  cursor: move;
  user-select: none;
  transition: box-shadow 0.2s ease, transform 0.1s ease;
}

.canvas-node:hover {
  z-index: 10;
}

.canvas-node.selected {
  z-index: 20;
}

.canvas-node.dragging {
  z-index: 100;
  opacity: 0.9;
}

/* Node card styles */
.node-card {
  min-width: 200px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), 0 4px 16px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.canvas-node:hover .node-card {
  border-color: rgba(245, 230, 211, 0.5);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25), 0 6px 20px rgba(0, 0, 0, 0.2);
  transform: translateY(-2px);
}

.canvas-node.selected .node-card {
  border-color: #F5E6D3;
  box-shadow: 0 0 0 3px rgba(245, 230, 211, 0.3), 0 12px 40px rgba(0, 0, 0, 0.25);
}

/* Node header */
.node-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.node-header.email { background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 100%); }
.node-header.wait { background: linear-gradient(135deg, #f3e8ff 0%, #faf5ff 100%); }
.node-header.condition { background: linear-gradient(135deg, #fef3c7 0%, #fffbeb 100%); }
.node-header.start { background: linear-gradient(135deg, #d1fae5 0%, #ecfdf5 100%); }
.node-header.end { background: linear-gradient(135deg, #fee2e2 0%, #fef2f2 100%); }


/* Node icon badge */
.node-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.node-icon.email { background: #3b82f6; color: white; }
.node-icon.wait { background: #8b5cf6; color: white; }
.node-icon.condition { background: #f59e0b; color: white; }
.node-icon.start { background: #10b981; color: white; }
.node-icon.end { background: #ef4444; color: white; }


/* Node content */
.node-content {
  padding: 12px;
}

/* Connection ports */
.node-port {
  position: absolute;
  width: 14px;
  height: 14px;
  background: white;
  border: 2px solid rgba(107, 58, 31, 0.5);
  border-radius: 50%;
  cursor: crosshair;
  transition: all 0.2s ease;
  z-index: 5;
}

.node-port:hover {
  background: #F5E6D3;
  border-color: #F5E6D3;
  transform: scale(1.3);
}

.node-port.input {
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
}

.node-port.output {
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
}

.node-port.connected {
  background: #F5E6D3;
  border-color: #F5E6D3;
}

/* Connection lines */
.connection-line {
  fill: none;
  stroke: rgba(255, 255, 255, 0.4);
  stroke-width: 2;
  pointer-events: none;
}

.connection-line.active {
  stroke: rgba(245, 230, 211, 0.8);
  stroke-width: 3;
}

.connection-line-hover {
  fill: none;
  stroke: transparent;
  stroke-width: 20;
  cursor: pointer;
}

/* Block palette / Toolbox */
.block-palette {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(45, 24, 16, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  padding: 12px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.palette-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  cursor: grab;
  transition: all 0.2s ease;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

.palette-item:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateX(4px);
}

.palette-item:active {
  cursor: grabbing;
}

.palette-item .icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Canvas controls */
.canvas-controls {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(45, 24, 16, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 1000;
}

.canvas-control-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.6);
  transition: all 0.2s ease;
}

.canvas-control-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.canvas-control-btn.active {
  background: #F5E6D3;
  color: #2D1810;
}

.zoom-display {
  padding: 0 12px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.6);
  min-width: 50px;
  text-align: center;
}

.control-divider {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.1);
  margin: 0 4px;
}

/* Minimap */
.canvas-minimap {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: 180px;
  height: 120px;
  background: rgba(45, 24, 16, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  z-index: 1000;
}

.minimap-content {
  position: relative;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.05);
}

.minimap-viewport {
  position: absolute;
  border: 2px solid #F5E6D3;
  background: rgba(245, 230, 211, 0.1);
  pointer-events: none;
}

.minimap-node {
  position: absolute;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 2px;
}

/* Branch connections */
.branch-label {
  position: absolute;
  background: rgba(45, 24, 16, 0.9);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.2);
  pointer-events: none;
  white-space: nowrap;
  color: white;
}

.branch-label.opened { background: rgba(59, 130, 246, 0.3); color: #93c5fd; border-color: rgba(59, 130, 246, 0.5); }
.branch-label.not-opened { background: rgba(249, 115, 22, 0.3); color: #fdba74; border-color: rgba(249, 115, 22, 0.5); }
.branch-label.replied { background: rgba(139, 92, 246, 0.3); color: #c4b5fd; border-color: rgba(139, 92, 246, 0.5); }
.branch-label.not-replied { background: rgba(236, 72, 153, 0.3); color: #f9a8d4; border-color: rgba(236, 72, 153, 0.5); }

/* Condition block branch add button hover */
.branch-add-container {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.branch-add-container:hover {
  border-color: rgba(0, 0, 0, 0.25) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Condition node wider card */
.canvas-node .node-card .node-header.condition {
  background: linear-gradient(135deg, #fef3c7 0%, #fffbeb 100%);
}

/* Animations */
@keyframes node-appear {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.canvas-node.new {
  animation: node-appear 0.3s ease-out;
}

/* Pulse animation for active connections */
@keyframes connection-pulse {
  0%, 100% { stroke-opacity: 1; }
  50% { stroke-opacity: 0.5; }
}

.connection-line.animating {
  animation: connection-pulse 1.5s ease-in-out infinite;
}

/* Selection box */
.selection-box {
  position: absolute;
  border: 2px dashed #F5E6D3;
  background: rgba(245, 230, 211, 0.1);
  pointer-events: none;
  z-index: 500;
}

/* ============================================================
   Daily Brief Dashboard Styles
   ============================================================ */

/* AI Brief card — subtle warm glow */
.daily-brief-card {
  border: 1px solid rgba(245, 230, 211, 0.12);
  background: linear-gradient(135deg,
    rgba(245, 230, 211, 0.06) 0%,
    rgba(255, 255, 255, 0.03) 50%,
    rgba(245, 230, 211, 0.04) 100%
  );
}

.daily-brief-glow {
  position: absolute;
  top: -40%;
  right: -20%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(245, 230, 211, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

/* Brief text styling */
.daily-brief-text p:first-child {
  font-weight: 400;
  color: rgba(255, 255, 255, 0.95);
}

/* Event list item hover */
.daily-brief-event {
  border-left: 2px solid transparent;
  transition: all 0.2s ease;
}

.daily-brief-event:hover {
  border-left-color: rgba(245, 230, 211, 0.3);
}

/* Email list item hover */
.daily-brief-email {
  transition: all 0.2s ease;
}

.daily-brief-email:hover .daily-brief-email-priority {
  transform: scale(1.1);
}

/* View switcher */
.dashboard-view-switcher {
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Scrollable column lists */
.daily-brief-scroll {
  max-height: calc(100vh - 200px);
  min-height: 400px;
  overflow-y: auto;
}

.daily-brief-scroll::-webkit-scrollbar {
  width: 4px;
}

.daily-brief-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.daily-brief-scroll::-webkit-scrollbar-track {
  background: transparent;
}

/* Line clamp utility for AI summaries */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Loading shimmer for daily brief */
.daily-brief-loading {
  position: relative;
  overflow: hidden;
}

.daily-brief-loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent 0%, rgba(245, 230, 211, 0.03) 50%, transparent 100%);
  animation: brief-shimmer 2s ease-in-out infinite;
}

@keyframes brief-shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}
