/* Enhanced CSS Variables for better theming */
:root {
    /* Color Palette */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --border-hover: #3b82f6;
    --brand-primary: #2563eb;
    --brand-secondary: #1d4ed8;
    --success: #059669;
    --warning: #d97706;
    --error: #dc2626;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    
    /* Typography */
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    /* Animations */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.3);
}

/* Respect user motion preferences */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    transition: background-color var(--transition-normal), color var(--transition-normal);
    min-height: 100vh;
}

/* Container System */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

@media (min-width: 640px) {
    .container {
        padding: 0 var(--space-lg);
    }
}

/* Navigation */
.navbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 4rem;
}

.nav-brand h1 {
    color: var(--brand-primary);
    font-size: var(--font-size-xl);
    font-weight: 700;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.theme-toggle {
    width: 2.5rem;
    height: 2.5rem;
    border: 2px solid var(--border-color);
    background: var(--bg-tertiary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    font-size: var(--font-size-lg);
}

.theme-toggle:hover {
    border-color: var(--brand-primary);
    background: var(--brand-primary);
    color: white;
    transform: scale(1.05);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-sm);
    gap: 3px;
}

.nav-toggle span {
    width: 20px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 1px;
    transition: all var(--transition-normal);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: var(--space-xl);
}

.nav-menu a {
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    transition: color var(--transition-normal);
    padding: var(--space-sm) 0;
    position: relative;
}

.nav-menu a:hover {
    color: var(--brand-primary);
}

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--brand-primary);
    transition: width var(--transition-normal);
}

.nav-menu a:hover::after {
    width: 100%;
}

/* Hero Banner */
.hero-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: var(--space-2xl) 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.logo {
    width: 4rem;
    height: 4rem;
    margin: 0 auto var(--space-md);
    background: rgba(255,255,255,0.2);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-2xl);
    backdrop-filter: blur(10px);
}

.hero-banner h1 {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    margin-bottom: var(--space-md);
}

.hero-banner p {
    font-size: var(--font-size-lg);
    opacity: 0.9;
}

/* Main Content */
.main-content {
    padding: var(--space-2xl) 0;
}

/* Calculator Layout */
.calculator-layout {
    display: grid;
    gap: var(--space-2xl);
    grid-template-columns: 1fr;
}

@media (min-width: 1024px) {
    .calculator-layout {
        grid-template-columns: 1fr 400px;
        gap: var(--space-2xl);
    }
}

/* Calculator Section */
.calculator-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
    gap: var(--space-md);
}

.section-header h2 {
    font-size: var(--font-size-2xl);
    font-weight: 600;
    color: var(--text-primary);
}

/* Unit Toggle */
.unit-toggle {
    display: flex;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 4px;
    gap: 0;
}

.unit-btn {
    padding: var(--space-sm) var(--space-md);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 500;
    border-radius: calc(var(--radius) - 2px);
    cursor: pointer;
    transition: all var(--transition-normal);
    white-space: nowrap;
    font-size: var(--font-size-sm);
}

