/* 
 * Shared Widget Styles - Dream City Church
 * Unified design system for response dashboard and response details widgets
 * Mobile-first, accessible, cohesive design
 */

/* ==========================================================================
   Design Tokens & CSS Variables
   ========================================================================== */
:root {
  /* Brand Colors */
  --brand-primary: #bc204b;
  --brand-secondary: #e07e3c;
  
  /* Semantic Colors */
  --dusk: #253746;
  --charcoal: #3f4444;
  --cloud: #bcbcbc;
  --muted: #6b7280;
  
  /* State Colors */
  --success: #0e8a16;
  --warning: #b7791f;
  --danger: #b91c1c;
  --info: #1565c0;
  
  /* Background Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f7f8f9;
  --bg-soft: #f5f7f8;
  --bg-card: #ffffff;
  
  /* Borders & Surfaces */
  --border-color: #e5e7eb;
  --border-light: #f3f4f6;
  
  /* Shadows */
  --shadow-sm: 0 1px 0 rgba(16, 24, 40, 0.02);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 2px 10px rgba(0, 0, 0, 0.08);
  
  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-full: 999px;
  
  /* Spacing System */
  --space-xs: 4px;
  --space-sm: 6px;
  --space-md: 8px;
  --space-lg: 12px;
  --space-xl: 16px;
  --space-2xl: 20px;
  --space-3xl: 24px;
  
  /* Focus Ring */
  --focus-ring: 0 0 0 3px rgba(188, 32, 75, 0.25);
  
  /* Typography */
  --font-family-brand: 'neuehaasdisplay-bold', system-ui, -apple-system, sans-serif;
  --font-family-base: 'Open Sans', system-ui, -apple-system, sans-serif;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;
  
  /* Font synthesis */
  font-synthesis-weight: none;
}

/* ==========================================================================
   Base Widget Styles
   ========================================================================== */
.vw-widget {
  max-width: 920px;
  margin: var(--space-xl) auto;
  padding: 0 var(--space-lg);
  color: var(--charcoal);
  font-family: var(--font-family-base);
}

/* ==========================================================================
   Headers & Navigation
   ========================================================================== */
.vw-header {
  display: grid;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

/* Dashboard Style Header */
.vw-header--dashboard {
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.vw-header--dashboard h2 {
  font-size: 1.75rem;
  color: var(--dusk);
  text-align: center;
  margin: 0;
  line-height: 1.2;
}

/* Details Style Header */
.vw-header--details {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.vw-title .vw-name {
  font-size: 1.25rem;
  margin: 0.1rem 0 0 0;
  line-height: 1.5rem;
  color: var(--dusk);
}

@media screen and (max-width: 600px) {
  .vw-sub-row .vw-name, .vw-sub-row .vw-date {
    width: 100%;
  }
  .vw-sub-row .vw-sep {
    display: none;
  }
}

.vw-title .vw-opportunity {
  margin: 0.15rem 0 0 0;
  color: var(--muted);
  padding: 0;
}

/* ==========================================================================
   Avatars
   ========================================================================== */
.vw-avatar {
  border-radius: 50%;
  overflow: hidden;
  background: var(--cloud);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: var(--font-weight-bold);
  flex-shrink: 0;
}

/* Small avatar (dashboard) */
.vw-avatar--sm {
  width: 40px;
  height: 40px;
  font-size: 0.875rem;
}

/* Large avatar (details) */
.vw-avatar--lg {
  width: 64px;
  height: 64px;
  font-size: 1.375rem;
}

.vw-avatar img {
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  object-fit: cover;
}

.vw-avatar-fallback,
.avatar-initials {
  font-family: var(--font-family-brand);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.01em;
}

.vw-avatar--sm .vw-avatar-fallback {
  position: relative;
  top: 1px;
  left: 0.5px;
}

.vw-avatar--lg .avatar-initials {
  margin-top: 5%;
}

/* ==========================================================================
   Cards
   ========================================================================== */
.vw-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: inherit;
  text-decoration: none;
  transition: all 0.15s ease;
}

/* Dashboard Cards */
.vw-card--dashboard {
  display: block;
  padding: var(--space-md);
  box-shadow: var(--shadow-sm);
  border-left: 5px solid var(--success);
}

.vw-card--dashboard:hover {
  background: #fcfcfd;
  box-shadow: var(--shadow-md);
}

.vw-card--dashboard:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Details Cards */
.vw-card--details {
  box-shadow: var(--shadow-md);
  padding: var(--space-2xl);
  margin: var(--space-lg) 0;
}

/* Card States */
.vw-card--needs-follow-up {
  border-left-color: var(--brand-secondary);
}

.vw-card--closed {
  border-left-color: var(--muted);
  opacity: 0.6;
}

.vw-card--notes {
  border: 2px solid var(--brand-primary);
}

/* Card Layout */
.vw-card-top {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-md);
  align-items: center;
}

.vw-main {
  min-width: 0;
}

/* ==========================================================================
   Typography & Content
   ========================================================================== */
.vw-title-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 0;
}

