/* Owner: package P7 (Tool windows B and settings: Logo Studio, App Settings, Habits, Breathe, Wisdom and pinned quote, Clocky AI, Word Guess). Clockface Online rebrand overrides, linked last in the index.php head. */

/* =====================================================================
   Shared: 32px tool tile in the tool-window headers
   ===================================================================== */
:is(#habitsModal, #breatheModal, #quotesModal, #clockyAiModal, #wordGuessModal) .window-header .cfo-tool-icon {
    width: 32px;
    height: 32px;
    font-size: 15px;
}

/* =====================================================================
   App Settings (#optionsModal)
   ===================================================================== */
#optionsModal .pref-modal-title {
    margin: 0 0 var(--space-1);
    padding: 0 var(--space-8);
    font-size: 22px;
    line-height: 30px;
    font-weight: 700;
    color: var(--ink);
}
#optionsModal .pref-modal-title i { color: var(--primary-ink); margin-right: 6px; }
#optionsModal .pref-modal-intro { margin: 0 0 20px; font-size: 13px; line-height: 18px; color: var(--text-secondary); }

/* .pref-panel is shared with the account modals; here it is the subtle settings well. */
#optionsModal .pref-panel {
    background: var(--surface-subtle) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-lg);
}
#optionsModal .pref-panel-title {
    margin: 0;
    font-size: 13px;
    line-height: 18px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ink);
}
#optionsModal .pref-panel-title i { color: var(--primary-ink); margin-right: 6px; }
#optionsModal .pref-row-title { font-size: 14px; line-height: 20px; font-weight: 600; color: var(--text-primary); }
#optionsModal .pref-row-caption { font-size: 12px; line-height: 16px; color: var(--text-secondary); }
#optionsModal .pref-row { border-top: 1px solid var(--border); }
#optionsModal .pref-inset-row { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); }
#optionsModal .pref-value-badge { text-transform: none; letter-spacing: 0; font-size: 12px; height: 24px; }
#optionsModal .pref-locked-switch { display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; border-radius: var(--radius-pill); }
#optionsModal .cfo-btn-ghost { flex-shrink: 0; }

/* Theme picker: SegmentedTabs. The track sits on the subtle well, so it takes the surface colour. */
#optionsModal .theme-segmented-group {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-1);
    padding: var(--space-1);
    border-radius: var(--radius-md);
    background: var(--surface);
    border: 1px solid var(--border);
}
#optionsModal .theme-mode-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-width: 0;
    height: 36px;
    padding: 0 var(--space-3);
    border: 0;
    font: inherit;
    font-size: 14px;
    line-height: 20px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
#optionsModal .theme-mode-btn::after { content: ""; position: absolute; inset: -4px 0; }
#optionsModal .theme-mode-btn i { font-size: 13px; }
#optionsModal .theme-mode-btn.active { font-weight: 600; }

/* Dock manager rows (renderDockManager) */
#dockAppsManagerList .dock-manager-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-2) var(--space-1) var(--space-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    user-select: none;
    transition: transform 250ms var(--ease), background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease);
}
#dockAppsManagerList .dock-manager-item.pref-dragging {
    opacity: var(--disabled);
    background: var(--accent-tint);
    border-style: dashed;
    border-color: var(--accent);
}
#dockAppsManagerList .dock-manager-item.pref-drag-over {
    background: var(--accent-tint);
    border-color: var(--accent);
    transform: scale(1.02);
}
#dockAppsManagerList .dock-manager-grip { color: var(--text-tertiary); font-size: 12px; }
#dockAppsManagerList .dock-manager-icon { width: 32px; height: 32px; font-size: 14px; }
#dockAppsManagerList .dock-manager-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
#dockAppsManagerList .is-hidden-app .dock-manager-name { color: var(--text-tertiary); }
#dockAppsManagerList .cfo-icon-btn svg,
#dockAppsManagerList .cfo-icon-btn i { font-size: 12px; }

@media (prefers-reduced-motion: reduce) {
    #dockAppsManagerList .dock-manager-item.pref-drag-over { transform: none; }
}

/* =====================================================================
   Daily Habits (#habitsModal)
   ===================================================================== */
#habitsModal .habits-progress {
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
#habitsModal .habits-progress-text { margin-top: 2px; font-size: 16px; line-height: 22px; font-weight: 700; color: var(--ink); }
#habitsPercentBadge { height: 24px; font-size: 12px; letter-spacing: 0; }
#habitsPercentBadge.is-complete { background: var(--gold); color: var(--on-primary); box-shadow: none; }