.unit-btn.active {
    background: var(--brand-primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.unit-btn:hover:not(.active) {
    background: var(--border-color);
    color: var(--text-primary);
}

/* Form Styling */
.calculator-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.form-grid {
    display: grid;
    gap: var(--space-lg);
    grid-template-columns: 1fr;
}

@media (min-width: 600px) {
    .form-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-lg);
    }
    
    .form-group.height-group {
        grid-column: 1 / -1;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.form-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.optional {
    color: var(--text-muted);
    font-weight: 400;
    font-size: var(--font-size-xs);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.form-input, .form-select {
    width: 100%;
    padding: var(--space-md);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: var(--font-size-base);
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all var(--transition-normal);
    appearance: none;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input:invalid:not(:placeholder-shown) {
    border-color: var(--error);
}

.form-input:valid {
    border-color: var(--success);
}

.input-suffix {
    position: absolute;
    right: var(--space-md);
    color: var(--text-secondary);
    font-weight: 500;
    pointer-events: none;
    font-size: var(--font-size-sm);
}

.form-select {
    padding-right: var(--space-2xl);
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"/></svg>');
    background-repeat: no-repeat;
    background-position: right var(--space-md) center;
    background-size: 1rem;
}

.form-help {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

.form-error {
    font-size: var(--font-size-xs);
    color: var(--error);
    font-weight: 500;
    display: none;
}

.form-error.show {
    display: block;
}

/* Radio Group */
.radio-group {
    display: flex;
    gap: var(--space-lg);
    flex-wrap: wrap;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    padding: var(--space-sm);
    border-radius: var(--radius);
    transition: background-color var(--transition-normal);
}

.radio-option:hover {
    background: var(--bg-tertiary);
}

.radio-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.radio-custom {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    position: relative;
    transition: all var(--transition-normal);
}

.radio-option input[type="radio"]:checked + .radio-custom {
    border-color: var(--brand-primary);
    background: var(--brand-primary);
}

.radio-option input[type="radio"]:checked + .radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0.5rem;
    height: 0.5rem;
    background: white;
    border-radius: 50%;
}

.radio-label {
    font-weight: 500;
    color: var(--text-primary);
}

/* Height Inputs */
.height-inputs {
    display: flex;
    gap: var(--space-sm);
}

.imperial-height {
    display: flex;
    gap: var(--space-sm);
    flex: 1;
}

.metric-height {
    flex: 1;
}

/* Form Actions */
.form-actions {
    margin-top: var(--space-lg);
    position: relative;
}

.calculate-btn {
    width: 100%;
    padding: var(--space-lg);
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: var(--font-size-lg);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    min-height: 3.5rem;
}

.calculate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.calculate-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-text {
    flex: 1;
    text-align: center;
}

.btn-icon {
    transition: transform var(--transition-normal);
}

.calculate-btn:hover:not(:disabled) .btn-icon {
    transform: translateX(4px);
}

/* Fixed button on mobile when form is valid */
@media (max-width: 600px) {
    .form-actions.fixed {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: var(--space-md);
        background: var(--bg-secondary);
        border-top: 1px solid var(--border-color);
        z-index: 1000;
        box-shadow: 0 -4px 6px -1px rgb(0 0 0 / 0.1);
    }
    
    .calculator-section.with-fixed-button {
        padding-bottom: 5rem;
    }
}

/* Results Section */
.results-section {
    position: sticky;
    top: 5rem;
    height: fit-content;
}

@media (max-width: 1023px) {
    .results-section {
        position: relative;
        top: auto;
    }
}

.results-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border-color);
}

.results-header h2 {
    font-size: var(--font-size-2xl);
    font-weight: 600;
    color: var(--text-primary);
}

.copy-btn {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-normal);
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.copy-btn:hover {
    background: var(--brand-primary);
    color: white;
    border-color: var(--brand-primary);
    transform: translateY(-1px);
}

/* Primary Result */
.primary-result {
    text-align: center;
    margin-bottom: var(--space-xl);
    padding: var(--space-xl);
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border-radius: var(--radius-lg);
}

.tdee-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
}

.tdee-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tdee-value {
    font-size: 4rem;
    font-weight: 700;
    color: var(--brand-primary);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.tdee-unit {
    font-size: var(--font-size-lg);
    color: var(--text-secondary);
    font-weight: 500;
}

/* Calorie Breakdown */
.calorie-breakdown {
    margin-bottom: var(--space-xl);
}

.calorie-breakdown h3 {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
    text-align: center;
}

.breakdown-table {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.breakdown-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    transition: all var(--transition-normal);
}

.breakdown-row:hover {
    background: var(--border-color);
    transform: translateX(4px);
}

.breakdown-row.maintenance {
    background: linear-gradient(135deg, #05966915 0%, #05966915 100%);
    border: 1px solid var(--success);
}

.goal-label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: var(--font-size-sm);
}

.goal-value {
    font-weight: 700;
    color: var(--brand-primary);
    font-size: var(--font-size-lg);
    font-variant-numeric: tabular-nums;
}

.goal-desc {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

/* Secondary Metrics */
.secondary-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.metric-card {
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    text-align: center;
    border: 1px solid var(--border-color);
    transition: all var(--transition-normal);
}

.metric-card:hover {
    border-color: var(--brand-primary);
    transform: translateY(-2px);
}

.metric-label {
    display: block;
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-xs);
}

.metric-value {
    display: block;
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--brand-primary);
    font-variant-numeric: tabular-nums;
    margin-bottom: var(--space-xs);
}

.metric-unit, .metric-category {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-weight: 500;
}

/* Disclaimer */
.disclaimer {
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    border-left: 4px solid var(--warning);
    margin-bottom: var(--space-lg);
}

.disclaimer p {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Re-calculate Button */
.recalculate-btn {
    width: 100%;
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-normal);
    font-weight: 500;
}

.recalculate-btn:hover {
    background: var(--brand-primary);
    color: white;
    border-color: var(--brand-primary);
    transform: translateY(-1px);
}

/* Floating Re-calculate Button */
.floating-recalc {
    position: fixed;
    bottom: var(--space-xl);
    right: var(--space-xl);
    width: 3.5rem;
    height: 3.5rem;
    background: var(--brand-primary);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: var(--font-size-xl);
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-normal);
    z-index: 1000;
}

