:root {
    /* Palette: Premium Dark (Cyberpunk/Fitness aesthetic) */
    --bg-body: #050505;
    --bg-card: #121212;
    --bg-glass: rgba(20, 20, 20, 0.6);

    --text-main: #ffffff;
    --text-muted: #888888;

    /* Accents */
    --accent: #22c55e;
    /* Emerald Green */
    --accent-glow: rgba(34, 197, 94, 0.4);
    --gold: #fbbf24;

    /* Gradients */
    --grad-main: linear-gradient(135deg, #22c55e 0%, #10b981 100%);
    --grad-gold: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);

    /* Metrics */
    --radius-l: 24px;
    --radius-m: 16px;
    --radius-s: 8px;

    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding: 0;
    background: var(--bg-body);
    font-family: var(--font-main);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- Navigation --- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(5, 5, 5, 0.85);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    font-size: 1.2rem;
    font-weight: 800;
    background: var(--grad-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    letter-spacing: -0.5px;
}

.nav-links {
    display: flex;
    gap: 5px;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px;
    border-radius: 99px;
}

.nav-item {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 99px;
    transition: all 0.3s;
}

.nav-item.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

/* --- Gamification Widget (Header) --- */
.gamification-widget {
    cursor: pointer;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 99px;
    padding: 6px 14px;
    display: flex;
    align-items: center;
    gap: 15px;
    margin-right: auto;
    margin-left: 20px;
    transition: all 0.3s ease;
}

.gamification-widget:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent);
}

.stat-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #ddd;
}

.stat-icon {
    font-size: 1.1em;
    opacity: 0.8;
}

/* Mobile Optimizations for Nav */
@media (max-width: 600px) {
    .navbar {
        flex-wrap: wrap;
        gap: 10px;
        padding: 10px;
    }

    .gamification-widget {
        margin-left: auto;
        order: 2;
        width: 100%;
        justify-content: center;
        margin-bottom: 5px;
    }

    .nav-links {
        order: 3;
        width: 100%;
        justify-content: space-between;
    }

    .nav-item {
        padding: 8px 12px;
        font-size: 0.75rem;
    }

    .nav-brand {
        order: 1;
    }
}

/* --- Layout --- */
.content {
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
    padding: 20px;
    flex: 1;
}

/* --- Metrics Grids --- */
.grid-metrics-primary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 25px;
}

.grid-metrics-secondary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

@media (max-width: 1024px) {
    .grid-metrics-secondary {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {

    .grid-metrics-primary,
    .grid-metrics-secondary {
        grid-template-columns: 1fr;
    }
}

.mini-chart-container {
    height: 80px;
    margin-top: 15px;
    margin-bottom: 5px;
}

.status-card.closer {
    border: 1px solid rgba(0, 242, 96, 0.45) !important;
    box-shadow: 0 0 15px rgba(0, 242, 96, 0.1);
}

.status-card.further {
    border: 1px solid rgba(255, 77, 77, 0.45) !important;
    box-shadow: 0 0 15px rgba(255, 77, 77, 0.1);
}

.status-card.goal-reached {
    border: 1.5px solid #ffd700 !important;
    background: linear-gradient(145deg, #1a1a1a, #2a2a1a) !important;
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.15);
}

.status-card.goal-reached h4,
.status-card.goal-reached span[style*="font-weight: 600"] {
    color: #ffd700 !important;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.achievement-crown {
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 1.4rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0) rotate(5deg);
    }

    50% {
        transform: translateY(-5px) rotate(-5deg);
    }
}

h1 {
    font-size: 2rem;
    margin-bottom: 20px;
    font-weight: 800;
    letter-spacing: -1px;
}

/* History Gallery Preview */
.history-gallery-preview {
    display: flex;
    gap: 4px;
    height: 120px;
    background: #000;
    border-radius: var(--radius-s);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.history-gallery-preview .preview-item {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.history-gallery-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.history-gallery-preview .preview-item:hover img {
    transform: scale(1.1);
}

.history-gallery-preview.single .preview-item {
    flex: 1;
}

.history-gallery-preview.double .preview-item {
    flex: 0 0 50%;
}

.history-gallery-preview.triple .preview-item {
    flex: 0 0 33.333%;
}

.no-photos {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-style: italic;
    background: #0a0a0a;
}

/* Photo Gallery in Modal */
.gallery-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.gallery-main img {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: var(--radius-s);
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.gallery-thumbs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 10px;
}

.gallery-thumbs img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-s);
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    opacity: 0.6;
}

