/**
 * DeepRoots 4.4 — Premium Power polish layer
 * Cross-page visual & interaction upgrades (showcase, dashboard, family tree).
 * Loads after deeproots-theme + v2-ui on all public DeepRoots pages.
 */

:root {
    --dr-premium-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --dr-premium-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --dr-premium-shadow-sm: 0 2px 8px rgba(5, 46, 36, 0.08), 0 1px 2px rgba(5, 46, 36, 0.04);
    --dr-premium-shadow: 0 8px 28px rgba(5, 46, 36, 0.11), 0 2px 6px rgba(5, 46, 36, 0.06);
    --dr-premium-shadow-lg: 0 20px 50px rgba(5, 46, 36, 0.16), 0 4px 12px rgba(5, 46, 36, 0.08);
    --dr-premium-glass: rgba(255, 255, 255, 0.92);
    --dr-premium-glass-border: rgba(163, 230, 53, 0.2);
    --dr-premium-ring: 0 0 0 3px rgba(163, 230, 53, 0.35);
}

/* ── Global typography & rendering ── */
body.deeproots-theme {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Subtle page reveal (disabled when user prefers reduced motion) */
@media (prefers-reduced-motion: no-preference) {
    body.deeproots-theme:not(.dr-app-ready) .dr-dashboard,
    body.deeproots-theme:not(.dr-app-ready) .container,
    body.deeproots-theme:not(.dr-app-ready) .dr-showcase {
        opacity: 0;
    }

    body.deeproots-theme.dr-app-ready .dr-dashboard,
    body.deeproots-theme.dr-app-ready .container,
    body.deeproots-theme.dr-app-ready .dr-showcase {
        opacity: 1;
        transition: opacity 0.4s var(--dr-premium-ease-out);
    }
}

/* ── Unified app headers ── */
header.modern-header.dr-tree-dash-header,
.dr-nav.dr-dash-header,
.deeproots-header.dr-showcase-site-header,
.dr-app-header {
    box-shadow:
        0 4px 24px rgba(5, 46, 36, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.dr-dash-stat__value,
.dr-tree-header__stats .dr-dash-stat__value {
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.12);
}

/* Header tool buttons — tree + dashboard */
header.modern-header .action-btn.dr-icon-btn,
.dr-dash-tool,
.dr-nav-quick .dr-dash-tool {
    transition:
        transform 0.18s var(--dr-premium-ease),
        background 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease,
        color 0.18s ease;
}

header.modern-header .action-btn.dr-icon-btn:hover,
.dr-dash-tool:hover {
    box-shadow: var(--dr-premium-shadow-sm);
}

header.modern-header .action-btn.dr-icon-btn:active,
.dr-dash-tool:active {
    transform: scale(0.94);
}

header.modern-header .action-btn.dr-icon-btn:focus-visible,
.dr-dash-tool:focus-visible,
.dr-btn:focus-visible,
button.user-avatar-small:focus-visible {
    outline: none;
    box-shadow: var(--dr-premium-ring);
}

/* ── Dropdown panels ── */
.dr-header-dropdown,
.user-dropdown,
.search-dropdown {
    border: 1px solid rgba(197, 232, 220, 0.85);
    box-shadow: var(--dr-premium-shadow-lg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.dropdown-item {
    transition: background 0.14s ease, color 0.14s ease;
}

.dropdown-item:hover,
.dropdown-item:focus-visible {
    background: rgba(204, 251, 241, 0.55);
}

/* ── Modals (tree + dashboard) ── */
.deeproots-theme .modal .modal-content,
.modal .modal-content {
    border: 1px solid var(--dr-premium-glass-border);
    box-shadow: var(--dr-premium-shadow-lg);
    border-radius: var(--dr-radius-lg, 16px);
    overflow: hidden;
}

.deeproots-theme .modal .dr-modal__header,
.modal .dr-modal__header {
    background: linear-gradient(180deg, #ecfdf5 0%, #ffffff 100%) !important;
    border-bottom-color: rgba(163, 230, 53, 0.25) !important;
}

.deeproots-theme .modal .dr-modal__title,
.modal .dr-modal__title {
    letter-spacing: -0.02em;
}

/* ── Dashboard ── */
.dr-dashboard .dr-feature,
.dr-dashboard .dr-v4-card {
    border: 1px solid rgba(197, 232, 220, 0.75);
    box-shadow: var(--dr-premium-shadow-sm);
    transition:
        transform 0.22s var(--dr-premium-ease),
        box-shadow 0.22s var(--dr-premium-ease),
        border-color 0.22s ease;
}

@media (hover: hover) {
    .dr-dashboard .dr-feature:hover,
    .dr-dashboard .dr-v4-card:hover {
        transform: translateY(-3px);
        box-shadow: var(--dr-premium-shadow);
        border-color: rgba(163, 230, 53, 0.45);
    }
}

.dr-section-title {
    letter-spacing: -0.025em;
}

.dr-dashboard .dr-feature-featured {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.98) 0%, rgba(236, 253, 245, 0.92) 100%);
    border-color: rgba(163, 230, 53, 0.35);
}

/* ── Showcase / login ── */
.dr-showcase .dr-hero__cta,
.dr-showcase .dr-btn-primary,
.deeproots-login-modal .dr-btn-primary {
    box-shadow: 0 4px 16px rgba(15, 118, 110, 0.35);
    transition: transform 0.18s var(--dr-premium-ease), box-shadow 0.18s ease, background 0.18s ease;
}

.dr-showcase .dr-hero__cta:hover,
.dr-showcase .dr-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(15, 118, 110, 0.4);
}

.dr-showcase .dr-feature-card {
    transition: transform 0.22s var(--dr-premium-ease), box-shadow 0.22s ease;
}

@media (hover: hover) {
    .dr-showcase .dr-feature-card:hover {
        transform: translateY(-2px);
        box-shadow: var(--dr-premium-shadow);
    }
}

/* ── Family tree ── */
.expand-collapse-group circle {
    filter: drop-shadow(0 2px 5px rgba(5, 46, 36, 0.28));
    transition: fill 0.18s ease, r 0.18s var(--dr-premium-ease), filter 0.18s ease;
}

.expand-collapse-group:hover circle {
    filter: drop-shadow(0 3px 8px rgba(5, 46, 36, 0.35));
}

.expand-collapse-icon line {
    transition: opacity 0.15s ease;
}

.search-results {
    border: 1px solid rgba(197, 232, 220, 0.9);
    box-shadow: var(--dr-premium-shadow-lg);
    border-radius: var(--dr-radius, 12px);
    overflow: hidden;
}

.search-result-item {
    transition: background 0.14s ease, color 0.14s ease;
}

.search-result-item:hover,
.search-result-item:focus-visible {
    background: rgba(204, 251, 241, 0.65);
}

.dr-header-dropdown__input.search-input:focus,
.dr-tree-filters__input:focus,
.dr-tree-filters__select:focus {
    box-shadow: 0 0 0 3px rgba(163, 230, 53, 0.28);
    border-color: var(--dr-primary, #0f766e);
}

/* Tree modals — cohesive premium shell */
.dr-stats-modal .modal-content,
.dr-relationship-modal .modal-content,
.dr-filters-modal .modal-content,
.dr-focus-modal .modal-content {
    box-shadow: var(--dr-premium-shadow-lg);
}

/* ── Toasts ── */
.dr-toast {
    box-shadow: var(--dr-premium-shadow);
    border: 1px solid rgba(197, 232, 220, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* ── Account menu ── */
.user-dropdown {
    border-radius: var(--dr-radius, 12px);
}

.user-info-header {
    background: linear-gradient(135deg, #ecfdf5 0%, #f0fdfa 100%) !important;
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    body.deeproots-theme:not(.dr-app-ready) .dr-dashboard,
    body.deeproots-theme:not(.dr-app-ready) .container,
    body.deeproots-theme:not(.dr-app-ready) .dr-showcase {
        opacity: 1;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
