:root {
    --primary: #2D3436;
    --accent: #6C5CE7;
    --accent-vibrant: #A29BFE;
    --success: #00B894;
    --warning: #FDCB6E;
    --danger: #D63031;
    --bg-main: #F2F2F2;
    --card-bg: rgba(255, 255, 255, 0.9);
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(0, 0, 0, 0.05);
    --text-primary: #2D3436;
    --text-secondary: #636E72;
    --sidebar-bg: #FFFFFF;
    --radius-lg: 24px;
    --radius-md: 16px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] {
    --primary: #DFE6E9;
    --bg-main: #18191A;
    --card-bg: rgba(36, 37, 38, 0.9);
    --glass-bg: rgba(36, 37, 38, 0.6);
    --glass-border: rgba(255, 255, 255, 0.05);
    --text-primary: #F5F6FA;
    --text-secondary: #B2BEC3;
    --sidebar-bg: #242526;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

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

body {
    background: var(--gradient-bg);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
    transition: background-color 0.3s ease;
}

/* Aparegio-style Navbar */
.navbar {
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  padding: 10px 0;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.navbar-limit {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
}

.navbar-margin {
  display: flex;
  align-items: center;
  position: relative;
}

.navbar-logo {
  background: white;
  border-radius: 40px;
  padding: 8px 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  font-weight: 800;
  color: var(--accent);
  margin-right: 2rem;
}

.navbar-tabs {
  margin-left: auto;
  display: flex;
  align-items: center;
  height: 44px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 40px;
  padding: 0 4px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  position: relative;
}

.navbar-tab {
  padding: 0 20px;
  height: 36px;
  border-radius: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  z-index: 2;
}

.navbar-tab.active {
  color: white;
  background: var(--accent);
  box-shadow: 0 4px 12px rgba(108, 92, 231, 0.3);
}

.navbar-item {
  margin-left: 12px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.navbar-item:hover {
  background: white;
  transform: translateY(-2px);
}

/* New Layout Adjustments for Navbar */
.layout {
  padding-top: 80px; /* Space for fixed navbar */
  height: 100vh;
  display: grid;
  grid-template-columns: 1fr 300px;
}

.main-content {
  padding: 2rem;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.dashboard-header {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.header-title h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.search-bar {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    padding: 0.8rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    width: 300px;
}

.search-bar input {
    border: none;
    background: transparent;
    color: var(--text-primary);
    width: 100%;
    outline: none;
}

/* Health Cards Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.glass-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 45px rgba(0,0,0,0.1);
    border-color: var(--accent);
}

.card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: var(--accent);
}

.card-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.card-value {
    font-size: 1.8rem;
    font-weight: 700;
}

.card-trend {
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

.trend-up { color: var(--success); }
.trend-down { color: var(--danger); }

/* Body Visualization Column */
.body-viz-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.body-model-wrapper {
    background: transparent;
    border-radius: var(--radius-lg);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 1rem;
    min-height: 500px;
}

model-viewer {
    width: 100%;
    height: 600px;
    background-color: transparent;
}

.hotspot {
    position: absolute;
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    border: 3px solid white;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(108, 92, 231, 0.5);
    z-index: 10;
}

.hotspot::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 1px solid var(--accent);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(3); opacity: 0; }
}

/* Right Sidebar (Profile & Activities) */
.user-sidebar {
    background: var(--sidebar-bg);
    border-left: 1px solid var(--glass-border);
    padding: 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.profile-summary {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.avatar {
    width: 60px;
    height: 60px;
    border-radius: 18px;
    object-fit: cover;
}

.activities-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.activity-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.progress-track {
    width: 100%;
    height: 8px;
    background: var(--bg-main);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
}

/* Measurement Modal/Inputs */
.measurement-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.input-group label {
    font-size: 0.8rem;
    font-weight: 600;
}

.input-group input {
    padding: 0.7rem;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: var(--bg-main);
    color: var(--text-primary);
}

button.btn-primary {
    background: var(--accent);
    color: white;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
}

button.btn-primary:hover {
    opacity: 0.9;
}

/* Auth View Reset */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
}

#auth-view .glass-panel {
    max-width: 450px;
    width: 100%;
}

[style*="display: none"] {
    display: none !important;
}

@media (max-width: 1200px) {
    .layout {
        grid-template-columns: 80px 1fr;
    }
    .user-sidebar {
        display: none;
    }
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

#theme-toggle-btn {
    width: 44px;
    height: 44px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    box-shadow: none;
}

#theme-toggle-btn:hover {
    background: var(--input-bg);
    transform: none;
}

.secondary-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: 0.2s;
}

.secondary-link:hover {
    text-decoration: underline;
    filter: brightness(1.2);
}

/* Anatomical Depth Slider */
.depth-slider-container {
    position: absolute;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    padding: 20px 10px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.slider-label {
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    writing-mode: vertical-lr;
    text-orientation: mixed;
    transform: rotate(180deg);
}

#anatomy-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 6px;
    height: 200px;
    background: rgba(108, 92, 231, 0.2);
    outline: none;
    border-radius: 3px;
    writing-mode: vertical-lr;
    cursor: pointer;
}

#anatomy-slider::-webkit-slider-runnable-track {
    width: 6px;
    border-radius: 3px;
    background: linear-gradient(to bottom, var(--accent), var(--accent-vibrant));
}

#anatomy-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: white;
    border: 3px solid var(--accent);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(108, 92, 231, 0.4);
    margin-left: -9px; /* Centering the thumb on the 6px track */
    transition: transform 0.2s ease;
}

#anatomy-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

#anatomy-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: white;
    border: 3px solid var(--accent);
    border-radius: 50%;
    cursor: pointer;
}

::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}
