:root {
    --bg-color: #0b0f19;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.5);
    --secondary: #8b5cf6;
    --danger: #ef4444;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

* {
    margin: 0; padding: 0; box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Dynamic Background Blobs */
.blob {
    position: absolute;
    filter: blur(80px);
    z-index: -1;
    opacity: 0.5;
    animation: float 20s infinite alternate cubic-bezier(0.4, 0, 0.2, 1);
}
.blob-1 {
    width: 400px; height: 400px;
    background: var(--primary);
    top: -10%; left: -10%;
    border-radius: 50%;
}
.blob-2 {
    width: 350px; height: 350px;
    background: var(--secondary);
    bottom: -10%; right: -5%;
    border-radius: 40%;
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 100px) scale(1.2); }
}

/* Glassmorphism Classes */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--glass-shadow);
    padding: 2rem;
    transition: transform 0.3s ease, border-color 0.3s ease;
}
.glass-card:hover {
    border-color: rgba(255,255,255,0.15);
}

/* Typography */
h1, h2, h3 { font-family: 'Outfit', sans-serif; margin-bottom: 0.5rem; }
.glow-text {
    background: linear-gradient(to right, #60a5fa, #c084fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 40px rgba(96, 165, 250, 0.3);
}
.subtitle { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 2rem; }

/* Navigation */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 5%;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(11, 15, 25, 0.8);
    backdrop-filter: blur(12px);
    position: sticky; top: 0; z-index: 100;
}
.nav-brand { font-family: 'Outfit'; font-size: 1.5rem; font-weight: 700; color: var(--text-main); }
.nav-btn {
    background: none; border: none; color: var(--text-muted);
    font-size: 0.95rem; font-weight: 600; cursor: pointer; padding: 0.5rem 1rem;
    transition: all 0.2s; border-radius: 8px;
}
.nav-btn:hover { color: var(--text-main); background: var(--glass-bg); }
.nav-btn.active { color: #fff; background: rgba(59, 130, 246, 0.15); }
.logout-btn:hover { color: var(--danger); background: rgba(239, 68, 68, 0.1); }

/* Forms & Inputs */
.input-group { margin-bottom: 1.2rem; }
.split-group { display: flex; gap: 1rem; margin-bottom: 1.2rem; }
input {
    width: 100%; padding: 1rem 1.2rem;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--glass-border);
    border-radius: 12px; color: #fff; font-size: 1rem;
    outline: none; transition: all 0.3s ease;
}
input:focus { border-color: var(--primary); box-shadow: 0 0 15px rgba(59, 130, 246, 0.2); }

/* Buttons */
.primary-btn {
    width: 100%; padding: 1rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none; border-radius: 12px;
    color: white; font-weight: 600; font-size: 1rem;
    cursor: pointer; transition: all 0.3s ease;
}
.primary-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 20px var(--primary-glow); }

.secondary-btn {
    width: 100%; padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border); border-radius: 12px;
    color: white; font-weight: 600; font-size: 1rem;
    cursor: pointer; transition: all 0.3s ease;
}
.secondary-btn:hover { background: rgba(255, 255, 255, 0.15); transform: translateY(-2px); }

.small-btn { padding: 0.5rem 1rem; width: auto; font-size: 0.85rem; }

/* Tabs */
.tabs { display: flex; gap: 0.5rem; margin-bottom: 2rem; background: rgba(0,0,0,0.2); border-radius: 12px; padding: 0.3rem; }
.tab-btn {
    flex: 1; padding: 0.8rem; background: none; border: none; border-radius: 8px;
    color: var(--text-muted); cursor: pointer; font-weight: 600; transition: 0.3s;
}
.tab-btn.active { background: var(--glass-border); color: #fff; }

/* Layouts */
#app-container { padding: 2rem 5%; max-width: 1200px; margin: 0 auto; }
.view { display: none; opacity: 0; animation: fadeIn 0.4s forwards; }
.view.active-view { display: block; }
@keyframes fadeIn { to { opacity: 1; } }

.auth-container { max-width: 400px; margin: 10vh auto; text-align: center; }

/* Dashboard */
.dashboard-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.workouts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.5rem; }

.workout-card h3 { display: flex; justify-content: space-between; align-items: center; font-size: 1.2rem; }
.workout-date { font-size: 0.8rem; color: var(--text-muted); font-weight: normal; }
.exercises-list { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.exercise-pill {
    display: flex; justify-content: space-between; align-items: center;
    background: rgba(0,0,0,0.2); padding: 0.8rem; border-radius: 8px; font-size: 0.9rem;
    border: 1px solid rgba(255,255,255,0.05);
}
.exercise-meta { color: var(--primary); font-weight: 600; }
.del-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 0.8rem; transition: 0.2s;}
.del-btn:hover { color: var(--danger); transform: scale(1.1); }

/* Modals */
.modal-backdrop {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(5px);
    display: flex; justify-content: center; align-items: center; z-index: 1000;
}
.modal { width: 90%; max-width: 400px; }
.hidden { display: none !important; }

/* Profile */
.profile-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
@media (max-width: 768px) { .profile-layout { grid-template-columns: 1fr; } }
.ai-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.ai-result { background: rgba(0,0,0,0.3); padding: 1.5rem; border-radius: 12px; min-height: 150px; font-size: 0.95rem; line-height: 1.5;}

.error-msg { color: var(--danger); font-size: 0.85rem; margin-top: 1rem; height: 1em; }