.floating-recalc:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: var(--shadow-lg);
}

/* Progress Bar */
.progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--bg-tertiary);
    z-index: 1000;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-primary) 0%, var(--success) 100%);
    width: 0%;
    transition: width var(--transition-normal);
}

/* Mobile Responsive Design */
@media (max-width: 600px) {
    .container {
        padding: 0 var(--space-md);
    }
    
    .nav-toggle {
        display: flex;
    }
    
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 4rem;
        flex-direction: column;
        background: var(--bg-secondary);
        width: 100%;
        text-align: center;
        transition: left var(--transition-normal);
        box-shadow: var(--shadow);
        padding: var(--space-xl) 0;
        border-top: 1px solid var(--border-color);
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .hero-banner {
        padding: var(--space-xl) 0;
    }
    
    .hero-banner h1 {
        font-size: var(--font-size-2xl);
    }
    
    .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-md);
    }
    
    .unit-toggle {
        align-self: center;
    }
    
    .radio-group {
        justify-content: center;
    }
    
    .imperial-height {
        flex-direction: column;
        gap: var(--space-sm);
    }
    
    .secondary-metrics {
        grid-template-columns: 1fr;
    }
    
    .breakdown-row {
        grid-template-columns: 1fr;
        text-align: center;
        gap: var(--space-xs);
    }
    
    .tdee-value {
        font-size: 3rem;
    }
}

/* Animation Keyframes */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Results animation */
.results-card {
    animation: slideIn 0.5s ease-out;
}

/* Form validation states */
.form-group.error .form-input,
.form-group.error .form-select {
    border-color: var(--error);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.form-group.success .form-input,
.form-group.success .form-select {
    border-color: var(--success);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

/* Loading states */
.calculate-btn.loading {
    pointer-events: none;
}

.calculate-btn.loading .btn-text {
    opacity: 0.7;
}

.calculate-btn.loading .btn-icon {
    animation: pulse 1s infinite;
}

/* High Contrast Support */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
        --text-secondary: #000000;
    }
    
    [data-theme="dark"] {
        --border-color: #ffffff;
        --text-secondary: #ffffff;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .floating-recalc,
    .progress-container,
    .copy-btn,
    .recalculate-btn {
        display: none !important;
    }
    
    .main-content {
        padding: 0;
    }
    
    .calculator-layout {
        display: block;
    }
    
    .results-card {
        box-shadow: none;
        border: 2px solid #000;
    }
}

/* Tab Navigation Styles */
.tabs-container {
    margin-bottom: var(--space-xl);
}

.tab-buttons {
    display: flex;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-xs);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
    gap: var(--space-xs);
}

.tab-button {
    flex: 1;
    min-width: 120px;
    padding: var(--space-sm) var(--space-md);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition-normal);
    font-weight: 500;
    font-size: var(--font-size-sm);
    white-space: nowrap;
}

