/* LifeSync AI — widgets.css : Dashboard widget grid, customize mode, widget gallery */

/* ───────── toolbar ───────── */
.dw-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.dw-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dw-edit-hint { flex: 1; min-width: 200px; font-size: 12px; color: var(--text3); }
.dw-toolbar .tb-btn:not(.primary) { display: inline-flex; align-items: center; gap: 4px; }   /* mobile.css hides plain .tb-btn on phones — keep these visible */
.dw-toolbar .tb-btn[hidden] { display: none; }
.dw-toolbar .tb-btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ───────── grid ───────── */
.dw-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: stretch; }
.dw { position: relative; min-width: 0; grid-column: span 4; border-radius: var(--radius); }
.dw[data-size="S"] { grid-column: span 1; }
.dw[data-size="M"] { grid-column: span 2; }
.dw[data-size="L"] { grid-column: span 4; }
.dw[hidden] { display: none !important; }
.dw > .card, .dw > .stat-card, .dw > .greeting-card, .dw > .quote-card { height: 100%; box-sizing: border-box; margin: 0; }
.dw > .stat-card:hover { transform: none; }

@media (max-width: 900px) {
  .dw-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .dw[data-size="S"] { grid-column: span 1; }
  .dw[data-size="M"], .dw[data-size="L"] { grid-column: span 2; }
}
@media (max-width: 640px) {
  .dw-grid { gap: 10px; }
}

/* ───────── customize mode ───────── */
.dw-editing .dw { outline: 2px dashed rgba(var(--accent-rgb), .45); outline-offset: 2px; cursor: grab; }
.dw-editing .dw > *:not(.dw-ctl) { pointer-events: none; user-select: none; -webkit-user-select: none; }
.dw.dw-dragging { opacity: .35; }
.dw.dw-over { outline: 2px solid var(--accent); background: rgba(var(--accent-rgb), .08); }

.dw-ctl { display: none; position: absolute; top: 6px; right: 6px; z-index: 5; gap: 4px; background: var(--bg2); border: 1px solid var(--border2); border-radius: 10px; padding: 3px; box-shadow: 0 4px 14px rgba(0, 0, 0, .35); }
.dw-editing .dw-ctl { display: flex; }
.dw-ctl button { min-width: 28px; height: 28px; border: 0; border-radius: 8px; background: var(--bg3); color: var(--text); font-size: 13px; font-weight: 700; cursor: pointer; line-height: 1; padding: 0 6px; }
.dw-ctl button:hover { background: var(--accent); color: #fff; }
.dw-ctl button.danger:hover { background: var(--red, #ef4444); }
.dw-ctl button:disabled { opacity: .35; cursor: default; }
.dw-ctl button:disabled:hover { background: var(--bg3); color: var(--text); }

/* ───────── shared bits for the new widgets ───────── */
.dw .card-title { justify-content: flex-start; }
.dw-count { font-size: 11px; font-weight: 600; color: var(--text3); margin-left: 2px; }
.dw-mini-btn { margin-left: auto; width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--border2); background: var(--bg3); color: var(--text); font-size: 14px; cursor: pointer; line-height: 1; }
.dw-mini-btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.dw-empty { text-align: center; color: var(--text3); font-size: 12px; padding: 18px 8px; }
.dw-more { font-size: 11px; color: var(--text3); text-align: center; margin-top: 6px; cursor: pointer; }
.dw-more:hover { color: var(--accent3); }

/* quick actions */
.dw-qa { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.dw[data-size="M"] .dw-qa { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dw-qa-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 12px 6px; border-radius: 14px; border: 1px solid var(--border2); background: var(--bg3); color: var(--text); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; transition: transform .15s, background .15s; }
.dw-qa-btn span { font-size: 20px; line-height: 1; }
.dw-qa-btn:hover { transform: translateY(-2px); background: var(--bg4); }
.dw-qa-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.dw-qa-btn.primary:hover { background: var(--accent2); }

/* today's tasks / habits rows */
.dw-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; margin-bottom: 6px; border-radius: var(--radius2); background: var(--bg3); border: 1px solid var(--border); }
.dw-row .task-check { flex: none; width: 20px; height: 20px; cursor: pointer; }
.dw-row-title { flex: 1; min-width: 0; font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dw-row-title.done-text { text-decoration: line-through; color: var(--text3); }
.dw-row-meta { font-size: 11px; color: var(--text3); flex: none; }
.dw-habit-check { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border2); background: transparent; color: #fff; font-size: 12px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.dw-habit-check.done { background: var(--green); border-color: var(--green); }
.dw-bar { height: 5px; border-radius: 4px; background: var(--bg3); overflow: hidden; margin-bottom: 10px; }
.dw-bar > i { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .3s; }

/* focus */
.dw-focus-num { font-size: 34px; font-weight: 800; letter-spacing: -1px; color: var(--text); line-height: 1.1; }
.dw-focus-btn { margin-top: 12px; width: 100%; }

/* ───────── widget gallery (modal) ───────── */
.dw-gal-head { font-size: 12px; color: var(--text3); margin: -4px 0 12px; }
.dw-gal-search { margin-bottom: 12px; }
.dw-gal-list { max-height: 55vh; overflow-y: auto; padding-right: 2px; }
.dw-gal-item { display: flex; align-items: center; gap: 12px; padding: 12px; margin-bottom: 8px; border-radius: var(--radius2); background: var(--bg3); border: 1px solid var(--border); }
.dw-gal-ico { flex: none; width: 42px; height: 42px; border-radius: 12px; background: rgba(var(--accent-rgb), .14); display: flex; align-items: center; justify-content: center; font-size: 20px; }
.dw-gal-txt { flex: 1; min-width: 0; }
.dw-gal-name { font-size: 13px; font-weight: 700; color: var(--text); }
.dw-gal-size { font-size: 11px; color: var(--accent3); font-weight: 600; margin: 1px 0 2px; }
.dw-gal-desc { font-size: 12px; color: var(--text2); line-height: 1.4; }
.dw-gal-btn { flex: none; padding: 7px 14px; border-radius: 10px; border: 1px solid var(--accent); background: var(--accent); color: #fff; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.dw-gal-btn.added { background: transparent; color: var(--text2); border-color: var(--border2); }
.dw-gal-btn:hover { filter: brightness(1.1); }
.dw-gal-none { text-align: center; color: var(--text3); font-size: 13px; padding: 24px 8px; }
