:root {
    /* Primary Colors */
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --primary-hover: #1d4ed8;
    --primary-shadow: rgb(37 99 235 / 25%);
    
    /* Legacy Primary (for backward compatibility) */
    --primary-color: var(--primary);
    --primary-color-light: var(--primary-light);
    
    /* Semantic Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --accent: #36cfc9;
    
    /* Legacy Semantic (for backward compatibility) */
    --success-color: var(--success);
    --warning-color: var(--warning);
    --danger-color: var(--danger);
    --info-color: var(--info);
    
    /* Surface Colors */
    --surface: #ffffff;
    --surface-muted: #f4f6fb;
    --surface-elevated: #ffffff;
    --background: #f8fafc;
    
    /* Legacy Surface (for backward compatibility) */
    --surface-color: var(--surface);
    --light-bg: var(--background);
    --secondary-bg: #e2e8f0;
    
    /* Border Colors */
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --border-dark: #cbd5e1;
    
    /* Legacy Border (for backward compatibility) */
    --border-color: var(--border);
    
    /* Text Colors */
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --text-inverse: #ffffff;
    
    /* Legacy Text (for backward compatibility) */
    --text-primary: var(--text-main);
    --text-secondary: var(--text-muted);
    --secondary-color: #334155;
    
    /* Shadow System */
    --shadow-soft: 0 20px 45px rgba(15, 23, 42, 0.08);
    --shadow-sm: 0 1px 2px rgb(15 23 42 / 0.08);
    --shadow-md: 0 4px 12px rgb(15 23 42 / 0.08);
    --shadow-lg: 0 12px 24px rgb(15 23 42 / 0.12);
    --shadow-xl: 0 20px 25px rgb(15 23 42 / 0.1);
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.75rem;
    --radius-lg: 1.5rem;
    --radius-xl: 2rem;
    --radius-full: 9999px;
    
    /* Legacy Border Radius (for backward compatibility) */
    --border-radius: var(--radius-lg);
    --border-radius-sm: var(--radius-md);
    --border-radius-lg: var(--radius-xl);
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    
    /* Layout */
    --max-width-reading: 720px;
    --max-width-content: 1200px;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    
    /* Body Fat Calculator Specific */
    --bfc-background: rgba(255, 255, 255, 0.1);
    --bfc-border: rgba(255, 255, 255, 0.2);
    --bfc-text: #ffffff;
}

.body-fat-calculator-page {
    padding: 2rem 0;
}

.bfc-intro {
    margin-bottom: 2rem;
    padding: 0;
}

.bfc-title {
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 1rem;
}

.bfc-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    max-width: 700px;
    line-height: 1.6;
}

.bfc-meta {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-start;
    flex-wrap: wrap;
    list-style: none;
    padding: 0;
    margin: 0;
}

.meta-chip {
    background: var(--light-bg);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
}

.bfc-main {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: clamp(1.5rem, 3vw, 2.5rem);
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.bfc-card {
    padding: 0rem 2rem;
    height: 100%;
}

.bfc-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.angle-support {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.bfc-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.field-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    color: var(--text-main);
    font-size: 1rem;
}

.tooltip {
    position: relative;
    display: inline-flex;
}

.tooltip-trigger {
    border: none;
    background: rgba(37, 99, 235, 0.12);
    color: var(--primary);
    border-radius: 999px;
    width: 1.75rem;
    height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: help;
    font-size: 0.8125rem;
    font-weight: 700;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.tooltip-trigger:hover {
    background: rgba(37, 99, 235, 0.2);
    transform: scale(1.05);
}

.tooltip-trigger:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.tooltip-text {
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1000;
    max-width: 200px;
    white-space: normal;
    text-align: center;
}

.tooltip-trigger:hover + .tooltip-text,
.tooltip-trigger:focus + .tooltip-text {
    opacity: 1;
}

.tooltip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1f2937;
}

.select-row {
    margin-bottom: 0.5rem;
}

.unit-select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-color);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.field-input {
    width: 100%;
    padding: 1rem 1.25rem;
    font-size: 1.125rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-color);
    color: var(--text-main);
    transition: all 0.2s ease;
}

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

.field-input::placeholder {
    color: var(--text-muted);
}

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

.input-with-unit .field-input {
    padding-right: 3.5rem;
}

.input-unit {
    position: absolute;
    right: 1.25rem;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.875rem;
    pointer-events: none;
}

.height-input-wrapper,
.weight-input-wrapper {
    display: flex;
    gap: 0.75rem;
}

.height-imperial-inputs {
    display: flex;
    gap: 0.75rem;
    width: 100%;
}

.height-imperial-inputs .field-input {
    flex: 1;
}

.gender-group {
    display: flex;
    gap: 0.75rem;
}

.gender-btn {
    flex: 1;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-color);
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.gender-btn:hover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
    color: var(--primary);
}

.gender-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.primary-btn,
.secondary-btn {
    flex: 1;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4);
}

.primary-btn:active {
    transform: translateY(0);
}