.vw-opp-title {
  font-size: 1rem !important;
  line-height: 1.2 !important;
  color: var(--dusk);
  margin: 0 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.vw-title-status {
  font-size: 1rem;
  font-weight: bold;
}

.vw-sub-row {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.8rem;
  display: flex;
  row-gap: 0;
  column-gap: 5px;
  align-items: center;
  min-width: 0;
  flex-wrap: wrap;
}

.vw-name,
.vw-date {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vw-sep {
  opacity: 0.6;
}

.vw-section-title {
  font-size: 1rem !important;
  line-height: 1.25rem !important;
  margin: 0 0 var(--space-lg) 0 !important;
  color: var(--dusk);
}

/* Utility Classes */
.muted {
  color: var(--muted);
}

.micro {
  font-size: 0.8rem;
}

.muted.micro {
  text-align: center;
  margin-top: var(--space-md);
}

/* ==========================================================================
   Chips & Pills
   ========================================================================== */
.vw-chips {
  margin-top: 0.4rem;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.vw-chip,
.chip,
.vw-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-soft);
  color: var(--charcoal);
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}

.vw-pill {
  padding: 2px 6px;
  font-size: 0.72rem;
  background: #f9fafb;
}

/* Chip States */
.vw-chip:hover {
  background: var(--border-light);
}

.vw-chip.is-active {
  background: var(--brand-primary);
  color: #fff;
  border-color: var(--brand-primary);
}

/* Semantic Chip Colors */
.chip-good,
.pill-bgc-ok {
  background: #ecfdf0;
  color: var(--success);
  border-color: rgba(14, 138, 22, 0.2);
}

.chip-warn,
.pill-bgc-needed {
  background: #fff7ed;
  color: var(--warning);
  border-color: rgba(183, 121, 31, 0.25);
}

.chip-bad,
.chip-danger,
.pill-bgc-bad {
  background: #fef2f2;
  color: var(--danger);
  border-color: rgba(185, 28, 28, 0.2);
}

.chip-redflag {
  background: #c90000;
  font-family: var(--font-family-base);
  font-weight: bold;
  color: #fff;
  border-color: rgba(185, 28, 28, 0.2);
  text-wrap: wrap;
  line-height: 0.85rem;
}

.chip-redflag i {
    margin-right:10px;
    margin-left:5px;
}

.chip-neutral {
  background: var(--border-light);
  color: #374151;
}

.chip-group,
.pill-type,
.pill-group {
  background: #e0e7ff;
  color: #3730a3;
  border-color: rgba(55, 48, 163, 0.2);
}

.chip-info,
.pill-info {
  background: #e3f2fd;
  color: var(--info);
  border-color: rgba(21, 101, 192, 0.2);
}

/* Status Pills */
.pill-status-open {
  font-weight: var(--font-weight-bold);
  color: var(--success);
  font-size: 0.75rem;
}

.pill-status-open-no-follow-ups {
  font-weight: var(--font-weight-bold);
  color: var(--brand-secondary);
  font-size: 0.75rem;
}

.pill-status-closed {
  font-weight: var(--font-weight-bold);
  color: var(--muted);
  font-size: 0.75rem;
}

/* ==========================================================================
   Buttons & Actions
   ========================================================================== */
.vw-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.vw-actions-final {
  display: flex;
  gap: var(--space-lg);
  justify-content: space-around;
  flex-wrap: wrap;
}

.vw-actions-final-text {
    color: var(--charcoal);
    text-align: center;
    text-wrap-style: balance;
    padding: 0;
    width: 100%;
}

.vw-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
  background: #f9fafb;
  color: var(--dusk);
  flex-grow: 1;
}

.vw-btn:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

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

.vw-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Button Variants */
.vw-btn-primary {
  background: var(--brand-primary);
  color: #fff;
  border-color: var(--brand-primary);
}

.vw-btn-secondary {
  border-color: var(--border-color);
  background: var(--bg-card);
}

.vw-btn-approve {
  background: var(--brand-secondary);
  color: #fff;
  border-color: var(--brand-secondary);
}

.vw-btn-reject {
  background: var(--bg-card);
  border-color: var(--danger);
  color: var(--danger);
}

#vw-notes-submit {
  margin-top: 1rem;
  width: 100%;
  padding: 0.5rem;
  border: 0;
  background-color: var(--brand-primary);
  color: white;
  font-weight: var(--font-weight-bold);
  border-radius: var(--radius-md);
}

/* ==========================================================================
   Lists & Grids
   ========================================================================== */
