/* COEC Personal Finance Assistant - Custom Styles */

@keyframes pulseRedGlow {
  0%, 100% {
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
    border-color: rgba(239, 68, 68, 0.8);
  }
  50% {
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.85);
    border-color: rgba(239, 68, 68, 1);
  }
}

.animate-pulse-red {
  animation: pulseRedGlow 2s infinite ease-in-out;
}

/* Drag and Drop Zone */
.dropzone-active {
  border-color: #6366f1 !important;
  background-color: rgba(99, 102, 241, 0.08) !important;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.5);
}

/* Safe area padding for mobile iPhones/Android with gesture pill */
.safe-area-bottom {
  padding-bottom: env(safe-area-inset-bottom, 16px);
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

input[type="date"] {
  color-scheme: dark;
}

/* Collapsible Desktop Sidebar */
@media (min-width: 1024px) {
  #coec-sidebar.is-collapsed {
    width: 3.75rem;
  }
  #coec-sidebar.is-collapsed .sidebar-label,
  #coec-sidebar.is-collapsed .sidebar-group-title,
  #coec-sidebar.is-collapsed .sidebar-brand-text {
    display: none;
  }
  #coec-sidebar.is-collapsed .sidebar-link {
    justify-content: center;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
  #coec-sidebar.is-collapsed .sidebar-group-sep {
    display: block;
  }
}

/* Searchable Select Dropdown */
.coec-ss-wrap {
  position: relative;
  display: inline-block;
  width: 100%;
}
.coec-ss-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.375rem;
  width: 100%;
  text-align: left;
  cursor: pointer;
}
.coec-ss-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.coec-ss-caret {
  flex-shrink: 0;
  opacity: 0.65;
  font-size: 10px;
}
.coec-ss-popover {
  position: fixed;
  z-index: 9999;
  background-color: #0f172a;
  border: 1px solid #334155;
  border-radius: 0.5rem;
  box-shadow: 0 20px 35px -10px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 220px;
}
.coec-ss-search {
  width: 100%;
  background-color: #020617;
  color: #f8fafc;
  border: none;
  border-bottom: 1px solid #1e293b;
  padding: 0.5rem 0.625rem;
  font-size: 0.75rem;
  outline: none;
}
.coec-ss-search::placeholder {
  color: #64748b;
}
.coec-ss-list {
  max-height: 240px;
  overflow-y: auto;
  padding: 0.25rem;
}
.coec-ss-opt {
  padding: 0.375rem 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  color: #cbd5e1;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.coec-ss-opt:hover,
.coec-ss-opt.is-active {
  background-color: #312e81;
  color: #ffffff;
}
.coec-ss-opt.is-selected {
  font-weight: 600;
  color: #a5b4fc;
}
.coec-ss-empty {
  padding: 0.5rem 0.625rem;
  font-size: 0.75rem;
  color: #64748b;
  text-align: center;
}

/* Inline KPI Help Popover (0px footprint) */
.coec-kpi-tip {
  border-bottom: 1px dotted #475569;
  cursor: help;
  transition: border-color 0.15s, color 0.15s;
}
.coec-kpi-tip:hover,
.coec-kpi-tip:focus-visible,
.coec-kpi-tip[aria-expanded="true"] {
  border-bottom-color: #818cf8;
  color: #e2e8f0;
  outline: none;
}
.coec-help-popover {
  position: fixed;
  z-index: 9999;
  width: min(290px, calc(100vw - 16px));
  background-color: #0f172a;
  border: 1px solid #334155;
  border-radius: 0.5rem;
  box-shadow: 0 16px 30px -8px rgba(0, 0, 0, 0.85);
  padding: 0.55rem 0.7rem;
  color: #cbd5e1;
  font-size: 0.72rem;
  line-height: 1.4;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  pointer-events: none;
}
.coec-help-popover-title {
  font-weight: 700;
  color: #f8fafc;
  font-size: 0.75rem;
  margin-bottom: 0.2rem;
}
.coec-help-popover-formula {
  margin-top: 0.375rem;
  padding: 0.25rem 0.45rem;
  border-radius: 0.375rem;
  background-color: #020617;
  border: 1px solid #1e293b;
  color: #a5b4fc;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.65rem;
  line-height: 1.3;
}