#habitsModal .habit-form {
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
#habitsModal .habit-form-title { font-size: 14px; font-weight: 600; color: var(--ink); }
#habitsModal .habit-form-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
#habitsModal #habitNameInput { background: var(--surface) !important; font-size: 14px; }

#habitsModal .habit-icon-choice {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--border-control);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text-primary);
    font: inherit;
    font-size: 16px;
    cursor: pointer;
    transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
#habitsModal .habit-icon-choice:hover { background: var(--surface-hover); }
#habitsModal .habit-icon-choice.active,
#habitsModal .habit-icon-choice[aria-pressed="true"] {
    background: var(--accent-tint);
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent);
    color: var(--ink);
}

#habitsModal .habits-empty { color: var(--text-secondary); }
#habitsModal .habits-empty .cfo-tool-icon { display: grid; }
#habitsModal .habit-name { color: var(--text-primary) !important; }
#habitsModal .habit-action-btn { color: var(--text-secondary); }
#habitsModal .habit-action-btn i { font-size: 13px; }
#habitsModal .habit-action-delete:hover { color: var(--danger); background: var(--danger-tint); }
#habitsModal .habit-delete-confirm {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--space-1);
    flex-shrink: 0;
}
#habitsModal .habit-delete-label { font-size: 12px; font-weight: 600; color: var(--danger); }
#habitsModal .habit-delete-confirm .cfo-btn { height: 32px; padding: 0 var(--space-3); font-size: 13px; }

/* =====================================================================
   Zen Breathe (#breatheModal)
   ===================================================================== */
#breatheModal .breathe-preset-btn { flex: 1 0 auto; justify-content: center; padding: 0 var(--space-3); font-size: 13px; }
#breathePlayBtn.is-running { background: var(--accent); color: var(--on-primary); }
#breatheModal .breathe-stats {
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
#breatheModal .breathe-stat-label { font-size: 11px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; color: var(--text-secondary); }
#breatheModal .breathe-stat-value { margin-top: 1px; font-size: 15px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
#breatheModal .breathe-stat-divider { background: var(--border); }
#breatheSoundBtn[aria-pressed="false"] { color: var(--text-tertiary); }

/* Reduced motion: the orb fades between full and dim instead of growing (startBreathePhase sets --breathe-fade). */
@media (prefers-reduced-motion: reduce) {
    #breatheModal .breathe-orb-inner,
    #breatheModal .breathe-orb-outer {
        transform: none !important;
        transition-property: opacity !important;
        transition-duration: var(--breathe-fade, 1s) !important;
        transition-timing-function: linear !important;
    }
}

/* =====================================================================
   Daily Wisdom (#quotesModal) and the pinned quote
   ===================================================================== */
#quotesModal .quotes-cat-tab { flex-shrink: 0; padding: 0 var(--space-3); font-size: 13px; }
#quotesModal .quotes-cat-tab i { font-size: 11px; }
#quotesModal .quote-card-mark { font-size: 26px; color: var(--accent); }
#quotesModal .quote-card-text {
    margin: 0 0 16px 0;
    font-size: 17px;
    line-height: 1.6;
    font-weight: 400;
    font-style: italic;
    color: var(--ink);
}
#quotesModal .quote-card-footer { border-top: 1px solid var(--border); }
#quotesModal .quote-card-author { font-size: 14px; font-weight: 600; color: var(--accent-ink); }
#quotesModal .quote-card-context { font-size: 12px; color: var(--text-secondary); }
#quotesModal #quotePinToggleBtn.is-active {
    background: var(--accent-tint);
    color: var(--accent-ink);
    border-color: var(--accent);
}

#pinnedDesktopQuote .pinned-quote-mark { flex-shrink: 0; font-size: 14px; color: var(--on-glass); }
#pinnedDesktopQuote .pinned-quote-text {
    font-size: 13px;
    font-style: italic;
    color: var(--on-glass);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#pinnedDesktopQuote .pinned-quote-author { margin-top: 1px; font-size: 11px; font-weight: 600; color: var(--on-glass); }
#pinnedDesktopQuote .pinned-quote-unpin {
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--on-glass);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: background-color var(--dur-fast) var(--ease);
}
#pinnedDesktopQuote .pinned-quote-unpin:hover { background: var(--glass); }
/* Pale canvases: dim the glass so white text keeps its contrast. */
body.cfo-canvas-light #pinnedDesktopQuote { background: linear-gradient(var(--glass), var(--glass)), var(--glass-dim); }

