/* ============================================================
   Perfect HOA — Dashboard Widgets
   Restyles the widget CARD CONTENT only. Grid layout classes
   (.row / .col-lg-*), .dashboard-widget, .widget-card-wrapper,
   .widget-resize-handle, .widget-drag-handle stay as-is — the
   drag/resize/sortable JS (dashboard-widgets-controller.js) and
   Bootstrap 12-col grid depend on those exact selectors.
   ============================================================ */

/* --- Card shell (overrides legacy .card look) --- */
.dashboard-widget .widget-card-wrapper.card {
  border: 1px solid var(--phoa-border);
  border-radius: var(--phoa-r-card);
  box-shadow: none;
  background: var(--phoa-card);
}

/* --- Resize handle: slim blue pill on the right edge, matching the
   new design's drag-to-resize affordance (replaces the old blue
   gradient strip + grip icon from dashboard-widgets.css). --- */
.dashboard-widget .widget-resize-handle {
  top: 50%;
  bottom: auto;
  right: -4px;
  transform: translateY(-50%);
  width: 7px;
  height: 42px;
  border-radius: 5px;
  background: var(--phoa-primary);
  box-shadow: 0 0 0 2px #fff, 0 2px 6px rgba(20, 30, 70, 0.25);
}

.dashboard-widget .widget-resize-handle:hover,
.dashboard-widget.is-resizing .widget-resize-handle {
  background: var(--phoa-primary-hover);
}

.dashboard-widget .widget-resize-handle i {
  display: none;
}

.dwidget-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* --- Header row shared by every widget --- */
.dwidget-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 10px;
}

.dwidget-head-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.dwidget-title {
  font-size: 15px;
  font-weight: var(--phoa-fw-bold);
  color: var(--phoa-text);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dwidget-viewall {
  font-size: 12px;
  font-weight: var(--phoa-fw-bold);
  letter-spacing: 0.06em;
  color: var(--phoa-primary);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.dwidget-viewall:hover {
  color: var(--phoa-primary-hover);
  text-decoration: none;
}

/* --- Drag handle (dot grid, matches new design) --- */
.dwidget-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 20px;
  margin-left: -2px;
  color: #C2CAD8;
  cursor: grab;
  flex-shrink: 0;
  opacity: 1;
}

.dwidget-drag-handle:active {
  cursor: grabbing;
}

.dwidget-bank .dwidget-drag-handle {
  color: rgba(255, 255, 255, 0.6);
}

.dwidget-bank .dwidget-viewall {
  color: rgba(255, 255, 255, 0.85);
}

.dwidget-bank .dwidget-viewall:hover {
  color: #fff;
}

/* --- Unread/count pill next to a title --- */
.dwidget-pill {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: var(--phoa-fw-bold);
  padding: 2px 8px;
  border-radius: var(--phoa-r-badge);
  flex-shrink: 0;
  color: var(--phoa-primary);
  background: var(--phoa-primary-tint-3);
}

.dwidget-pill-danger {
  color: var(--phoa-danger-text);
  background: var(--phoa-danger-bg);
}

.dwidget-pill-teal {
  color: #12A594;
  background: #E0F5F1;
}

/* --- 2x2 icon+stat grid (violations/collections/requests/work orders) --- */
.dwidget-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 14px;
}

