/**
 * Uiverse-inspired modern interactions for RepoLens
 * Patterns adapted for the Zephyr dark shell (white CTAs, near-black canvas).
 * Open-source UI patterns inspired by https://uiverse.io/ (MIT).
 */

/* ----- Primary CTA: shine sweep ----- */
.btn-primary,
.portal-content .btn-primary,
.portal-topbar .btn-primary,
.btn-login,
.btn-microsoft {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    transition:
        transform 0.22s var(--ease-smooth, ease),
        box-shadow 0.22s ease,
        background 0.22s ease,
        border-color 0.22s ease,
        color 0.22s ease;
}

.btn-primary::before,
.portal-content .btn-primary::before,
.portal-topbar .btn-primary::before,
.btn-login::before,
.btn-microsoft::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        105deg,
        transparent 35%,
        rgba(255, 255, 255, 0.55) 50%,
        transparent 65%
    );
    transform: translateX(-120%);
    transition: transform 0.55s ease;
    z-index: 0;
    pointer-events: none;
}

.btn-primary > *,
.portal-content .btn-primary > *,
.portal-topbar .btn-primary > *,
.btn-login > *,
.btn-microsoft > * {
    position: relative;
    z-index: 1;
}

.btn-primary:hover::before,
.portal-content .btn-primary:hover::before,
.portal-topbar .btn-primary:hover::before,
.btn-login:hover::before,
.btn-microsoft:hover::before {
    transform: translateX(120%);
}

.btn-primary:hover,
.portal-content .btn-primary:hover,
.portal-topbar .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 28px rgba(255, 255, 255, 0.12);
}

.btn-primary:active,
.portal-content .btn-primary:active {
    transform: translateY(0);
    box-shadow: none;
}

/* ----- Ghost / secondary: soft border pulse ----- */
.btn-ghost-pill,
.btn-secondary,
html[data-bs-theme="dark"] .btn-outline-secondary {
    transition:
        transform 0.2s ease,
        background 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.btn-ghost-pill:hover,
html[data-bs-theme="dark"] .btn-outline-secondary:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 8px 20px rgba(0, 0, 0, 0.35);
}

/* ----- Search: glass capsule ----- */
.search-box {
    position: relative;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.06),
        rgba(255, 255, 255, 0.02)
    );
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 8px 24px rgba(0, 0, 0, 0.28);
    transition:
        border-color 0.25s ease,
        box-shadow 0.25s ease,
        transform 0.25s ease;
}

.search-box:focus-within {
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        0 0 0 3px rgba(255, 255, 255, 0.06),
        0 12px 32px rgba(0, 0, 0, 0.4);
}

.toggle-btn {
    transition:
        background 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.toggle-btn.active {
    box-shadow: 0 2px 10px rgba(255, 255, 255, 0.18);
}

.toggle-btn:hover:not(.active) {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

/* ----- Sidebar analytics: slide accent ----- */
.btn-analytics {
    position: relative;
    overflow: hidden;
    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease,
        padding-left 0.2s ease;
}

.btn-analytics::before {
    content: "";
    position: absolute;
    left: 0;
    top: 18%;
    bottom: 18%;
    width: 3px;
    border-radius: 0 4px 4px 0;
    background: #ffffff;
    transform: scaleY(0);
    transition: transform 0.22s var(--ease-smooth, ease);
}

.btn-analytics:hover,
.btn-analytics.is-active,
.portal-app .sidebar .btn-analytics.is-active {
    transform: translateX(2px);
    padding-left: calc(16px + 2px);
}

.btn-analytics:hover::before,
.btn-analytics.is-active::before,
.portal-app .sidebar .btn-analytics.is-active::before {
    transform: scaleY(1);
}

.analytics-report-group {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    box-shadow: none;
    transition:
        border-color 0.2s ease,
        background 0.2s ease,
        box-shadow 0.2s ease;
}

.analytics-report-group:hover {
    border-color: var(--border-strong);
    background: rgba(255, 255, 255, 0.035);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25);
}

/* ----- Cards / panels: lift + edge light ----- */
.home-workspace,
.home-quick-action,
.home-analytics-card,
.portal-content .card,
.details-panel,
.org-stats-dashboard,
.login-card {
    transition:
        transform 0.25s var(--ease-smooth, ease),
        border-color 0.25s ease,
        box-shadow 0.25s ease,
        background 0.25s ease;
}

.home-quick-action:hover,
.home-analytics-card:hover,
.portal-content .card:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.04),
        0 16px 40px rgba(0, 0, 0, 0.45);
    background: rgba(255, 255, 255, 0.045);
}

