/**
 * AccessIQ Dashboard Widget Styles
 * Loaded only on WP Admin → Dashboard (index.php).
 * All rules use the aiq-dw- prefix to avoid conflicts.
 *
 * @package AccessIQ
 */

/* ── Widget postbox overrides ──────────────────────────────── */
#accessiq_quick_stats,
#accessiq_top_pages,
#accessiq_device_chart,
#accessiq_recent_activity {
    background: #0d1828;
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 12px;
    color: #e2e8f0;
    box-shadow: none;
}

#accessiq_quick_stats .postbox-header,
#accessiq_top_pages .postbox-header,
#accessiq_device_chart .postbox-header,
#accessiq_recent_activity .postbox-header {
    background: transparent;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    border-radius: 12px 12px 0 0;
}

#accessiq_quick_stats .postbox-header h2,
#accessiq_top_pages .postbox-header h2,
#accessiq_device_chart .postbox-header h2,
#accessiq_recent_activity .postbox-header h2 {
    color: #8b9ab5;
    font-size: 12px;
    letter-spacing: 0.02em;
}

#accessiq_quick_stats .handlediv,
#accessiq_top_pages .handlediv,
#accessiq_device_chart .handlediv,
#accessiq_recent_activity .handlediv {
    color: #8b9ab5;
}

#accessiq_quick_stats .handlediv:hover,
#accessiq_top_pages .handlediv:hover,
#accessiq_device_chart .handlediv:hover,
#accessiq_recent_activity .handlediv:hover {
    color: #e2e8f0;
}

/* ── Quick Stats — 2×2 grid ────────────────────────────────── */
.aiq-dw-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.aiq-dw-stat-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.aiq-dw-stat-icon {
    font-size: 16px;
    line-height: 1;
    margin-bottom: 2px;
    display: block;
}

.aiq-dw-stat-label {
    font-size: 10px !important;
    letter-spacing: 0.07em;
    color: #8b9ab5 !important;
    text-transform: uppercase;
    font-weight: 500;
}

.aiq-dw-stat-number {
    font-size: 26px !important;
    font-weight: 700;
    color: #eef2f8 !important;
    line-height: 1.15;
    font-family: 'Syne', 'Inter', -apple-system, sans-serif;
}

/* Bounce rate color states */
.aiq-dw-bounce--red   { color: #f87171 !important; }
.aiq-dw-bounce--amber { color: #fbbf24 !important; }
.aiq-dw-bounce--green { color: #10d98e !important; }

/* ── Recent Clicks ──────────────────────────────────────────── */
.aiq-dw-clicks-list {
    display: flex;
    flex-direction: column;
}

.aiq-dw-click-row {
    display: flex !important;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 6px !important;
    border-bottom: 1px solid rgba(255,255,255,0.05) !important;
    border-radius: 6px;
    transition: background 0.15s;
    margin-bottom: 0 !important;
}

.aiq-dw-click-row:last-child {
    border-bottom: none !important;
}

.aiq-dw-click-row:hover {
    background: rgba(255,255,255,0.04);
}

.aiq-dw-click-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10d98e;
    flex-shrink: 0;
    margin-top: 4px;
    box-shadow: 0 0 6px rgba(16,217,142,0.45);
}

.aiq-dw-click-body {
    flex: 1;
    min-width: 0;
}

.aiq-dw-click-element {
    font-size: 12px;
    font-weight: 600;
    color: #818cf8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
}

.aiq-dw-click-meta {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 3px;
}

.aiq-dw-page-badge {
    display: inline-block;
    font-size: 10px;
    background: rgba(255,255,255,0.07);
    color: #8b9ab5;
    padding: 1px 7px;
    border-radius: 20px;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.aiq-dw-time-ago {
    font-size: 10px;
    color: #475569;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Top Pages ──────────────────────────────────────────────── */
.aiq-dw-page-row {
    margin-bottom: 11px !important;
    padding: 0 !important;
    border-bottom: none !important;
}

.aiq-dw-page-row:last-child {
    margin-bottom: 0 !important;
}

.aiq-dw-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.aiq-dw-page-url {
    font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', monospace;
    font-size: 12px;
    color: #e2e8f0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.aiq-dw-page-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.aiq-dw-sessions-pill {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    background: rgba(129,140,248,0.12);
    color: #818cf8;
    padding: 2px 8px;
    border-radius: 20px;
    border: 1px solid rgba(129,140,248,0.25);
    line-height: 1.4;
}

.aiq-dw-bounce-pct {
    font-size: 11px;
    font-weight: 500;
    color: #8b9ab5;
}

.aiq-dw-bar-bg {
    background: rgba(255,255,255,0.06);
    border-radius: 3px;
    height: 4px;
    width: 100%;
    overflow: hidden;
}

.aiq-dw-bar-fill {
    height: 4px;
    border-radius: 3px;
    background: linear-gradient(90deg, #818cf8, #10d98e);
    margin-top: 0 !important;
    transition: width 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

/* ── Empty state (shared) ───────────────────────────────────── */
.aiq-dw-empty-state {
    color: #8b9ab5;
    text-align: center;
    padding: 30px 0;
    font-size: 13px;
}

/* ── Device Breakdown Chart ─────────────────────────────────── */
.aiq-dw-device-wrap {
    height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.aiq-dw-device-wrap canvas {
    height: 200px !important;
    width: 100% !important;
}