.tab-button:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.tab-button.active {
    background: var(--brand-primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

/* Formula Selector */
.formula-selector {
    margin-bottom: var(--space-lg);
    padding: var(--space-lg);
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

/* Body Fat Calculator Styles */
.body-fat-calculator {
    margin-bottom: var(--space-xl);
    padding: var(--space-lg);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.body-fat-calculator h3 {
    color: var(--brand-primary);
    margin-bottom: var(--space-sm);
    font-size: var(--font-size-lg);
}

.body-fat-calculator p {
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
}

.calculate-btn.secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.calculate-btn.secondary:hover {
    background: var(--text-secondary);
    color: white;
    border-color: var(--text-secondary);
}

.body-fat-result {
    margin-top: var(--space-lg);
    padding: var(--space-lg);
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    border-left: 4px solid var(--brand-primary);
}

.result-display {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-sm);
}

.result-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.result-value {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--brand-primary);
}

.result-category {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    font-style: italic;
}

/* Progress Tracking Styles */
.tracking-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
}

.add-entry {
    background: var(--bg-secondary);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.add-entry h3 {
    color: var(--brand-primary);
    margin-bottom: var(--space-lg);
    font-size: var(--font-size-lg);
}

.progress-history {
    background: var(--bg-secondary);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.progress-history h3 {
    color: var(--brand-primary);
    margin-bottom: var(--space-lg);
    font-size: var(--font-size-lg);
}

.history-table {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    overflow: hidden;
}

.table-header {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--brand-primary);
    color: white;
    font-weight: 600;
    font-size: var(--font-size-sm);
}

.table-body {
    background: var(--bg-secondary);
}

.table-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: var(--space-md);
    padding: var(--space-md);
    border-bottom: 1px solid var(--border-color);
    transition: background-color var(--transition-fast);
}

.table-row:hover {
    background: var(--bg-tertiary);
}

.table-row:last-child {
    border-bottom: none;
}

.no-entries {
    padding: var(--space-xl);
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

.delete-entry {
    background: var(--error);
    color: white;
    border: none;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: var(--font-size-xs);
    transition: opacity var(--transition-fast);
}

.delete-entry:hover {
    opacity: 0.8;
}

.progress-chart {
    background: var(--bg-secondary);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.progress-chart h3 {
    color: var(--brand-primary);
    margin-bottom: var(--space-lg);
    font-size: var(--font-size-lg);
}

.progress-chart canvas {
    width: 100%;
    height: 300px;
    border-radius: var(--radius);
}

/* Profile Management Styles */
.profiles-section {
    background: var(--bg-secondary);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.profile-controls {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
}

.profiles-list {
    display: grid;
    gap: var(--space-md);
}

.profile-card {
    background: var(--bg-tertiary);
    padding: var(--space-lg);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    transition: all var(--transition-normal);
}

.profile-card:hover {
    border-color: var(--brand-primary);
    box-shadow: var(--shadow);
}

.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-md);
}

.profile-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--font-size-lg);
}

.profile-date {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.profile-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.profile-detail {
    display: flex;
    flex-direction: column;
}

.profile-detail-label {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.profile-detail-value {
    font-weight: 600;
    color: var(--text-primary);
}

.profile-actions {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.profile-btn {
    padding: var(--space-xs) var(--space-sm);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: var(--font-size-xs);
    font-weight: 500;
    transition: all var(--transition-fast);
}

.profile-btn.load {
    background: var(--brand-primary);
    color: white;
}

.profile-btn.load:hover {
    background: var(--brand-secondary);
}

.profile-btn.delete {
    background: var(--error);
    color: white;
}

.profile-btn.delete:hover {
    opacity: 0.8;
}

.no-profiles {
    padding: var(--space-xl);
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--bg-secondary);
    padding: var(--space-xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.modal-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: var(--font-size-xl);
    cursor: pointer;
    color: var(--text-secondary);
    padding: var(--space-xs);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-actions {
    display: flex;
    gap: var(--space-md);
    justify-content: flex-end;
    margin-top: var(--space-lg);
}

/* Responsive Design for Advanced Features */
@media (max-width: 768px) {
    .tab-buttons {
        flex-direction: column;
    }
    
    .tab-button {
        min-width: auto;
        text-align: center;
    }
    
    .profile-controls {
        flex-direction: column;
    }
    
    .profile-details {
        grid-template-columns: 1fr 1fr;
    }
    
    .table-header,
    .table-row {
        grid-template-columns: 1fr 1fr 1fr;
        font-size: var(--font-size-xs);
    }
    
    .table-header span:last-child,
    .table-row span:last-child {
        display: none;
    }
    
    .modal-content {
        margin: var(--space-md);
        width: calc(100% - 2rem);
    }
} 