.gallery-thumbs img.active {
    border-color: var(--accent);
    opacity: 1;
}

.gallery-thumbs img:hover {
    opacity: 1;
}

h3 {
    margin-bottom: 15px;
    font-weight: 700;
    font-size: 1.2rem;
}

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-m);
    padding: 24px;
    margin-bottom: 20px;
}

.grid-2,
.grid-3 {
    display: grid;
    gap: 20px;
}

.grid-2 {
    grid-template-columns: 1fr;
}

@media (min-width: 700px) {
    .grid-2 {
        grid-template-columns: 1fr 1fr;
    }
}

/* --- Profile Page Redesign --- */

/* Hero Section */
.profile-hero {
    position: relative;
    background: radial-gradient(circle at 100% 0%, #1a1a1a 0%, #0a0a0a 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-l);
    padding: 40px;
    display: flex;
    align-items: center;
    gap: 40px;
    overflow: hidden;
    margin-bottom: 40px;
}

.profile-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--grad-main);
}

.hero-avatar {
    flex-shrink: 0;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: #111;
    border: 2px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

.hero-avatar .lvl {
    font-size: 3rem;
    font-weight: 900;
    line-height: 1;
    color: #fff;
}

.hero-avatar .label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-top: 5px;
}

.hero-info h1 {
    margin: 0 0 10px 0;
    border: none;
}

.hero-stats {
    display: flex;
    gap: 30px;
}

.hero-stat .val {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent);
}

.hero-stat .lbl {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* Badges - Card Style */
.badges-section h3 {
    margin-top: 40px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.badge-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px 15px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: default;
}

/* LOCKED State */
.badge-card.locked {
    opacity: 0.2;
    /* Barely visible */
    filter: grayscale(1);
    border-style: dashed;
}

.badge-card.locked:hover {
    opacity: 0.4;
}

/* UNLOCKED State */
.badge-card.unlocked {
    background: rgba(255, 215, 0, 0.05);
    border: 1px solid rgba(255, 215, 0, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transform: translateY(0);
}

.badge-card.unlocked:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.15);
    border-color: #fbbf24;
}

.badge-emoji {
    font-size: 2.5rem;
    margin-bottom: 10px;
    display: block;
}

.badge-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
    margin-bottom: 5px;
}

.badge-desc {
    font-size: 0.7rem;
    color: #888;
    display: none;
}

/* Hide desc to keep it clean, show on hover? */
.badge-card:hover .badge-desc {
    display: block;
    animation: fadeIn 0.3s;
}

/* Skills */
.skill-row {
    margin-bottom: 15px;
}

.skill-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 6px;
}

.skill-track {
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
}

.skill-bar {
    height: 100%;
    background: var(--grad-main);
    border-radius: 4px;
    transition: width 1s;
}

.badge-category-title {
    font-size: 1rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
    margin-top: 10px;
    opacity: 0.9;
}


/* --- Dashboard (Legacy Support for Cards) --- */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.status-card {
    background: #121212;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s;
}

.status-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
}

.status-name {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 10px;
    display: block;
}

/* Inputs/Forms */
input,
select,
textarea {
    width: 100%;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    margin-bottom: 15px;
    font-size: 1rem;
}

input:focus {
    border-color: var(--accent);
    outline: none;
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    background: var(--accent);
    color: #000;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

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

/* --- Tabs (Segmented Control) --- */
.tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    padding: 5px;
    border-radius: 12px;
    margin-bottom: 25px;
    gap: 0;
    /* No gap in segmented control or small gap */
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.tab-btn {
    flex: 1;
    background: transparent;
    /* Override .btn */
    color: var(--text-muted);
    /* Override .btn */
    box-shadow: none;
    padding: 10px;
    font-size: 0.8rem;
    width: auto;
    /* Override .btn */
    border-radius: 8px;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
    transform: none;
    /* Disable button lift */
}

.tab-btn.active {
    background: var(--accent);
    color: #000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    font-weight: 800;
}

/* --- Modal --- */
.modal {
    display: none;
    position: fixed;
    z-index: 200;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
    overflow-y: auto;
}

.modal-content {
    background: var(--bg-card);
    margin: 30px auto;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 90%;
    max-width: 800px;
    border-radius: var(--radius-m);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 20px;
}

.close-btn {
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.close-btn:hover {
    color: #fff;
}

/* Baseline Badge */
.baseline-badge {
    background: var(--grad-main);
    color: #000;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
}