.dwidget-stat {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.dwidget-stat-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dwidget-stat-icon svg {
  width: 17px;
  height: 17px;
}

.dwidget-stat-value {
  font-size: 22px;
  font-weight: var(--phoa-fw-extrabold);
  line-height: 1;
  color: var(--phoa-text);
}

.dwidget-stat-value-sm {
  font-size: 18px;
}

.dwidget-stat-label {
  font-size: 12px;
  color: var(--phoa-muted-3);
  margin-top: 3px;
}

/* icon color variants */
.dwidget-icon-primary { background: var(--phoa-primary-tint-3); color: var(--phoa-primary); }
.dwidget-icon-warning { background: var(--phoa-warning-bg-2); color: #E7A008; }
.dwidget-icon-danger  { background: var(--phoa-danger-bg); color: var(--phoa-danger-text); }
.dwidget-icon-success { background: var(--phoa-success-bg); color: var(--phoa-success-text); }
.dwidget-icon-purple  { background: var(--phoa-purple-bg); color: #7A4DED; }
.dwidget-icon-teal    { background: #E0F5F1; color: #12A594; }

/* --- Centered big-number stat (Payout Balance) --- */
.dwidget-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  padding: 6px 0;
}

.dwidget-center-eyebrow {
  font-size: 11px;
  font-weight: var(--phoa-fw-bold);
  letter-spacing: 0.1em;
  color: var(--phoa-muted-3);
  margin-bottom: 6px;
  text-transform: uppercase;
}

.dwidget-center-value {
  font-size: 32px;
  font-weight: var(--phoa-fw-extrabold);
  letter-spacing: -0.02em;
  color: var(--phoa-text);
}

.dwidget-center-note {
  font-size: 12px;
  color: var(--phoa-muted-3);
  margin-top: 4px;
}

.dwidget-progress-track {
  height: 8px;
  border-radius: 6px;
  background: var(--phoa-bg);
  overflow: hidden;
  margin-top: 14px;
}

.dwidget-progress-fill {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, #3B6EF6, #4d78ff);
}

.dwidget-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--phoa-muted-4);
  margin-top: 6px;
}

/* --- Bank Accounts (blue gradient card) --- */
.dwidget-bank {
  background: linear-gradient(140deg, #2748C9, #3B6EF6) !important;
  border: none !important;
  box-shadow: 0 12px 24px -14px rgba(59, 110, 246, 0.6) !important;
  color: #fff;
}

.dwidget-bank .dwidget-title {
  color: #fff;
}

.dwidget-bank-eyebrow {
  font-size: 11px;
  font-weight: var(--phoa-fw-bold);
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 4px;
  text-transform: uppercase;
}

.dwidget-bank-total {
  font-size: 30px;
  font-weight: var(--phoa-fw-extrabold);
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}

.dwidget-bank-scroll-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dwidget-bank-arrow {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s ease;
  padding: 0;
}

.dwidget-bank-arrow:hover {
  background: rgba(255, 255, 255, 0.24);
}

.dwidget-bank-scroll {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
}

.dwidget-bank-scroll::-webkit-scrollbar {
  display: none;
}

.dwidget-bank-account {
  flex: 0 0 calc(50% - 4px);
  scroll-snap-align: start;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 9px;
  padding: 9px 12px;
  min-width: 130px;
}

.dwidget-bank-account-balance {
  font-size: 16px;
  font-weight: var(--phoa-fw-bold);
}

.dwidget-bank-account-name {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.75);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dwidget-bank-empty {
  text-align: center;
}

.dwidget-bank-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  height: 36px;
  padding: 0 16px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: #fff;
  font-size: 13.5px;
  font-weight: var(--phoa-fw-bold);
  text-decoration: none;
  transition: background 0.12s ease;
}

.dwidget-bank-add-btn:hover {
  background: rgba(255, 255, 255, 0.24);
  color: #fff;
  text-decoration: none;
}

/* --- Invoiced vs Collected chart (inline SVG) --- */
.dwidget-chart-svg {
  flex: 1;
  min-height: 100px;
  width: 100%;
}

.dwidget-chart-legend {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}

.dwidget-chart-legend-bottom {
  margin-bottom: 0;
  margin-top: 14px;
  justify-content: center;
}

.dwidget-chart-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--phoa-muted-1);
}

.dwidget-chart-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

.dwidget-chart-axis {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--phoa-muted-4);
  margin-top: 6px;
  padding: 0 8px;
}

/* --- Invoice-style row (icon + amount/label + View button) --- */
.dwidget-invoice-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dwidget-invoice-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dwidget-invoice-row-amount {
  font-size: 16px;
  font-weight: var(--phoa-fw-extrabold);
  color: var(--phoa-text);
}

.dwidget-invoice-row-label {
  font-size: 12px;
  color: var(--phoa-muted-1);
}

.dwidget-view-btn {
  font-size: 13px;
  font-weight: var(--phoa-fw-semibold);
  color: var(--phoa-primary);
  padding: 6px 14px;
  border: 1px solid var(--phoa-border-input-2);
  border-radius: 8px;
  text-decoration: none;
  flex-shrink: 0;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.dwidget-view-btn:hover {
  border-color: var(--phoa-primary);
  background: var(--phoa-primary-tint);
  color: var(--phoa-primary);
  text-decoration: none;
}

/* --- List rows (expiring docs, upcoming events, inbox previews) --- */
.dwidget-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.dwidget-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
}

.dwidget-row + .dwidget-row {
  border-top: 1px solid var(--phoa-subtle-5);
}

