/* =========================================
   Design Modernization - Glassmorphism & UX
   ========================================= */

:root {
    --primary-rgb: 79, 70, 229; /* #4f46e5 */
    --primary-hover-rgb: 67, 56, 202; /* #4338ca */
}

[data-theme="dark"] {
    --primary-rgb: 99, 102, 241; /* #6366f1 */
}

/* 1. Real Glassmorphism Effect */
.glass {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] .glass {
    background: rgba(15, 23, 42, 0.85) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
}

/* Advanced Glass Card */
.glass-card {
    background: rgba(255, 255, 255, 0.7) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07) !important;
    border-radius: var(--radius-lg) !important;
}

[data-theme="dark"] .glass-card {
    background: rgba(30, 41, 59, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3) !important;
}

/* Navbar Layout & Spacing */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1050 !important;
    padding: 0.75rem 0;
    transition: all 0.3s ease;
}

/* Navbar Brand */
.navbar-brand {
    font-weight: 800;
    letter-spacing: -0.5px;
    font-size: 1.4rem;
    color: var(--text-primary) !important;
    display: flex;
    align-items: center;
}

.navbar-brand img {
    margin-right: 10px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

/* Navbar Links Modernization */
.navbar-collapse {
    align-items: center;
}

.navbar-nav {
    gap: 5px;
    align-items: center; /* Ensure vertical centering */
}

.navbar-nav .nav-link {
    border-radius: 50px; /* Pill shape */
    padding: 0.6rem 1.2rem !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-secondary) !important;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap !important; /* Force no wrap */
    flex-shrink: 0; /* Prevent shrinking */
}

.navbar-nav .nav-link i {
    font-size: 1.1rem;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

/* Hover State */
.navbar-nav .nav-link:hover {
    background-color: var(--bg-tertiary);
    color: var(--primary-color) !important;
    transform: translateY(-1px);
}

.navbar-nav .nav-link:hover i {
    color: var(--primary-color);
}

[data-theme="dark"] .navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

/* Active State */
.navbar-nav .nav-link.active {
    background-color: rgba(var(--primary-rgb), 0.1);
    color: var(--primary-color) !important;
}

.navbar-nav .nav-link.active i {
    color: var(--primary-color);
}

[data-theme="dark"] .navbar-nav .nav-link.active {
    background-color: rgba(var(--primary-rgb), 0.2);
}

/* =========================================
   Utilities & Animations
   ========================================= */
.hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
    transform: translateY(-3px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

.hover-underline:hover {
    text-decoration: underline !important;
}

/* =========================================
   Stat Cards (Dashboard & Stats)
   ========================================= */
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 2rem 1.5rem;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.stat-card .stat-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    background: rgba(var(--primary-rgb), 0.1);
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.stat-card:hover .stat-icon {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.stat-card .stat-label {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-card .icon-circle {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1.2rem;
}

/* =========================================
   Star Rating
   ========================================= */
.star-rating .star {
    font-size: 1.2rem;
    transition: color 0.2s;
}

.star-rating .star:hover {
    color: var(--warning-color);
}

/* =========================================
   XP Bar & Footer
   ========================================= */
.xp-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 120px;
}

.nav-xp-bar {
    height: 6px;
    background: rgba(0,0,0,0.05);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 4px;
}

[data-theme="dark"] .nav-xp-bar {
    background: rgba(255,255,255,0.1);
}

.nav-xp-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-secondary));
    border-radius: 10px;
}

/* =========================================
   Hero Search Bar
   ========================================= */
.search-container {
    margin-bottom: 2.5rem;
}

.hero-search-container {
    position: relative;
    z-index: 10;
}

.hero-search-input {
    height: 100%;
    border-radius: 999px !important;
    border: none !important;
    box-shadow: none;
    font-size: 1rem;
    padding-left: 0;
}

.hero-search-btn {
    height: 64px; /* Ensure match with input */
    border-radius: 0 32px 32px 0 !important;
    padding-left: 1.5rem;
    padding-right: 2rem;
    background: var(--primary-color);
    color: white;
    border: none;
    font-size: 1.2rem;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-search-btn:hover {
    background: var(--primary-hover);
}

.discord-hero-btn {
    height: 64px;
    border-radius: 999px;
    padding-left: 2.5rem;
    padding-right: 2.5rem;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-primary));
    background-size: 200% 100%;
    color: #ffffff;
    border: none;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    box-shadow: 0 12px 30px rgba(79, 70, 229, 0.55);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-position 0.3s ease, filter 0.2s ease;
    text-decoration: none;
}

.discord-hero-btn:hover {
    background-position: 100% 0;
    transform: translateY(-2px);
    box-shadow: 0 18px 45px rgba(79, 70, 229, 0.7);
    filter: brightness(1.05);
    color: #ffffff;
}

/* =========================================
   Mobile Optimizations (Responsiveness)
   ========================================= */
@media (max-width: 767.98px) {
    /* Action Buttons: Full width & comfortable touch targets */
    .d-grid.gap-3 button,
    .d-grid.gap-3 a.btn {
        width: 100%;
        padding-top: 0.8rem !important;
        padding-bottom: 0.8rem !important;
        /* Reduce side padding on mobile to prevent text wrapping */
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    /* Ensure Download button stands out */
    button[data-download-file] {
        font-size: 1.1rem;
        font-weight: 700;
        box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.4);
    }
    
    /* Share Buttons Container */
    .d-flex.flex-wrap.gap-2 {
        justify-content: center;
        width: 100%;
    }
    
    .d-flex.flex-wrap.align-items-center.justify-content-between.gap-3 {
        flex-direction: column;
        align-items: stretch !important;
    }
    
    /* Share buttons bigger on mobile for touch */
    .btn-sm.hover-lift {
        padding: 0.5rem 0.8rem;
        font-size: 1rem;
    }
}

/* =========================================
   Skeleton Loading Animation
   ========================================= */
.skeleton-box {
    display: inline-block;
    height: 1em;
    position: relative;
    overflow: hidden;
    background-color: rgba(148, 163, 184, 0.15);
    border-radius: 4px;
}

.skeleton-box::after {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background-image: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0.2) 20%,
        rgba(255, 255, 255, 0.5) 60%,
        rgba(255, 255, 255, 0)
    );
    animation: shimmer 2s infinite;
    content: '';
}

[data-theme="dark"] .skeleton-box::after {
    background-image: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0.05) 20%,
        rgba(255, 255, 255, 0.1) 60%,
        rgba(255, 255, 255, 0)
    );
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

.file-card-skeleton {
    height: 300px;
    border-radius: var(--radius-lg);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Micro-animations helpers */
.animate-hover-pulse:hover {
    animation: pulse 0.5s ease-in-out infinite alternate;
}

@keyframes pulse {
    from { transform: scale(1); }
    to { transform: scale(1.03); }
}

.succes-pop {
    animation: bounceIn 0.8s cubic-bezier(0.36, 0, 0.66, -0.56) forwards;
}
