/* User Analytics Report Stylesheet */

.user-analytics-wrapper {
    background-color: var(--bg-color, #f4f6f8);
    display: flex;
    flex-direction: column;
    min-height: 100%;
    position: relative;
}

/* Animated Loading Overlay */
.analytics-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1050;
    display: none;
    align-items: center;
    justify-content: center;
    transition: opacity 0.25s ease;
}

.analytics-loading-overlay.active {
    display: flex !important;
}

.analytics-loader-box {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 28px 36px;
    box-shadow: 0 15px 35px -5px rgba(6, 46, 82, 0.15), 0 0 0 1px rgba(6, 46, 82, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 380px;
    width: 90%;
    animation: analyticsFadeUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes analyticsFadeUp {
    from { opacity: 0; transform: translateY(12px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.analytics-spinner-ring {
    width: 64px;
    height: 64px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.analytics-spinner-ring .ring-track {
    position: absolute;
    inset: 0;
    border: 3.5px solid #e2e8f0;
    border-radius: 50%;
}

.analytics-spinner-ring .ring-glow {
    position: absolute;
    inset: 0;
    border: 3.5px solid transparent;
    border-top-color: var(--primary-color, #062E52);
    border-right-color: #2563eb;
    border-radius: 50%;
    animation: ringSpin 0.9s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

@keyframes ringSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.analytics-spinner-ring .ring-icon {
    font-size: 1.35rem;
    color: var(--primary-color, #062E52);
    animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(0.92); opacity: 0.8; }
    50% { transform: scale(1.08); opacity: 1; }
}

.analytics-loader-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #062E52;
    margin-bottom: 6px;
}

.analytics-loader-subtitle {
    font-size: 0.8rem;
    color: #64748b;
    line-height: 1.45;
    margin-bottom: 16px;
}

.analytics-loader-progress {
    width: 100%;
    height: 4px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.analytics-loader-progress-bar {
    position: absolute;
    height: 100%;
    width: 40%;
    background: linear-gradient(90deg, #062E52 0%, #2563eb 50%, #FF5C0A 100%);
    border-radius: 4px;
    animation: progressSlide 1.4s ease-in-out infinite;
}

@keyframes progressSlide {
    0% { left: -40%; width: 30%; }
    50% { left: 30%; width: 50%; }
    100% { left: 100%; width: 30%; }
}

/* 5-Column & 6-Column Grid Helpers */
.col-xl-five {
    flex: 0 0 100%;
    max-width: 100%;
}

.col-xl-six {
    flex: 0 0 100%;
    max-width: 100%;
}

@media (min-width: 576px) {
    .col-xl-five {
        flex: 0 0 50%;
        max-width: 50%;
    }
    .col-xl-six {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

@media (min-width: 992px) {
    .col-xl-six {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }
}

@media (min-width: 1200px) {
    .col-xl-five {
        flex: 0 0 20%;
        max-width: 20%;
    }
    .col-xl-six {
        flex: 0 0 16.666667%;
        max-width: 16.666667%;
    }
}

.analytics-card:hover {
    box-shadow: 0 8px 24px rgba(6, 46, 82, 0.08);
}

.analytics-card-header {
    background: #ffffff;
    padding: 14px 20px;
    border-bottom: 1px solid #eef2f6;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Small Card Metric Containers (Compact & Unified Navy/Blue Theme) */
.user-analytics-kpi-card {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(6, 46, 82, 0.04), 0 1px 2px rgba(6, 46, 82, 0.02);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 94px;
    height: 100%;
    position: relative;
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.user-analytics-kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #062E52 0%, #2563eb 100%);
    transition: opacity 0.25s ease;
}

.user-analytics-kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px -4px rgba(6, 46, 82, 0.1), 0 2px 6px rgba(6, 46, 82, 0.04);
    border-color: #93c5fd;
}

.kpi-card-header {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 10px;
}

.kpi-card-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #475569;
    letter-spacing: 0.6px;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.kpi-card-subtitle {
    font-size: 0.70rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kpi-card-subtitle i {
    font-size: 0.75rem;
    flex-shrink: 0;
}

.kpi-card-content {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: auto;
}

.kpi-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    background: #f0f7ff;
    color: #062E52;
    border: 1px solid #dbeafe;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background 0.2s ease, color 0.2s ease;
}

.user-analytics-kpi-card:hover .kpi-card-icon {
    transform: scale(1.08);
    background: #062E52;
    color: #ffffff;
    border-color: #062E52;
}

.kpi-card-val {
    font-size: 1.45rem;
    font-weight: 800;
    color: #062E52;
    line-height: 1;
    margin: 0;
    letter-spacing: -0.4px;
    white-space: nowrap;
}

/* Backward Compatibility Info Box Widgets */
.user-analytics-infobox {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 12px rgba(6, 46, 82, 0.04);
    display: flex;
    align-items: stretch;
    min-height: 96px;
    overflow: hidden;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
    position: relative;
}

.user-analytics-infobox:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(6, 46, 82, 0.08);
}

.user-analytics-infobox .infobox-icon-wrap {
    width: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.85rem;
    color: #ffffff;
    flex-shrink: 0;
}

.user-analytics-infobox .infobox-body {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
    min-width: 0;
}

.user-analytics-infobox .infobox-title {
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-analytics-infobox .infobox-val {
    font-size: 1.65rem;
    font-weight: 700;
    color: #062E52;
    line-height: 1.15;
    margin-bottom: 4px;
}

.user-analytics-infobox .infobox-meta {
    font-size: 0.72rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* AI Insights Cards (Unified Theme & Darkgreen Line Percentage) */
.ai-insight-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 1px 4px rgba(6, 46, 82, 0.04), 0 2px 6px rgba(6, 46, 82, 0.02);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-insight-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3.5px;
    background: linear-gradient(90deg, #062E52 0%, #2563eb 100%);
}

.ai-insight-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px -4px rgba(6, 46, 82, 0.12), 0 4px 10px rgba(6, 46, 82, 0.04);
    border-color: #93c5fd;
}

.ai-insight-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}

.ai-insight-icon-box {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
    background: #f0f7ff;
    color: #062E52;
    border: 1px solid #dbeafe;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), background 0.25s ease, color 0.25s ease;
}

.ai-insight-card:hover .ai-insight-icon-box {
    transform: scale(1.08);
    background: #062E52;
    color: #ffffff;
    border-color: #062E52;
}

.ai-insight-title {
    font-size: 1.02rem;
    font-weight: 700;
    color: #062E52;
    margin-bottom: 2px;
    line-height: 1.25;
    letter-spacing: -0.2px;
}

.ai-insight-category {
    font-size: 0.70rem;
    text-transform: uppercase;
    color: #64748b;
    font-weight: 700;
    letter-spacing: 0.6px;
}

.ai-insight-body {
    font-size: 0.84rem;
    color: #334155;
    line-height: 1.55;
    flex-grow: 1;
    margin-bottom: 16px;
}

.ai-insight-body strong {
    color: #062E52;
    font-weight: 700;
}

/* Line Percentage Progress above footer */
.ai-insight-progress-wrap {
    margin-top: auto;
    margin-bottom: 12px;
}

.ai-insight-progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.74rem;
    font-weight: 700;
    margin-bottom: 5px;
    color: #062E52;
}

.ai-insight-progress-label {
    color: #475569;
    font-size: 0.72rem;
    font-weight: 600;
}

.ai-insight-progress-track {
    width: 100%;
    height: 6px;
    background-color: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.ai-insight-progress-bar {
    height: 100%;
    background-color: #11532f; /* Darkgreen */
    border-radius: 999px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-insight-actionable {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.76rem;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* User directory photo */
.user-avatar-thumb {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid #e2e8f0;
}

.user-avatar-initials {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.78rem;
    color: #ffffff;
    background: linear-gradient(135deg, #062E52 0%, #1e40af 100%);
}

/* Status and Level badges are styled globally by coderstation.body.css */

/* Filter buttons */
.analytics-time-btn {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #475569;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.analytics-time-btn:hover {
    background: #f1f5f9;
    color: #062E52;
}

.analytics-time-btn.active {
    background: var(--primary-color, #062E52);
    color: #ffffff;
    border-color: var(--primary-color, #062E52);
}

/* Endpoint Traffic & Reliability Telemetry Table Padding */
#tableEndpointAnalysis th,
#tableEndpointAnalysis td {
    padding-top: 2px !important;
    padding-bottom: 2px !important;
    vertical-align: middle !important;
}

/* Action Telemetry Distribution Table Padding */
#tableActionLegend tr {
    height: 25px !important;
}

#tableActionLegend th,
#tableActionLegend td {
    height: 25px !important;
    padding-top: 2px !important;
    padding-bottom: 2px !important;
    vertical-align: middle !important;
    line-height: 1.25 !important;
}

/* ==========================================================================
   Coderstation Container Top Border Accent using --secondary-color
   ========================================================================== */
.user-analytics-wrapper .coderstation-card {
    border-top: 3.5px solid var(--secondary-color, #FF5C0A) !important;
    transition: border-top-width 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                border-top-color 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.user-analytics-wrapper .coderstation-card:hover:not(.no-hover) {
    border-top: 4.5px solid var(--secondary-color, #FF5C0A) !important;
    box-shadow: 0 -3px 14px rgba(255, 92, 10, 0.35), 0 10px 25px rgba(0, 0, 0, 0.08) !important;
}
