/* 
 * UnFOMO - Modern Professional Design System
 * Theme: Digital Wellbeing & Calm Focus
 */

:root {
    /* Base Colors - HSL for easy swatching */
    --hue-primary: 250;
    /* Deep Indigo */
    --hue-accent: 170;
    /* Mint/Teal */
    --hue-danger: 340;
    /* Soft Red */
    --hue-warning: 35;
    /* Amber */
    --hue-success: 150;
    /* Emerald */

    /* Palette */
    --primary-50: hsl(var(--hue-primary), 90%, 96%);
    --primary-100: hsl(var(--hue-primary), 80%, 92%);
    --primary-200: hsl(var(--hue-primary), 70%, 85%);
    --primary-300: hsl(var(--hue-primary), 60%, 75%);
    --primary-400: hsl(var(--hue-primary), 50%, 65%);
    --primary-500: hsl(var(--hue-primary), 60%, 55%);
    /* Main Brand Color */
    --primary-600: hsl(var(--hue-primary), 70%, 45%);
    --primary-700: hsl(var(--hue-primary), 80%, 35%);
    --primary-900: hsl(var(--hue-primary), 80%, 15%);

    --accent-50: hsl(var(--hue-accent), 80%, 96%);
    --accent-500: hsl(var(--hue-accent), 70%, 45%);
    --accent-600: hsl(var(--hue-accent), 80%, 35%);

    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* Semantic */
    --bg-body: var(--gray-50);
    --bg-card: #ffffff;
    --text-main: var(--gray-800);
    --text-muted: var(--gray-500);
    --border-color: var(--gray-200);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-500) 100%);
    --gradient-glow: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(168, 85, 247, 0.15) 100%);
    --gradient-dark: linear-gradient(180deg, var(--gray-900) 0%, var(--gray-800) 100%);

    /* Typography */
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-display: 'Outfit', var(--font-sans);

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;

    /* Effects */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.2);

    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-display);
    color: var(--gray-900);
    line-height: 1.2;
    font-weight: 700;
}

a {
    color: var(--primary-600);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-700);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button,
input,
select,
textarea {
    font-family: inherit;
    font-size: inherit;
}

/* --- Layout --- */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.flex {
    display: flex;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

.gap-1 {
    gap: var(--space-xs);
}

.gap-2 {
    gap: var(--space-sm);
}

.gap-3 {
    gap: var(--space-md);
}

.gap-4 {
    gap: var(--space-lg);
}

.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: var(--text-muted);
}

.mb-0 {
    margin-bottom: 0 !important;
}

.mb-1 {
    margin-bottom: var(--space-xs);
}

.mb-2 {
    margin-bottom: var(--space-sm);
}

.mb-3 {
    margin-bottom: var(--space-md);
}

.mb-4 {
    margin-bottom: var(--space-lg);
}

.mt-1 {
    margin-top: var(--space-xs);
}

.mt-2 {
    margin-top: var(--space-sm);
}

.mt-3 {
    margin-top: var(--space-md);
}

.mt-4 {
    margin-top: var(--space-lg);
}

/* --- Components --- */

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-lg);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
    gap: 0.5rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.2);
}

.btn-primary:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    background: white;
    border-color: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:not(:disabled):hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
    color: var(--gray-900);
}

.btn-success {
    background-color: var(--accent-500);
    color: white;
}

.btn-success:hover {
    background-color: var(--accent-600);
}

.btn-danger {
    background-color: #ef4444;
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-lg {
    padding: 0.875rem 2rem;
    font-size: 1.125rem;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

/* Forms */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    margin-bottom: var(--space-xs);
    font-weight: 500;
    color: var(--gray-700);
    font-size: 0.9375rem;
}

.form-input,
.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-lg);
    background-color: white;
    transition: all var(--transition-fast);
    font-size: 1rem;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-100);
}

/* Cards */
.card {
    background: white;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    position: relative;
    transition: transform var(--transition-smooth), box-shadow var(--transition-smooth);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--gray-100);
    background: white;
}

.card-body {
    padding: var(--space-lg);
}

.card-footer {
    padding: var(--space-lg);
    background: var(--gray-50);
    border-top: 1px solid var(--gray-100);
}

/* Navbar */
.main-nav {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
    padding: var(--space-sm) 0;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
}

