/* Advanced Dashboard Features */

/* Wobble Hover Effect for Live Stats */
.wobble-hover {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.wobble-hover:hover {
    transform: translateY(-5px) rotate(1deg);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.wobble-hover:nth-child(even):hover {
    transform: translateY(-5px) rotate(-1deg);
}

/* Skeleton Shimmer Effect */
.skeleton {
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0.03) 25%,
            rgba(255, 255, 255, 0.08) 37%,
            rgba(255, 255, 255, 0.03) 63%);
    background-size: 400% 100%;
    animation: shimmer 1.4s infinite;
    border-radius: 4px;
}

body.light-mode .skeleton {
    background: linear-gradient(90deg,
            rgba(0, 0, 0, 0.03) 25%,
            rgba(0, 0, 0, 0.08) 37%,
            rgba(0, 0, 0, 0.03) 63%);
    background-size: 400% 100%;
}

@keyframes shimmer {
    0% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.skeleton-text {
    height: 1rem;
    width: 100%;
    margin-bottom: 0.5rem;
}

.skeleton-title {
    height: 2rem;
    width: 60%;
    margin-bottom: 1rem;
}

.skeleton-avatar {
    height: 40px;
    width: 40px;
    border-radius: 50%;
}

.skeleton-card {
    height: 120px;
    width: 100%;
    border-radius: 12px;
}

/* Live Counter Pulse */
@keyframes pulse-text {
    0% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.live-counter {
    transition: color 0.2s ease;
}

/* Quick Action Cards */
.quick-action-card:hover {
    background: rgba(108, 99, 255, 0.1);
    border-color: var(--primary);
    transform: translateY(-5px);
}

/* Readiness Meter Animations */
@keyframes fill-bar {
    from {
        width: 0%;
    }
}

/* AI Loader Animations */
.loader-pro {
    width: 48px;
    height: 48px;
    border: 5px solid rgba(123, 97, 255, 0.2);
    border-bottom-color: var(--primary);
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
}

.spin-loader {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: rotation 0.8s linear infinite;
    margin-right: 0.5rem;
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes slideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Tooltip Styles */
.chip.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(123, 97, 255, 0.4);
}

/* --- Advanced Leaderboard System --- */

.leaderboard-container {
    display: grid;
    grid-template-columns: 2.5fr 1fr;
    gap: 2rem;
    animation: slideIn 0.5s ease-out;
}

.leaderboard-main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.leaderboard-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-glass);
}

.lb-tabs,
.time-filters {
    display: flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.3rem;
    border-radius: 8px;
}

.lb-tab,
.time-filter {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.lb-tab.active,
.time-filter.active {
    background: var(--primary);
    color: white;
}

.lb-entry {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 1.2rem 1.5rem;
    border-radius: 12px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    animation: slideIn 0.3s ease-out;
}

.lb-entry:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border-primary);
    transform: translateX(5px);
}

.lb-entry {
    display: grid;
    grid-template-columns: 80px 1fr 120px;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
    gap: 1.5rem;
    margin-bottom: 0.8rem;
}

.lb-entry:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.lb-entry.top-3 {
    background: linear-gradient(90deg, rgba(123, 97, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
}

.lb-entry.rank-1 {
    border-color: rgba(255, 215, 0, 0.3);
}

.lb-entry.rank-2 {
    border-color: rgba(192, 192, 192, 0.3);
}

.lb-entry.rank-3 {
    border-color: rgba(205, 127, 50, 0.3);
}

.lb-rank {
    font-size: 1.25rem;
    font-weight: 800;
    text-align: center;
    color: var(--text-dim);
}

.lb-rank.rank-1 {
    font-size: 2rem;
}

.lb-user-content {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    overflow: hidden;
}

.lb-avatar-container {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: visible;
}

.lb-avatar-container img {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    object-fit: contain;
    padding: 4px;
    background: white;
    /* Logo fallback background */
}

.lb-avatar-letter {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
}

.lb-badge {
    position: absolute;
    bottom: -5px;
    right: -5px;
    background: var(--primary);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    border: 2px solid #0d0d0d;
    z-index: 2;
}

.lb-info h4 {
    margin: 0;
    font-size: 1.05rem;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lb-info p {
    margin: 0.2rem 0 0 0;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.lb-score {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.lb-score .score-val {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--secondary);
}

.lb-score .score-label {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Sidebar Widgets */
.lb-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.personal-rank-card {
    background: linear-gradient(135deg, rgba(123, 97, 255, 0.1), rgba(0, 0, 0, 0.2));
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--border-primary);
    position: relative;
    overflow: hidden;
}

.personal-rank-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(123, 97, 255, 0.1) 0%, transparent 60%);
    animation: rotation 10s linear infinite;
}

.rank-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
}

.rank-stat .label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.rank-stat .value {
    font-weight: 700;
    font-size: 1.1rem;
}

.rank-change {
    font-size: 0.8rem;
    padding: 2px 6px;
    border-radius: 4px;
}

.rank-up {
    color: var(--success);
    background: rgba(0, 255, 148, 0.1);
}

.rank-down {
    color: var(--accent);
    background: rgba(255, 45, 149, 0.1);
}

/* Activity Feed */
.activity-feed {
    max-height: 400px;
    overflow-y: hidden;
    position: relative;
}

.activity-item {
    display: flex;
    gap: 0.8rem;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border-glass);
    font-size: 0.85rem;
    animation: slideIn 0.3s ease-out;
}