.vw-list {
  list-style: none;
  margin: 0 0 1rem 0;
  padding: 0;
  display: grid;
  gap: 15px;
}

ol.vw-list > li {
  list-style: none;
}

.vw-item {
  margin: 0;
}

#vw-key-facts .vw-item p {
    text-wrap-style: balance;
}

.vw-grid {
  display: grid;
  gap: var(--space-lg);
  grid-template-columns: 1fr 1fr;
}

.vw-item h3.vw-stat-header {
  font-size: 0.85rem;
  line-height: 1rem;
  margin: 0;
  color: var(--muted);
}

.vw-item p {
  margin: 4px 0 0 0;
}

.vw-dashboard-item[data-status="open"]:nth-child(1 of .vw-item[data-status="open"]), .vw-dashboard-item[data-status*="placed"]:nth-child(1 of .vw-item[data-status="not placed"]), .vw-dashboard-item[data-status="new"]:nth-child(1 of .vw-item[data-status="new"]) {
    grid-column: 1;
}

.vw-dashboard-link:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Form Fields & Input Elements
   ========================================================================== */
.vw-fields {
  display: grid;
  gap: var(--space-lg);
  margin: 0;
}

.vw-field {
  padding: var(--space-md);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}

.vw-field dt {
  font-family: var(--font-family-brand);
  font-weight: var(--font-weight-extrabold);
  margin-bottom: var(--space-sm);
  color: var(--dusk);
}

.vw-field dd {
  margin: 0;
  padding: 0;
  color: var(--charcoal);
}

.vw-field-separator {
  width: 100%;
  color: var(--cloud);
  border: none;
  border-top: 1px solid var(--border-color);
  margin: var(--space-lg) 0;
}

textarea.vs-notes-textarea {
  font-size: 1rem;
  padding: var(--space-md);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  width: 100%;
  min-height: 100px;
  resize: vertical;
}

textarea.vs-notes-textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: var(--focus-ring);
}

/* ==========================================================================
   Timelines & Activity Logs
   ========================================================================== */
.vw-timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--space-lg);
}

.vw-log {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-md);
  align-items: center;
}

.vw-timeline .vw-log:not(:last-child) {
  border-bottom: 1px solid var(--cloud);
  padding-bottom: 0.9rem;
}

.vw-log-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  width: 32px;
  border-radius: 50%;
  font-size: 0.78rem;
  background: #eef2f7;
  color: #374151;
  border: 1px solid var(--border-color);
}

.vw-log-type.call {
  background: #e8f5e9;
  color: var(--success);
  border-color: rgba(14, 138, 22, 0.2);
}

.vw-log-type.email {
  background: #e3f2fd;
  color: var(--info);
  border-color: rgba(21, 101, 192, 0.2);
}

.vw-log-type.text {
  background: #fff3e0;
  color: #ef6c00;
  border-color: rgba(239, 108, 0, 0.25);
}

.vw-log-date {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}

.vw-log-notes {
  margin: 0.2rem 0 0 0;
}

/* ==========================================================================
   Filters & Controls
   ========================================================================== */
.vw-filters {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  padding-bottom: 1px;
  margin-bottom: var(--space-lg);
}

.vw-contact-info {
  display: none;
  grid-column-start: 1;
  grid-column-end: span 2;
  text-align: right;
}

#vs-contact-info {
  font-size: 0.9rem;
  margin-bottom: 1rem;
  margin-left: 0.25rem;
}

/* ==========================================================================
   Icons & Visual Elements
   ========================================================================== */
.vw-card i[class*="fa-"] {
  position: relative;
  top: -1px;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media (min-width: 700px) {
  .vw-list {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 720px) {
  .vw-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 880px) {
  .vw-header--details {
    grid-template-columns: auto 1fr;
  }
}

@media (min-width: 1000px) {
  .vw-card--dashboard {
    padding: var(--space-sm) var(--space-md);
  }
  
  .vw-opp-title {
    font-size: 0.92rem !important;
  }

  .vw-title-status {
    font-size: 0.75rem;
    font-weight: bold;
  }
  
  .vw-sub-row {
    font-size: 0.78rem;
  }
  
  .vw-chip {
    padding: 3px 7px;
    font-size: 0.75rem;
  }
}

/* ==========================================================================
   Accessibility & Focus States
   ========================================================================== */
:where(a, button, .vw-btn):focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --border-color: #000000;
    --shadow-sm: none;
    --shadow-md: none;
    --shadow-lg: none;
  }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */
@media print {
  .vw-widget {
    max-width: none;
    margin: 0;
    padding: 0;
  }
  
  .vw-card {
    box-shadow: none;
    border: 1px solid #000;
  }
  
  .vw-btn {
    display: none;
  }
}