/* ============================================================================
   Dashboard widgets - .widget wrappers, top_stats, progress bars, tile grid
   ============================================================================ */

body.theme-new .widget {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    color: var(--text-main);
    box-shadow: var(--shadow-soft);
    margin-bottom: 20px;
    overflow: hidden;
    transition:
        transform var(--transition-speed) var(--ease-standard),
        box-shadow var(--transition-speed) var(--ease-standard);
}

body.theme-new .widget:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

body.theme-new .widget-dragger {
    color: var(--text-muted);
    cursor: grab;
}

body.theme-new .widget-dragger:active {
    cursor: grabbing;
}

/* Top stats wrapper on dashboard - tile geometry per
   DASHBOARD_WIDGET_STYLE_GUIDE.md § 4. Each direct child is one tile. */
body.theme-new .top_stats_wrapper {
    background: transparent;
}

body.theme-new .top_stats_wrapper > div {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 24px 16px 20px;
    transition:
        transform var(--transition-speed) var(--ease-standard),
        box-shadow var(--transition-speed) var(--ease-standard),
        border-color var(--transition-speed) var(--ease-standard);
}

body.theme-new .top_stats_wrapper > div:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    border-color: var(--border-color);
}

/* Tile icon halo - the small colored square at the top of each tile.
   Perfex markup uses tw-bg-{color}-50 wrappers; size them to docs spec. */
body.theme-new .top_stats_wrapper > div [class*="tw-bg-"][class*="-50"],
body.theme-new .top_stats_wrapper > div [class*="tw-bg-"][class*="-100"] {
    width: 48px !important;
    height: 48px !important;
    border-radius: 14px !important;
    margin-bottom: 14px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

body.theme-new .top_stats_wrapper > div [class*="tw-bg-"][class*="-50"] svg,
body.theme-new .top_stats_wrapper > div [class*="tw-bg-"][class*="-100"] svg {
    width: 22px !important;
    height: 22px !important;
}

/* The stat value number that count-up animates */
body.theme-new [data-stat-value],
body.theme-new .pp-stat-value {
    color: var(--text-heading);
    font-weight: 700;
    font-size: clamp(20px, 2vw, 28px);
    line-height: 1;
    font-variant-numeric: tabular-nums;
    transition: color var(--transition-speed) var(--ease-standard);
}

/* Live ticker pulse (PR 3 JS attaches .pp-live to the ticker element) */
body.theme-new .pp-live-tick {
    animation: ppLiveTick 600ms var(--ease-out-soft);
}

@keyframes ppLiveTick {
    0%   { color: var(--text-heading); transform: translateY(0); }
    30%  { color: var(--primary-color); transform: translateY(-2px); }
    100% { color: var(--text-heading); transform: translateY(0); }
}

/* Progress bars (Perfex .progress / .progress-bar) */
body.theme-new .progress {
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    box-shadow: none;
    height: 8px;
    overflow: hidden;
}

body.theme-new .progress-bar {
    background: var(--primary-color);
    border-radius: var(--radius-full);
    box-shadow: none;
    transition: width var(--transition-slow) var(--ease-standard);
}

body.theme-new .progress-bar-success { background: var(--success-color); }
body.theme-new .progress-bar-danger  { background: var(--danger-color); }
body.theme-new .progress-bar-warning { background: var(--warning-color); }
body.theme-new .progress-bar-info    { background: var(--info-color); }

/* Generic tile grid pattern for dashboard widgets (PR 3 spec, future widgets) */
body.theme-new .pp-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-soft);
    gap: 12px;
}

body.theme-new .pp-widget-header h5 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-heading);
}

body.theme-new .pp-widget-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    padding: 18px;
}

body.theme-new .pp-widget-tile {
    background: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 24px 16px 20px;
    transition:
        transform var(--transition-speed) var(--ease-standard),
        box-shadow var(--transition-speed) var(--ease-standard);
}

body.theme-new .pp-widget-tile:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

@media (prefers-reduced-motion: reduce) {
    body.theme-new .widget,
    body.theme-new .top_stats_wrapper > div,
    body.theme-new .pp-widget-tile,
    body.theme-new .progress-bar,
    body.theme-new [data-stat-value],
    body.theme-new .pp-live-tick {
        transition: none !important;
        animation: none !important;
    }
    body.theme-new .widget:hover,
    body.theme-new .top_stats_wrapper > div:hover,
    body.theme-new .pp-widget-tile:hover {
        transform: none !important;
    }
}