.activity-icon {
    font-size: 1.2rem;
}

.activity-text strong {
    color: var(--text-main);
}

.activity-meta {
    display: block;
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 2px;
}

/* Badges */
.badge-mini {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: #FFD700;
    color: black;
    border-radius: 50%;
    font-size: 10px;
    position: absolute;
    bottom: -2px;
    right: -2px;
    border: 2px solid #1a1a1a;
}

@media (max-width: 1024px) {
    .leaderboard-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .leaderboard-controls {
        width: 100%;
        justify-content: center;
    }

    .lb-tabs,
    .time-filters {
        height: auto;
        flex-wrap: wrap;
        width: 100%;
        justify-content: center;
    }

    .lb-tab,
    .time-filter {
        flex: 1 1 auto;
        text-align: center;
        white-space: nowrap;
    }

    .lb-entry {
        grid-template-columns: auto 1fr auto;
        gap: 0.75rem;
        padding: 1rem;
    }

    .lb-rank {
        grid-column: auto;
        font-size: 1.1rem;
    }

    .lb-user-content {
        gap: 0.75rem;
    }

    .lb-avatar-container {
        width: 40px;
        height: 40px;
        min-width: 40px;
    }

    .lb-score .score-val {
        font-size: 1rem;
    }

    .detailed-item.glass-card {
        padding: 1.25rem;
    }

    .item-left {
        flex-direction: column;
        gap: 1rem;
    }

    .btn-download-pro {
        width: 100%;
        justify-content: center;
    }
}

/* --- Premium Notes Cards (Updated Design) --- */

.detailed-item.glass-card {
    background: rgba(23, 23, 23, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 1rem;
}

.detailed-item.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(30, 30, 30, 0.6);
    transform: translateY(-2px);
}

.item-left {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
}

.file-type-icon {
    width: 40px;
    height: 40px;
    background: rgba(0, 194, 255, 0.1);
    color: #00c2ff;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 1.25rem;
}

.item-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
    margin-bottom: 0.25rem;
}

.item-meta-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.9rem;
}

.uploader-mini {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.uploader-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #374151;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
}

.item-engagement-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-top: 1rem;
    color: rgba(255, 255, 255, 0.4);
}

.eng-icon {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    transition: color 0.2s;
    font-size: 0.9rem;
}

.eng-icon:hover {
    color: white;
}

.btn-download-pro {
    background: white;
    color: black;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-download-pro:hover {
    background: #f3f4f6;
    transform: scale(1.02);
}

.btn-download-pro i {
    font-size: 0.9rem;
}

/* --- Pulse Dot & Graph Header Refinements --- */
.live-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.pulse-dot {
    width: 10px;
    height: 10px;
    background: #00ff88;
    border-radius: 50%;
    display: inline-block;
    position: relative;
}

.pulse-dot::after {
    content: "";
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #00ff88;
    animation: pulse 1.5s infinite;
    opacity: .6;
    top: 0;
    left: 0;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: .6;
    }

    70% {
        transform: scale(2.2);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 0;
    }
}

.live-text {
    font-size: 0.8rem;
    color: #00ff88;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.graph-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

#monthSelector {
    background: #0f141c;
    color: white;
    border: 1px solid rgba(255, 255, 255, .1);
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

#monthSelector:hover {
    border-color: rgba(255, 255, 255, 0.2);
}