.secondary-btn {
    background: var(--surface-color);
    color: var(--text-main);
    border: 2px solid var(--border-color);
}

.secondary-btn:hover {
    background: var(--background);
    border-color: var(--primary);
    color: var(--primary);
}

.bfc-loading {
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.result-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-height: 500px;
    color: #ffffff;
    position: relative;
    overflow: hidden;
}

.result-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
    position: relative;
    z-index: 1;
}

.result-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    position: relative;
    z-index: 1;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    position: relative;
    z-index: 1;
}

.result-number {
    font-size: clamp(3rem, 7vw, 5rem);
    font-weight: 800;
    color: #ffffff;
    text-align: center;
    margin: 2rem 0;
    line-height: 1;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1;
}

.result-equation {
    text-align: center;
    color: rgba(255, 255, 255, 0.82);
    font-size: 1rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

.bfc-detailed-results {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    z-index: 1;
}

.bfc-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.bfc-result-item:last-child {
    border-bottom: none;
}

.bfc-result-label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
}

.bfc-result-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
}

.bfc-category-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.bfc-interpretation {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-top: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    z-index: 1;
}

.bfc-interpretation h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.75rem;
}

.bfc-interpretation p {
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
    margin: 0;
}

.result-actions {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    z-index: 1;
}

.copy-buttons-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font-weight: 600;
    transition: background 0.2s ease, transform 0.2s ease;
    cursor: pointer;
    font-size: 1rem;
    flex: 1 1 auto;
    min-width: 140px;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-1px);
}

.share-container {
    background: rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-top: 1rem;
}

.share-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: rgba(255, 255, 255, 0.85);
}

.share-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 0.75rem;
    border-radius: 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    color: #ffffff;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 20px rgba(15, 23, 42, 0.2);
}

.share-x {
    background: #000000;
    color: white;
}

.share-x:hover {
    background: #333333;
}

.share-facebook {
    background: #1877f2;
    color: white;
}

.share-facebook:hover {
    background: #166fe5;
}

.share-linkedin {
    background: #0a66c2;
    color: white;
}

.share-linkedin:hover {
    background: #095d9e;
}

.share-reddit {
    background: #ff4500;
    color: white;
}

.share-reddit:hover {
    background: #e03d00;
}

.share-telegram {
    background: #0088cc;
    color: white;
}

.share-telegram:hover {
    background: #0077b5;
}

.share-whatsapp {
    background: #25d366;
    color: white;
}

.share-whatsapp:hover {
    background: #20ba5a;
}

/* Responsive Design */
@media (max-width: 768px) {
    .bfc-title {
        font-size: 2rem;
    }
    
    .bfc-subtitle {
        font-size: 1.1rem;
    }
    
    .bfc-card {
        padding: 0rem 1rem;
    }
    
    .result-card {
        padding: 1.5rem;
        min-height: auto;
    }
    
    .result-number {
        font-size: 2.5rem;
    }
    
    .share-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .gender-group {
        flex-direction: column;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .copy-buttons-row {
        flex-direction: column;
    }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus styles for keyboard navigation */
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Loading animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Educational content styles */
.angle-seo-section {
    padding: 3rem 0;
    background: var(--background);
}

.angle-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

.angle-education-card h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 1rem;
}

.angle-education-card h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.angle-education-card p {
    color: var(--text-muted);
    line-height: 1.8;
    margin-bottom: 1rem;
}

.angle-education-card a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.angle-education-card a:hover {
    text-decoration: underline;
}

.infographic-conversion-formula {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.formula-box {
    background: var(--light-bg);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    border-left: 4px solid var(--primary);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.formula-box:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.formula-label {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.formula-content {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.75rem;
}

.formula-example {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.infographic-bmi-scale {
    margin: 2rem 0;
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    border: 1px solid var(--border);
}

.infographic-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 1rem;
    text-align: center;
}

.bmi-scale-visualization {
    margin-top: 1rem;
}

.bmi-scale-bar {
    display: flex;
    height: 80px;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.bmi-range {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    text-align: center;
    position: relative;
    transition: transform 0.2s ease;
}

.bmi-range:hover {
    transform: scale(1.05);
    z-index: 10;
}

.bmi-range-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.25rem;
}

.bmi-range-value {
    font-size: 0.65rem;
    color: #4b5563;
    line-height: 1.2;
}

.bmi-scale-markers {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    position: relative;
}

.scale-marker {
    font-size: 0.75rem;
    color: var(--text-muted);
    transform: translateX(-50%);
    position: absolute;
}

@media (max-width: 768px) {
    .angle-card {
        padding: 1.5rem;
    }
    
    .angle-education-card h2 {
        font-size: 1.5rem;
    }
    
    .angle-education-card h3 {
        font-size: 1.25rem;
    }
    
    .infographic-conversion-formula {
        grid-template-columns: 1fr;
    }
    
    .bmi-range-label,
    .bmi-range-value {
        font-size: 0.65rem;
    }
}