/* =====================================================================
   Clocky AI (#clockyAiModal): the rest lives in its inline <style> block
   ===================================================================== */
#clockyAiModal .clocky-ai-copy-btn { color: var(--text-secondary); }
#clockyAiModal .clocky-ai-copy-btn:hover { color: var(--text-primary); }
#clockyAiModal #clockyAiLimitBanner .cfo-notice-body { color: var(--text-primary); font-size: 13px; line-height: 18px; }
#clockyAiModal #clockyAiUnavailableArea .cfo-tool-icon { width: 64px; height: 64px; border-radius: var(--radius-lg); font-size: 28px; }
#clockyAiModal .cfo-overline i { margin-right: 4px; }

/* =====================================================================
   Word Guess (#wordGuessModal)
   ===================================================================== */
#wordGuessModal .theme-tabs { flex-wrap: nowrap; overflow-x: auto; margin-bottom: 0; padding-bottom: var(--space-2); }
#wordGuessModal .theme-tab-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-shrink: 0;
    min-height: 36px;
    padding: 0 10px;
    font-size: 13px;
}
#wordGuessModal .wg-help-tab { min-width: 36px; padding: 0; }

#wordGuessModal .wg-streak-pill { font-size: 12px; font-weight: 700; color: var(--gold-ink); }
#wordGuessModeBadge.wg-badge-practice { background: var(--gold-tint); color: var(--gold-ink); box-shadow: none; }

#wordGuessModal .wg-result-card {
    padding: 14px;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
#wordGuessModal .wg-result-title { font-size: 18px; line-height: 26px; font-weight: 700; color: var(--ink); }
#wordGuessModal .wg-result-title.is-won { color: var(--primary-ink); }
#wordGuessModal .wg-result-title.is-lost { color: var(--danger); }
#wordGuessModal .wg-result-msg { font-size: 13px; color: var(--text-secondary); }

#wordGuessModal .wg-stat-tile {
    padding: 10px 4px;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
#wordGuessModal .wg-stat-value { font-size: 20px; line-height: 26px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
#wordGuessModal .wg-stat-streak { color: var(--gold-ink); }
#wordGuessModal .wg-stat-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-secondary); }
#wordGuessModal .wg-panel {
    padding: 12px;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
#wordGuessModal .wg-overline { font-size: 11px; line-height: 16px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-secondary); }
#wordGuessModal #wgLeaderboardMonth { color: var(--accent-ink); }

#wordGuessModal .wg-invite-banner {
    padding: 12px;
    background: var(--primary-tint);
    border: 1px solid var(--primary-line);
    border-radius: var(--radius-lg);
}
#wordGuessModal .wg-invite-title { font-size: 14px; font-weight: 600; color: var(--ink); }
#wordGuessModal .wg-invite-caption { font-size: 12px; color: var(--text-secondary); }

#wordGuessModal .segmented-control .seg-btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 32px; padding: 0 12px; font-size: 12px; }

/* Leaderboard rows are real buttons now: reset the browser button look, then match the shared rows. */
#wordGuessLeaderboardList button.leaderboard-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    min-height: 44px;
    margin: 0;
    padding: var(--space-2) var(--space-3);
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
#wordGuessLeaderboardList button.leaderboard-row:hover { background: var(--surface-hover); }
#wordGuessLeaderboardList button.leaderboard-row.is-me { background: var(--primary-tint); border-color: var(--primary-line); }
#wordGuessLeaderboardList .wg-lb-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: var(--text-primary) !important;
}
#wordGuessLeaderboardList .wg-lb-flag { margin-left: 3px; font-size: 13px !important; }
#wordGuessLeaderboardList .wg-lb-wins { font-size: 13px !important; font-weight: 700 !important; color: var(--primary-ink) !important; }
#wordGuessLeaderboardList .wg-lb-avg { font-size: 11px !important; font-weight: 400 !important; color: var(--text-secondary) !important; }

#wordGuessModal .wg-locked-card {
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
}
#wordGuessModal .wg-locked-icon { --tool: var(--gold); margin: 0 auto 12px; font-size: 20px; }
#wordGuessModal .wg-locked-title { margin-bottom: 6px; font-size: 15px; font-weight: 700; color: var(--ink); }
#wordGuessModal .wg-locked-text { font-size: 13px; color: var(--text-secondary); }
#wordGuessLeaderboardList .rank-badge { flex-shrink: 0; font-size: 11px !important; font-weight: 700 !important; }