.logo {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.5rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links {
    display: flex;
    gap: var(--space-lg);
    align-items: center;
}

.nav-link {
    color: var(--gray-600);
    font-weight: 500;
    position: relative;
    padding: 0.5rem 0;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-600);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-500);
    border-radius: var(--radius-full);
}

/* Hero Section */
.hero {
    padding: 6rem 0;
    text-align: center;
    background: radial-gradient(circle at 50% 50%, var(--primary-50) 0%, transparent 70%);
}

.hero h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    margin-bottom: var(--space-md);
    letter-spacing: -0.02em;
    color: var(--gray-900);
}

.hero p {
    font-size: 1.25rem;
    color: var(--gray-500);
    max-width: 600px;
    margin: 0 auto var(--space-xl);
}

/* Feature Cards */
.feature-card {
    padding: var(--space-xl);
    text-align: center;
    border-radius: var(--radius-2xl);
    background: white;
    border: 1px solid var(--gray-100);
    transition: all var(--transition-smooth);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-200);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    background: var(--primary-50);
    width: 80px;
    height: 80px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-2xl);
    color: var(--primary-600);
}

/* Challenge Card (Flip effect) */
.challenge-perspective {
    perspective: 1000px;
    height: 480px;
}

.challenge-card {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-2xl);
    background: transparent;
}

.challenge-card.is-flipped {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--radius-2xl);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.card-front {
    background: var(--gradient-dark);
    color: white;
    justify-content: center;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.card-back {
    background: white;
    transform: rotateY(180deg);
    border: 1px solid var(--gray-200);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-lg);
}

.stat-card {
    background: white;
    padding: var(--space-lg);
    border-radius: var(--radius-xl);
    border: 1px solid var(--gray-100);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: transform var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: var(--space-sm);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
    font-family: var(--font-display);
}

.stat-label {
    color: var(--gray-500);
    font-size: 0.875rem;
    font-weight: 500;
}

/* Leaderboard */
.leaderboard-item {
    display: flex;
    align-items: center;
    padding: var(--space-md);
    background: white;
    border-bottom: 1px solid var(--gray-100);
    transition: all var(--transition-fast);
}

.leaderboard-item:first-child {
    border-top-left-radius: var(--radius-xl);
    border-top-right-radius: var(--radius-xl);
}

.leaderboard-item:last-child {
    border-bottom-left-radius: var(--radius-xl);
    border-bottom-right-radius: var(--radius-xl);
    border-bottom: none;
}

.leaderboard-item:hover {
    background: var(--gray-50);
}

.leaderboard-rank {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--gray-500);
}

.leaderboard-rank.rank-1,
.leaderboard-rank.rank-2,
.leaderboard-rank.rank-3 {
    font-size: 1.5rem;
}

.leaderboard-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 var(--space-md);
    background: var(--gray-200);
}

.leaderboard-info {
    flex: 1;
}

.leaderboard-name {
    font-weight: 600;
    color: var(--gray-900);
}

.leaderboard-streak {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.leaderboard-points {
    font-weight: 700;
    color: var(--primary-600);
    font-family: var(--font-display);
    font-size: 1.125rem;
}

/* Alerts */
.alert {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.alert-success {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
}

.alert-info {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--gray-100);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transition: width 0.5s ease-out;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.025em;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

/* Rewards Grid */
.rewards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: var(--space-lg);
}

.reward-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--space-md);
    border-radius: var(--radius-lg);
    background: var(--gray-50);
    border: 1px solid transparent;
    transition: all var(--transition-fast);
}

.reward-card:hover {
    background: white;
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.reward-card.locked {
    opacity: 0.6;
    filter: grayscale(1);
    background: transparent;
}

.reward-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-xs);
}

.reward-name {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: var(--space-xs);
    line-height: 1.2;
}

.reward-points {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Rarity colors */
.rarity-common .reward-icon {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.rarity-rare .reward-icon {
    filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.5));
}

.rarity-epic .reward-icon {
    filter: drop-shadow(0 0 10px rgba(168, 85, 247, 0.6));
}

.rarity-legendary .reward-icon {
    filter: drop-shadow(0 0 15px rgba(234, 179, 8, 0.7));
}

/* Footer */
.main-footer {
    background: white;
    padding: var(--space-2xl) 0 var(--space-lg);
    border-top: 1px solid var(--gray-200);
    margin-top: auto;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-links {
        display: none;
        /* Add mobile menu logic later if needed */
    }

    .hero h1 {
        font-size: 2.5rem;
    }
}