/* utilities.css — skeleton loaders, empty states, responsive, accessibility */

/* ─── ACCESSIBILITY: FOCUS RINGS ─── */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 2px;
}
:focus:not(:focus-visible) { outline: none; }

/* ─── SKELETON LOADERS ─── */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 2px;
}

.skeleton::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg,
    rgba(217,119,87,0.08) 0%,
    rgba(217,119,87,0.15) 50%,
    rgba(217,119,87,0.08) 100%);
  transform: translateX(-100%);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer { 100% { transform: translateX(100%); } }

.skeleton-line { height: 14px; margin: 8px 0; }
.skeleton-line.sm { height: 10px; width: 60%; }
.skeleton-item { height: 52px; margin: 8px 0; }
.skeleton-card { height: 72px; margin: 12px 0; }
.skeleton-wrap { padding: 12px 0; }

/* ─── ENHANCED EMPTY STATES ─── */
.empty-state-enhanced {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 48px 24px;
  gap: 14px;
}

.empty-state-enhanced .es-icon {
  font-size: 48px;
  line-height: 1;
  opacity: 0.85;
  filter: drop-shadow(0 0 12px rgba(217,119,87,0.15));
}

.empty-state-enhanced .es-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-style: italic;
  color: var(--gold);
  font-weight: 400;
}

.empty-state-enhanced .es-subtitle {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  line-height: 1.7;
  max-width: 320px;
}

.empty-state-enhanced .es-btn {
  margin-top: 6px;
  padding: 14px 28px;
  font-family: var(--font-ui);
  font-size: 12px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  background: var(--gold);
  color: var(--bg);
  border: 1px solid var(--gold);
  cursor: pointer;
  transition: all 0.2s;
}

.empty-state-enhanced .es-btn:hover {
  background: var(--gold2);
  border-color: var(--gold2);
  box-shadow: 0 0 20px rgba(217,119,87,0.3);
}

/* ─── SIDEBAR RITUAL SEARCH ─── */
.sidebar-search-wrap { position: relative; padding: 0 20px 12px; }

.sidebar-search-input {
  width: 100%;
  height: 28px;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 11px;
  padding: 0 28px 0 10px;
  outline: none;
  transition: border-color 0.15s;
}

.sidebar-search-input:focus { border-color: var(--gold); }
.sidebar-search-input::placeholder { color: var(--text-muted); }

.sidebar-search-clear {
  position: absolute;
  right: 26px; top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  display: none;
  padding: 4px;
}

.sidebar-search-clear:hover { color: var(--gold); }

.sidebar-search-empty {
  padding: 8px 20px;
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

/* ─── MINI TIMER INDICATOR (header) ─── */
.mini-timer {
  display: none;
  align-items: center;
  gap: 6px;
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--gold);
  padding: 4px 10px;
  border: 1px solid var(--border);
  background: var(--glow);
  cursor: pointer;
  letter-spacing: 0.08em;
}

.mini-timer.active { display: inline-flex; }

.mini-timer-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
  animation: pulse-dot 1.4s ease-in-out infinite;
}

/* ─── MARK ALL DONE BUTTON ─── */
.mark-all-done-btn {
  display: none;
  margin-top: 14px;
  padding: 6px 14px;
  background: none;
  border: 1px dashed var(--border-bright);
  color: var(--gold);
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
}

.mark-all-done-btn:hover { background: var(--glow); border-color: var(--gold); }
.mark-all-done-btn.visible { display: inline-block; }

/* ─── NAV FLASH (swipe feedback) ─── */
.nav-flash { animation: nav-flash-anim 0.4s ease; }

@keyframes nav-flash-anim {
  0%, 100% { box-shadow: none; }
  50% { box-shadow: 0 0 16px rgba(217,119,87,0.6); }
}

/* ─── KEYBOARD SHORTCUTS HINT ─── */
.kbd-hint {
  position: fixed;
  bottom: 24px; left: 24px;
  z-index: 9000;
  background: var(--bg2);
  border: 1px solid var(--border-bright);
  border-left: 3px solid var(--gold);
  padding: 14px 18px;
  max-width: 280px;
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.7;
  box-shadow: 0 6px 24px rgba(0,0,0,0.6);
}