.dwidget-row-badge {
  width: 46px;
  height: 46px;
  border-radius: 11px;
  background: var(--phoa-primary-tint-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dwidget-row-badge-month {
  font-size: 10px;
  font-weight: var(--phoa-fw-extrabold);
  letter-spacing: 0.05em;
  color: var(--phoa-primary);
  text-transform: uppercase;
}

.dwidget-row-badge-day {
  font-size: 17px;
  font-weight: var(--phoa-fw-extrabold);
  line-height: 1;
  color: var(--phoa-navy);
}

.dwidget-row-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: var(--phoa-fw-extrabold);
  flex-shrink: 0;
  color: var(--phoa-primary);
  background: var(--phoa-primary-tint-3);
}

.dwidget-row-body {
  flex: 1;
  min-width: 0;
}

.dwidget-row-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.dwidget-row-title {
  font-size: 14px;
  font-weight: var(--phoa-fw-bold);
  color: var(--phoa-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dwidget-row-title-muted {
  font-weight: var(--phoa-fw-semibold);
  color: var(--phoa-muted-1);
}

.dwidget-row-time {
  font-size: 12px;
  color: var(--phoa-muted-4);
  flex-shrink: 0;
}

.dwidget-row-sub {
  font-size: 12.5px;
  color: var(--phoa-muted-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}

.dwidget-row-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--phoa-primary);
  flex-shrink: 0;
}

.dwidget-row-link {
  text-decoration: none;
  color: inherit;
  display: block;
  width: 100%;
}

.dwidget-row-link:hover {
  text-decoration: none;
  color: inherit;
}

/* --- Simple badge chip used inside list rows (unit tag, reply count) --- */
.dwidget-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: var(--phoa-fw-semibold);
  color: var(--phoa-muted-1);
  background: var(--phoa-subtle-4);
  padding: 2px 8px;
  border-radius: 6px;
  margin-top: 6px;
  margin-right: 4px;
}

/* --- Empty state --- */
.dwidget-empty {
  text-align: center;
  padding: 40px 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.dwidget-empty svg {
  color: var(--phoa-muted-5);
  margin-bottom: 12px;
}

.dwidget-empty p {
  color: var(--phoa-muted-3);
  margin: 0 0 12px;
  font-size: 13.5px;
}

/* --- Action items alert strip --- */
.dwidget-alert {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 9px;
  background: var(--phoa-danger-bg);
  color: var(--phoa-danger-text);
  font-size: 13px;
  margin-bottom: 14px;
}

/* --- Priority tag chips (action items) --- */
.dwidget-tag {
  display: inline-flex;
  align-items: center;
  font-size: 10.5px;
  font-weight: var(--phoa-fw-bold);
  padding: 2px 8px;
  border-radius: 6px;
  margin-right: 6px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.dwidget-tag-urgent  { background: var(--phoa-danger-bg); color: var(--phoa-danger-text); }
.dwidget-tag-high    { background: var(--phoa-warning-bg-2); color: #E7A008; }
.dwidget-tag-low     { background: var(--phoa-subtle-4); color: var(--phoa-muted-1); }
.dwidget-tag-normal  { background: var(--phoa-primary-tint-3); color: var(--phoa-primary); }

/* --- Document expiry rows --- */
.dwidget-doc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 0;
  gap: 10px;
}

.dwidget-doc-row + .dwidget-doc-row {
  border-top: 1px solid var(--phoa-subtle-5);
}

.dwidget-doc-title {
  font-size: 13.5px;
  font-weight: var(--phoa-fw-bold);
  color: var(--phoa-text);
}

.dwidget-doc-sub {
  font-size: 12px;
  color: var(--phoa-muted-3);
}

.dwidget-doc-chip {
  font-size: 12px;
  font-weight: var(--phoa-fw-bold);
  padding: 4px 9px;
  border-radius: 6px;
  flex-shrink: 0;
  white-space: nowrap;
}

.dwidget-doc-chip-warning { color: #C08A1E; background: var(--phoa-warning-bg); }
.dwidget-doc-chip-success { color: var(--phoa-success-text); background: var(--phoa-success-bg); }
.dwidget-doc-chip-danger  { color: var(--phoa-danger-text); background: var(--phoa-danger-bg); }

/* --- Mark-done button (action items) --- */
.dwidget-done-btn {
  font-size: 12px;
  font-weight: var(--phoa-fw-semibold);
  color: var(--phoa-success-text);
  background: var(--phoa-success-bg);
  border: none;
  border-radius: 7px;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.dwidget-done-btn:hover {
  filter: brightness(0.95);
}

/* --- Customize Widgets floating button --- */
.widget-customize-btn {
  background: var(--phoa-primary);
  border-color: var(--phoa-primary);
  border-radius: var(--phoa-r-button);
  font-weight: var(--phoa-fw-bold);
  font-size: 14px;
}

.widget-customize-btn:hover {
  background: var(--phoa-primary-hover);
  border-color: var(--phoa-primary-hover);
}

/* --- Customize Widgets modal list --- */
.widget-settings-icon {
  background: var(--phoa-primary-tint-3);
  color: var(--phoa-primary);
  border-radius: var(--phoa-r-icon-btn);
}

.widget-toggle input:checked + .widget-toggle-slider {
  background-color: var(--phoa-primary);
}
