/* ================================
   FamilyPoints - Custom Styles
   Premium dark theme with animations
   ================================ */

/* --- Global Font Override --- */
*, *::before, *::after {
    font-family: 'Inter', 'Roboto', 'Helvetica', 'Arial', sans-serif;
}


/* --- Loading Screen --- */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
    color: #f1f5f9;
    font-family: 'Inter', sans-serif;
}

.loading-logo {
    text-align: center;
    animation: fadeInUp 0.8s ease-out;
}

.loading-logo h1 {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #8b5cf6, #22d3ee);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0.5rem 0 0.25rem;
}

.loading-logo p {
    color: #94a3b8;
    font-size: 0.9rem;
}

.loading-icon {
    font-size: 3rem;
    display: inline-block;
    animation: starPulse 1.5s ease-in-out infinite;
}

/* --- App Bar --- */
.app-bar-custom {
    backdrop-filter: blur(20px) !important;
    border-bottom: 1px solid rgba(139, 92, 246, 0.1) !important;
}

.app-title {
    font-weight: 800 !important;
    background: linear-gradient(135deg, #8b5cf6, #22d3ee);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.star-icon-glow {
    filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.6));
    animation: starPulse 3s ease-in-out infinite;
}

/* --- Drawer / Sidebar --- */
.drawer-custom {
    border-right: 1px solid rgba(139, 92, 246, 0.08) !important;
}

.drawer-custom .mud-nav-link {
    border-radius: 12px !important;
    margin: 2px 8px !important;
    transition: all 0.25s ease !important;
}

.drawer-custom .mud-nav-link:hover {
    background: rgba(139, 92, 246, 0.1) !important;
    transform: translateX(4px);
}

.drawer-custom .mud-nav-link.active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(34, 211, 238, 0.1)) !important;
    border-left: 3px solid #8b5cf6 !important;
}

/* --- Main Content --- */
.main-content-custom {
    min-height: 100vh;
}

/* --- Card Styles --- */
.card-glass {
    background: rgba(26, 26, 46, 0.6) !important;
    backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(139, 92, 246, 0.12) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.card-glass:hover {
    border-color: rgba(139, 92, 246, 0.3) !important;
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3), 0 0 30px rgba(139, 92, 246, 0.1) !important;
}

/* --- Stat Cards --- */
.stat-card {
    position: relative;
    overflow: hidden;
    border-radius: 16px !important;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--stat-color-start, #8b5cf6), var(--stat-color-end, #22d3ee));
}

.stat-card-purple { --stat-color-start: #8b5cf6; --stat-color-end: #a78bfa; }
.stat-card-cyan { --stat-color-start: #22d3ee; --stat-color-end: #06b6d4; }
.stat-card-gold { --stat-color-start: #fbbf24; --stat-color-end: #f59e0b; }
.stat-card-green { --stat-color-start: #34d399; --stat-color-end: #10b981; }

.stat-icon-bg {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-number {
    font-size: 2rem !important;
    font-weight: 800 !important;
    line-height: 1 !important;
}

/* --- Member Avatar --- */
.member-avatar {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    color: white;
    text-transform: uppercase;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
}

.member-avatar:hover {
    transform: scale(1.1);
}

/* --- Points Badge --- */
.points-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.875rem;
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(245, 158, 11, 0.15));
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.2);
}

.points-badge.large {
    padding: 8px 20px;
    font-size: 1.1rem;
}

/* --- Task Frequency Badge --- */
.freq-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.freq-once { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }
.freq-daily { background: rgba(34, 211, 238, 0.15); color: #22d3ee; }
.freq-weekly { background: rgba(52, 211, 153, 0.15); color: #34d399; }

/* --- Page Headers --- */
.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-weight: 800 !important;
    font-size: 1.75rem !important;
    background: linear-gradient(135deg, #f1f5f9, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-subtitle {
    color: #64748b !important;
    font-size: 0.95rem !important;
}

/* --- Confetti Effect --- */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -10px;
    animation: confettiFall 3s ease-in forwards;
}

.confetti-piece:nth-child(odd) { border-radius: 50%; }

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    opacity: 0.7;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.5);
}

/* --- Error UI --- */
#blazor-error-ui {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    bottom: 0;
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.4);
    display: none;
    left: 0;
    padding: 1rem 1.5rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: #f1f5f9;
    border-top: 2px solid #ef4444;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 0.5rem;
}

/* --- Animations --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes starPulse {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 4px rgba(139, 92, 246, 0.4)); }
    50% { transform: scale(1.15); filter: drop-shadow(0 0 12px rgba(139, 92, 246, 0.8)); }
}

@keyframes pointsPopIn {
    0% { transform: scale(0.5); opacity: 0; }
    60% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes confettiFall {
    0% {
        top: -10px;
        transform: translateX(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        top: 100vh;
        transform: translateX(var(--drift, 100px)) rotate(720deg);
        opacity: 0;
    }
}

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

/* --- Animated entry for cards --- */
.animate-in {
    animation: fadeInUp 0.5s ease-out forwards;
    opacity: 0;
}

.animate-in:nth-child(1) { animation-delay: 0.05s; }
.animate-in:nth-child(2) { animation-delay: 0.1s; }
.animate-in:nth-child(3) { animation-delay: 0.15s; }
.animate-in:nth-child(4) { animation-delay: 0.2s; }
.animate-in:nth-child(5) { animation-delay: 0.25s; }
.animate-in:nth-child(6) { animation-delay: 0.3s; }
.animate-in:nth-child(7) { animation-delay: 0.35s; }
.animate-in:nth-child(8) { animation-delay: 0.4s; }

/* --- Gradient buttons --- */
.btn-gradient-primary {
    background: linear-gradient(135deg, #7c3aed, #8b5cf6) !important;
    color: white !important;
    font-weight: 600 !important;
    transition: all 0.3s ease !important;
}

.btn-gradient-primary:hover {
    background: linear-gradient(135deg, #6d28d9, #7c3aed) !important;
    box-shadow: 0 8px 24px rgba(124, 58, 237, 0.4) !important;
    transform: translateY(-2px);
}

.btn-gradient-gold {
    background: linear-gradient(135deg, #f59e0b, #fbbf24) !important;
    color: #1a1a2e !important;
    font-weight: 700 !important;
    transition: all 0.3s ease !important;
}

.btn-gradient-gold:hover {
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.4) !important;
    transform: translateY(-2px);
}

/* --- Responsive --- */
@media (max-width: 600px) {
    .stat-number {
        font-size: 1.5rem !important;
    }
    
    .page-title {
        font-size: 1.4rem !important;
    }
    
    .member-avatar {
        width: 44px;
        height: 44px;
        font-size: 1rem;
    }
}

/* --- Ranking Bar --- */
.ranking-bar {
    height: 8px;
    border-radius: 4px;
    background: rgba(139, 92, 246, 0.1);
    overflow: hidden;
    position: relative;
}

.ranking-bar-fill {
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, #8b5cf6, #22d3ee);
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reward card shimmer --- */
.reward-shimmer {
    position: relative;
    overflow: hidden;
}

.reward-shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    left: -200px;
    width: 200px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
    animation: shimmer 3s infinite;
}

/* Remove default bootstrap styles */
.valid.modified:not([type=checkbox]) {
    outline: none;
}

.invalid {
    outline: none;
}