.kbd-hint b { color: var(--gold); }

.kbd-hint kbd {
  display: inline-block;
  padding: 1px 6px;
  margin: 0 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 10px;
  color: var(--gold);
}

.kbd-hint-close {
  float: right;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  margin-left: 8px;
}

/* ─── MOBILE RESPONSIVE ─── */
@media (max-width: 768px) {
  /* Layout */
  #app {
    grid-template-columns: 1fr;
    grid-template-rows: 56px 1fr;
  }

  #app.sidebar-collapsed { grid-template-columns: 1fr; }

  /* Header adjustments */
  header { padding: 0 16px; gap: 8px; }
  .logo { font-size: 18px; letter-spacing: 0.3em; gap: 8px; }
  .logo-symbol { font-size: 16px; }
  .date-display { display: none; }

  .time-slider-container {
    position: fixed;
    top: 56px; left: 0; right: 0;
    max-width: 100%;
    margin: 0;
    padding: 8px 12px;
    border-left: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
    background: var(--bg2);
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  }

  .time-slider { height: 8px; }
  .time-indicator-time { font-size: 10px; padding: 2px 6px; }
  .streak-badge { font-size: 11px; padding: 4px 10px; gap: 6px; }
  .user-avatar { width: 32px; height: 32px; font-size: 12px; }
  .auth-btn { padding: 6px 16px; font-size: 12px; }
  .user-dropdown { right: 0; left: auto; min-width: 180px; }

  /* Sidebar becomes overlay */
  sidebar {
    position: fixed;
    top: 90px; left: 0; bottom: 64px;
    width: 280px;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
    opacity: 1;
    padding: 16px 0;
    box-shadow: 4px 0 12px rgba(0,0,0,0.3);
  }

  #app:not(.sidebar-collapsed) sidebar { transform: translateX(0); }
  #app.sidebar-collapsed sidebar { transform: translateX(-100%); width: 280px; padding: 16px 0; opacity: 1; border-right-color: var(--border); }

  #app:not(.sidebar-collapsed)::before {
    content: '';
    position: fixed; inset: 0;
    background: rgba(31,30,29,0.8);
    z-index: 49;
    backdrop-filter: blur(2px);
  }

  .sidebar-toggle { display: none; }
  main { grid-column: 1; }

  /* Bottom nav */
  .bottom-nav { height: 64px; padding: 0 8px; }
  .nav-tab { gap: 2px; padding: 6px 8px; max-width: none; }
  .nav-icon { font-size: 22px; }
  .nav-label { font-size: 10px; }
  .main-views { padding-top: 34px; padding-bottom: 64px; }

  /* Home view */
  .section-title { font-size: 11px; margin-bottom: 6px; padding-bottom: 6px; }
  .home-hero { padding: 24px 20px 20px; }
  .home-date-main { font-size: 17px; margin-bottom: 20px; }
  .home-ring-wrap { width: 130px; height: 130px; margin-bottom: 16px; }
  .arc-pct { font-size: 28px; }
  .home-progress-msg { font-size: 18px; margin-bottom: 6px; }
  .home-progress-sub { font-size: 10px; }
  .home-rituals-section { padding: 16px 14px; }
  .ritual-card { padding: 10px 12px; gap: 10px; }
  .rc-icon { font-size: 20px; }
  .rc-name { font-size: 15px; }
  .rc-meta { font-size: 11px; }
  .rc-check { width: 32px; height: 32px; font-size: 14px; flex-shrink: 0; }

  /* Timer view */
  #view-timer > div { padding: 12px; gap: 14px; }
  .timer-title { font-size: 11px; }
  .timer-display { width: 180px; height: 180px; }
  .timer-svg { width: 180px; height: 180px; }
  .timer-time { font-size: 42px; }
  .timer-presets { flex-wrap: wrap; justify-content: center; }
  .preset-btn { padding: 8px 16px; font-size: 10px; }
  .timer-controls { flex-direction: column; width: 100%; max-width: 280px; }
  .timer-controls .btn { width: 100%; padding: 14px 24px; font-size: 15px; }

  /* Journal view */
  .journal-ritual-select { font-size: 15px !important; padding: 8px 12px !important; }
  #timerQuote { font-size: 12px; padding: 0 20px; }
  #view-journal { padding: 12px; gap: 14px; }
  #view-journal > div { padding: 12px; gap: 14px; }
  .journal-editor { padding: 12px; }
  .journal-editor-header { flex-direction: column; gap: 12px; align-items: flex-start; }
  textarea { font-size: 15px; min-height: 150px; }
  .journal-entry { padding: 12px; }
  .je-date { font-size: 10px; }
  .je-preview { font-size: 13px; }

  /* History view */
  #view-history { padding: 12px; gap: 14px; }
  #view-history > div { padding: 12px; gap: 14px; }
  .history-scroll { max-height: 500px; }
  .year-calendar { gap: 16px; }
  .month-section { gap: 8px; }
  .month-section.current-month { padding: 10px; }
  .month-header { font-size: 15px; }
  .week-label { font-size: 11px; }
  .streak-stats { gap: 6px; flex-wrap: wrap; }
  .stat-box { padding: 10px 12px; flex: 1; min-width: 90px; }
  .stat-num { font-size: 28px; }
  .stat-label { font-size: 10px; }
  .history-grid { gap: 1px; max-width: 100%; }
  .day-cell { font-size: 12px; }

  /* Modal */
  .modal { width: calc(100% - 32px); max-width: 400px; padding: 24px; margin: 16px; }
  .modal-title { font-size: 20px; margin-bottom: 20px; padding-bottom: 10px; }
  .form-group { margin-bottom: 16px; }
  .form-input { padding: 12px; font-size: 16px; }
  .icon-picker { gap: 6px; }
  .icon-opt { width: 40px; height: 40px; font-size: 20px; }
  .modal-actions { flex-direction: column; gap: 10px; }
  .modal-actions .btn { width: 100%; padding: 14px 24px; }

  /* Sidebar items */
  .ritual-item { padding: 12px 14px; margin-bottom: 6px; }
  .ritual-icon { font-size: 18px; }
  .ritual-name { font-size: 15px; }
  .ritual-check { width: 24px; height: 24px; font-size: 11px; }
  .add-ritual-btn { margin: 12px 16px 0; padding: 12px; font-size: 14px; width: calc(280px - 32px); }

  /* Breadcrumbs */
  .breadcrumb-bar { padding: 8px 16px 12px; }
  .breadcrumb-label { font-size: 10px; margin-bottom: 8px; }
  .bc-text { font-size: 12px; max-width: 200px; }

  /* Buttons */
  .btn { padding: 12px 24px; font-size: 15px; min-height: 44px; }
  .main-view > div { padding: 12px !important; }

  /* Flow view */
  #view-flow > div { gap: 20px !important; }
  .accounts-summary { gap: 8px; margin-bottom: 0; }
  .summary-hero { padding: 16px 16px 14px; }
  .summary-hero-balance { font-size: 32px; margin-bottom: 4px; }
  .summary-net-flow { font-size: 11px; margin-bottom: 12px; }
  .summary-stats-row { gap: 8px; }
  .summary-stat { padding: 10px 12px; gap: 8px; }
  .summary-stat-icon { font-size: 16px; }
  .summary-stat-value { font-size: 15px; }
  #view-flow .todo-filter-tabs { margin-top: 4px !important; margin-bottom: 0; }
  #view-flow .section-title { margin-bottom: 0; padding-bottom: 4px; font-size: 11px; }
  #holdingsSection .btn, #loansSection .btn { padding: 8px 14px !important; font-size: 13px !important; min-height: 36px !important; }
  #holdingsSection > div:first-child, #loansSection > div:first-child { margin-top: 6px !important; margin-bottom: 6px !important; }
  .accounts-list { margin-bottom: 4px; gap: 8px; padding-bottom: 6px; }
  .account-card { min-width: 120px; }
  #accountsList .account-card { min-width: 0; width: calc(33.333% - 6px); flex-shrink: 0; }
  .account-icon-wrap { width: 36px; height: 36px; font-size: 16px; }
  .account-name { font-size: 12px; }
  .account-type { font-size: 10px; }
  .account-balance { font-size: 14px; padding: 7px 10px; }
  .loan-name { font-size: 14px; }
  .loan-stat-value { font-size: 13px; }
  .transactions-header { margin-top: 4px !important; margin-bottom: 8px; }
  .transactions-header .btn { padding: 8px 14px !important; font-size: 13px !important; min-height: 36px !important; }
  .day-navigator { padding: 6px 0; margin-bottom: 6px; gap: 5px; }
  .day-box { min-width: 46px; padding: 5px 7px; }
  .day-box-label { font-size: 10px; margin-bottom: 2px; }
  .day-box-date { font-size: 14px; margin-bottom: 2px; }
  .day-box-count { font-size: 10px; }
  .transaction-item { padding: 8px 12px; gap: 8px; }
  .transaction-icon { font-size: 16px; width: 28px; height: 28px; }
  .transaction-category { font-size: 13px; }
  .transaction-meta { font-size: 10px; }
  .transaction-amount { font-size: 15px; margin-top: 0; }
  .day-summary-label { font-size: 10px; }
  .day-summary-value { font-size: 14px; }

  /* To-Do view */
  .todo-hero { padding: 16px 14px 14px; }
  .todo-hero-header { gap: 10px; margin-bottom: 14px; }
  .todo-hero-title { font-size: 11px; }
  #view-todo .todo-filter-tab { padding: 8px 10px; font-size: 10px; }
  .todo-progress-ring { width: 64px; height: 64px; }
  .todo-ring-inner { width: 48px; height: 48px; }
  .todo-ring-pct { font-size: 16px; }
  .todo-stats-total-num { font-size: 26px; }
  .todo-stats-row { font-size: 10px; }
  .todo-list-section { padding: 14px 12px; }
  .todo-item { padding: 0; gap: 0; }
  .fab-create-task { bottom: 80px; right: 20px; width: 52px; height: 52px; font-size: 26px; }

  /* Projects/Sprint view */
  #view-projects { padding: 12px; gap: 14px; }
  .sprint-header { flex-direction: column; padding: 16px; gap: 16px; }
  .sprint-name { font-size: 18px; }
  .sprint-meta { flex-direction: column; gap: 8px; font-size: 11px; }
  .sprint-progress-bar { height: 6px; }
  .sprint-actions { width: 100%; flex-direction: column; }
  .sprint-actions .btn { width: 100%; padding: 10px 16px; font-size: 13px; }
  .sprint-selector { flex-direction: column; gap: 12px; }
  .sprint-selector > div { flex-direction: column; width: 100%; gap: 12px; }
  .sprint-selector .btn { width: 100%; }
  .backlog-toggle { width: 100%; padding: 12px 20px; font-size: 12px; }
  .kanban-container { flex-direction: row; gap: 12px; overflow-x: auto; overflow-y: hidden; padding-bottom: 16px; -webkit-overflow-scrolling: touch; }
  .kanban-container::-webkit-scrollbar { height: 8px; }
  .kanban-container::-webkit-scrollbar-track { background: var(--bg); border-radius: 4px; }
  .kanban-container::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 4px; }
  .kanban-container::-webkit-scrollbar-thumb:hover { background: var(--gold); }
  .kanban-column { min-width: 280px; width: 280px; flex-shrink: 0; padding: 12px; }
  .kanban-column-header { padding-bottom: 10px; margin-bottom: 12px; }
  .kanban-column-title { font-size: 16px; }
  .kanban-task { padding: 10px; }
  .kanban-task.expanded { padding: 12px; }
  .kanban-task-title { font-size: 14px; }
  .kanban-task-description { font-size: 11px; }
  .kanban-task-meta { font-size: 10px; flex-wrap: wrap; }
  .kanban-task-actions { flex-wrap: wrap; }
  .kanban-task-action { font-size: 11px; padding: 6px 10px; flex: 1 1 auto; min-width: 120px; }
  .task-points { width: 20px; height: 20px; font-size: 11px; margin-left: 6px; }
  .add-task-btn { padding: 12px; font-size: 13px; }
  #activeProjectSelect { font-size: 15px !important; padding: 12px !important; }
  .sprint-list-container { padding: 16px; }
  .sprint-list-item { flex-direction: column; gap: 10px; padding: 12px; align-items: flex-start; }
  .sprint-status-badge { font-size: 10px; padding: 3px 8px; align-self: flex-start; }
  .sprint-list-item-info { width: 100%; }
  .sprint-list-item-name { font-size: 16px; font-weight: 500; margin-bottom: 6px; }
  .sprint-list-item-dates { font-size: 11px; margin-bottom: 6px; }
  .sprint-list-item-stats { font-size: 11px; flex-wrap: wrap; gap: 8px; }
  .sprint-list-item-actions { width: 100%; flex-wrap: wrap; gap: 8px; }
  .sprint-action-btn { font-size: 11px; padding: 8px 12px; flex: 1 1 auto; min-width: 100px; text-align: center; }
  .sprint-view-toggle { gap: 6px; margin-bottom: 10px; }
  .sprint-view-btn { flex: 1; padding: 12px 16px; font-size: 12px; text-align: center; }
  .sprint-list-header { flex-direction: column; gap: 12px; align-items: stretch; }
  .sprint-list-header .btn { width: 100%; padding: 12px 16px; }
  .sprint-list-title { font-size: 11px; }
}