.home-quick-action {
    position: relative;
    overflow: hidden;
}

.home-quick-action::after {
    content: "";
    position: absolute;
    inset: auto -20% -40% auto;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.12), transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.home-quick-action:hover::after {
    opacity: 1;
}

/* ----- Inputs: modern focus ring ----- */
.form-input,
.portal-content input,
.portal-content select,
.portal-content textarea,
html[data-bs-theme="dark"] .form-control,
html[data-bs-theme="dark"] .form-select,
.org-stats-days-input,
.org-stats-date-input,
.org-stats-select,
.org-stats-filter,
.report-insight-select,
.report-insight-filter {
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
}

.form-input:focus,
.portal-content input:focus,
.portal-content select:focus,
.portal-content textarea:focus,
html[data-bs-theme="dark"] .form-control:focus,
html[data-bs-theme="dark"] .form-select:focus,
.org-stats-days-input:focus,
.org-stats-date-input:focus,
.org-stats-select:focus,
.org-stats-filter:focus,
.report-insight-select:focus,
.report-insight-filter:focus {
    border-color: rgba(255, 255, 255, 0.4) !important;
    box-shadow:
        0 0 0 3px rgba(255, 255, 255, 0.07),
        0 8px 20px rgba(0, 0, 0, 0.25) !important;
}

/* ----- Stat chips / badges ----- */
.home-request-stat,
.org-stats-cards .stat,
.portal-content .stat {
    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        background 0.2s ease;
}

.home-request-stat:hover,
.portal-content .stat:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.05);
}

/* ----- Top bar icon buttons ----- */
.btn-reports-menu,
.btn-product-updates,
.btn-refresh-icon,
.btn-sidebar-toggle {
    transition:
        transform 0.2s ease,
        background 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease,
        box-shadow 0.2s ease;
}

.btn-reports-menu:hover,
.btn-product-updates:hover,
.btn-refresh-icon:hover:not(:disabled),
.btn-sidebar-toggle:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

/* ----- Login / glass card edge light ----- */
.login-card:hover {
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        0 28px 70px rgba(0, 0, 0, 0.55);
}

.btn-microsoft:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(255, 255, 255, 0.14);
}

/* ----- Tables: row lift ----- */
.portal-content table tbody tr,
.ops-table-wrap table tbody tr {
    transition: background 0.18s ease, box-shadow 0.18s ease;
}

.portal-content table tbody tr:hover,
.ops-table-wrap table tbody tr:hover {
    background: rgba(255, 255, 255, 0.035);
}

/* ----- Loading spinner (uiverse-like ring) ----- */
.loading-spinner,
#loading .spinner {
    border: 3px solid rgba(255, 255, 255, 0.12);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: uiverse-spin 0.75s linear infinite;
}

@keyframes uiverse-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ----- Hero subtle entrance ----- */
.zephyr-hero-title,
.zephyr-hero-tagline,
.zephyr-hero-copy,
.zephyr-hero-actions {
    animation: uiverse-fade-up 0.55s var(--ease-smooth, ease) both;
}

.zephyr-hero-tagline {
    animation-delay: 0.04s;
}

.zephyr-hero-copy {
    animation-delay: 0.08s;
}

.zephyr-hero-actions {
    animation-delay: 0.14s;
}

@keyframes uiverse-fade-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .btn-primary::before,
    .portal-content .btn-primary::before,
    .btn-login::before,
    .btn-microsoft::before,
    .zephyr-hero-title,
    .zephyr-hero-tagline,
    .zephyr-hero-copy,
    .zephyr-hero-actions,
    .home-quick-action,
    .portal-content .card,
    .btn-analytics {
        animation: none !important;
        transition: none !important;
    }

    .btn-primary:hover,
    .home-quick-action:hover,
    .portal-content .card:hover {
        transform: none;
    }
}