@media (max-width: 480px) {
  .logo { font-size: 16px; letter-spacing: 0.25em; }
  .streak-badge span:last-child { display: none; }
  .home-ring-wrap { width: 110px; height: 110px; }
  .arc-pct { font-size: 24px; }
  .home-progress-msg { font-size: 16px; }
  .timer-display { width: 160px; height: 160px; }
  .timer-svg { width: 160px; height: 160px; }
  .timer-time { font-size: 36px; }
  .year-calendar { gap: 20px; }
  .month-section { gap: 8px; }
  .month-section.current-month { padding: 10px; }
  .month-header { font-size: 14px; }
  .week-label { font-size: 11px; }
  .history-grid { gap: 1px; }
  .day-cell { font-size: 15px; }
  .modal { width: calc(100% - 24px); padding: 20px; }
  .modal { padding: 20px 16px; }
  .modal-box { padding: 16px; }
  .empty-state-enhanced { padding: 32px 16px; }
  .kbd-hint { display: none; }

  #view-flow { padding: 8px 10px; }
  .summary-hero-balance { font-size: 26px; }
  .summary-stat-value { font-size: 13px; }
  .account-card { min-width: 120px; padding: 8px 10px; }
  .transaction-item { padding: 7px 10px; }
  .transaction-amount { font-size: 14px; }
  .transaction-actions { width: 100%; justify-content: flex-end; margin-top: 6px; opacity: 1; }

  .sprint-list-item { padding: 14px; }
  .sprint-list-item-name { font-size: 15px; }
  .sprint-list-item-dates { font-size: 11px; }
  .sprint-list-item-stats { font-size: 11px; }
  .sprint-action-btn { font-size: 11px; padding: 10px 14px; min-width: 90px; }
  .sprint-view-btn { padding: 10px 12px; font-size: 11px; }
  .sprint-status-badge { font-size: 7px; padding: 2px 6px; }
}

@media (min-width: 769px) and (max-width: 1024px) {
  #app { grid-template-columns: 240px 1fr; }
  sidebar { width: 240px; }
  .sidebar-inner { width: 240px; min-width: 240px; }
  .add-ritual-btn { width: calc(240px - 40px); }
  #view-home, #view-journal > div, #view-history > div { padding: 32px; }
}
