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

/* CSS Variables for theme system */
:root {
    /* Light theme (default) */
    --bg-gradient-start: #667eea;
    --bg-gradient-end: #764ba2;
    --text-primary: #333;
    --text-secondary: #555;
    --text-muted: #666;
    --text-light: #999;
    --card-bg: #ffffff;
    --card-border: #e9ecef;
    --input-bg: #ffffff;
    --input-border: #e9ecef;
    --input-border-focus: #667eea;
    --button-bg: #f8f9fa;
    --button-hover: #e9ecef;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --neutral-color: #6c757d;
    --nav-bg: #ffffff;
    --nav-border: #e9ecef;
    --nav-button-hover: #f8f9fa;
    --nav-active-bg: #e7f3ff;
    --overlay-bg: rgba(0, 0, 0, 0.6);
    --placeholder-bg: #f8f9fa;
    --table-header-bg: #f8f9fa;
    --table-border: #e9ecef;
}

/* Dark theme */
[data-theme="dark"] {
    --bg-gradient-start: #667eea;
    --bg-gradient-end: #764ba2;
    --text-primary: #f7fafc;
    --text-secondary: #e2e8f0;
    --text-muted: #a0aec0;
    --text-light: #718096;
    --card-bg: #2d3748;
    --card-border: #4a5568;
    --input-bg: #2d3748;
    --input-border: #4a5568;
    --input-border-focus: #667eea;
    --button-bg: #4a5568;
    --button-hover: #718096;
    --success-color: #48bb78;
    --danger-color: #f56565;
    --warning-color: #ed8936;
    --neutral-color: #a0aec0;
    --nav-bg: #2d3748;
    --nav-border: #4a5568;
    --nav-button-hover: #4a5568;
    --nav-active-bg: #2c5282;
    --overlay-bg: rgba(0, 0, 0, 0.8);
    --placeholder-bg: #4a5568;
    --table-header-bg: #4a5568;
    --table-border: #4a5568;
    --header-icon-color: #ffffff;
    --header-title-color: #ffffff;
}

/* Light theme explicit */
[data-theme="light"] {
    --bg-gradient-start: #667eea;
    --bg-gradient-end: #764ba2;
    --text-primary: #333;
    --text-secondary: #555;
    --text-muted: #666;
    --text-light: #999;
    --card-bg: #ffffff;
    --card-border: #e9ecef;
    --input-bg: #ffffff;
    --input-border: #e9ecef;
    --input-border-focus: #667eea;
    --button-bg: #f8f9fa;
    --button-hover: #e9ecef;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --neutral-color: #6c757d;
    --nav-bg: #ffffff;
    --nav-border: #e9ecef;
    --nav-button-hover: #f8f9fa;
    --nav-active-bg: #e7f3ff;
    --overlay-bg: rgba(0, 0, 0, 0.6);
    --placeholder-bg: #f8f9fa;
    --table-header-bg: #f8f9fa;
    --table-border: #e9ecef;
}

[data-theme="auto"] {
    --bg-gradient-start: #667eea;
    --bg-gradient-end: #764ba2;
    --text-primary: #333;
    --text-secondary: #555;
    --text-muted: #666;
    --text-light: #999;
    --card-bg: #ffffff;
    --card-border: #e9ecef;
    --input-bg: #ffffff;
    --input-border: #e9ecef;
    --input-border-focus: #667eea;
    --button-bg: #f8f9fa;
    --button-hover: #e9ecef;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --neutral-color: #6c757d;
    --nav-bg: #ffffff;
    --nav-border: #e9ecef;
    --nav-button-hover: #f8f9fa;
    --nav-active-bg: #e7f3ff;
    --overlay-bg: rgba(0, 0, 0, 0.6);
    --placeholder-bg: #f8f9fa;
    --table-header-bg: #f8f9fa;
    --table-border: #e9ecef;
}

/* Auto theme dark mode (programmatically applied) */
[data-theme="auto"][data-time-mode="dark"] {
    --bg-gradient-start: #667eea;
    --bg-gradient-end: #764ba2;
    --text-primary: #f7fafc;
    --text-secondary: #e2e8f0;
    --text-muted: #a0aec0;
    --text-light: #718096;
    --card-bg: #2d3748;
    --card-border: #4a5568;
    --input-bg: #2d3748;
    --input-border: #4a5568;
    --input-border-focus: #667eea;
    --button-bg: #4a5568;
    --button-hover: #718096;
    --success-color: #48bb78;
    --danger-color: #f56565;
    --warning-color: #ed8936;
    --neutral-color: #a0aec0;
    --nav-bg: #2d3748;
    --nav-border: #4a5568;
    --nav-button-hover: #4a5568;
    --nav-active-bg: #2c5282;
    --overlay-bg: rgba(0, 0, 0, 0.8);
    --placeholder-bg: #4a5568;
    --table-header-bg: #4a5568;
    --table-border: #4a5568;
    --header-icon-color: #ffffff;
    --header-title-color: #ffffff;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    background-attachment: fixed;
    transition: all 0.3s ease;
}

.container {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
    min-height: auto;
    max-height: none;
    overflow-y: visible;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

html,
body {
    height: 100%;
    overflow-y: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    margin: 0;
    padding: 0;
    position: relative;
}

/* Ensure viewport works correctly on mobile */
@supports (-webkit-touch-callout: none) {

    html,
    body {
        height: -webkit-fill-available;
        min-height: -webkit-fill-available;
    }
}

/* Mobile Safari specific fixes */
@media screen and (max-width: 767px) {
    html {
        height: -webkit-fill-available;
    }

    body {
        min-height: 100vh;
        min-height: -webkit-fill-available;
        position: relative;
        overflow-x: hidden;
        overflow-y: auto;
    }

    .container {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    #settings-screen .container {
        min-height: 100vh;
        min-height: -webkit-fill-available;
        height: auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        display: flex;
        flex-direction: column;
        padding-top: 60px;
    }
}


/* Sticky header card styles */
.sticky-header-card {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-radius: 0;
    padding: 0 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--card-border);
    border-top: none;
    margin-bottom: 0;
    z-index: 100;
    height: calc(60px + env(safe-area-inset-top, 0px));
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    width: 100vw;
    padding-top: env(safe-area-inset-top, 0px);
}

.sticky-header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1;
}

.sticky-header-content .header-icon {
    font-size: 1.4rem;
    color: var(--header-icon-color, #667eea);
    transition: font-size 0.3s ease;
}

.sticky-header-content .header-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0;
    color: var(--header-title-color, #667eea);
    transition: font-size 0.3s ease;
}

.sticky-header-card .info-icon-btn {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    color: var(--text-primary);
    opacity: 0.7;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sticky-header-card .info-icon-btn:hover {
    opacity: 1;
    background: var(--button-hover);
}

/* Compact state when scrolled */
.sticky-header-card.compact .header-icon {
    font-size: 1.2rem;
}

.sticky-header-card.compact .header-title {
    font-size: 1.2rem;
}

/* Home screen uses full viewport height */
#home-screen .container {
    min-height: 100vh;
    max-height: none;
    overflow-y: visible;
    padding-bottom: 120px;
    padding-top: 80px;
}

/* History screen needs flexible height for proper scrolling */
#history-screen .container {
    min-height: 100vh;
    max-height: none;
    overflow-y: visible;
    padding-bottom: 120px;
}

/* Log Weight, Personal and Settings screens need flexible height for proper scrolling */
#log-weight-screen .container,
#personal-screen .container {
    min-height: 100vh;
    max-height: none;
    overflow-y: auto;
    padding-bottom: 120px;
    padding-top: 80px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
}

/* Settings screen with enhanced vertical scrolling */
#settings-screen .container {
    min-height: 100vh;
    max-height: none;
    overflow-y: auto;
    padding-bottom: 120px;
    padding-top: 60px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
}

/* History screen needs flexible height for proper scrolling */
#history-screen .container {
    min-height: 100vh;
    max-height: none;
    overflow-y: visible;
    padding-bottom: 120px;
    padding-top: 80px;
}

#home-screen.screen:not(.modal-popup) .container {
    padding-top: 10px;
}

.screen {
    display: block;
    opacity: 1;
}

.screen.hidden {
    display: none;
}

/* Settings Screen Styles */
.settings-header {
    display: none;
    /* Hidden since we're using sticky header */
}

.settings-header h2 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.settings-form {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 10px;
    width: 100%;
    max-width: 495px;
    margin: 0px auto;
    position: relative;
    margin-top: 10px;
}

.settings-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.settings-section h3 {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    gap: 4px;
}

.settings-section h3 .section-icon {
    color: var(--text-primary);
}



.section-icon {
    font-size: 1.2rem;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-label {
    font-weight: 400;
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.label-icon {
    font-size: 0.85rem;
    opacity: 0.7;
}

.radio-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 6px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
    background: var(--button-bg);
    color: var(--text-primary);
    font-size: 0.9rem;
}

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

.radio-option input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 16px;
    height: 16px;
    border: 2px solid var(--input-border);
    border-radius: 50%;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.radio-option input[type="radio"]:checked+.radio-custom {
    border-color: #667eea;
    background: #667eea;
}

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

.radio-option input[type="radio"]:checked~* {
    color: #667eea;
}

/* Button Styles */
.primary-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    align-self: center;
    min-width: 180px;
    margin-top: 10px;
}

.primary-button:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b4c9a 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}



/* Home Screen Styles */
.home-header {
    display: none;
    /* Hidden since we're using sticky header */
}

.home-header h1,
.home-header h2 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Universal sticky header for all screens */
.screen-sticky-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-radius: 0;
    padding: 0 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--card-border);
    border-top: none;
    margin-bottom: 0;
    z-index: 100;
    height: calc(50px + env(safe-area-inset-top, 0px));
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    width: 100vw;
    padding-top: env(safe-area-inset-top, 0px);
}

.screen-sticky-header .header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1;
}

.screen-sticky-header .header-icon {
    font-size: 1.4rem;
    color: var(--header-icon-color, #667eea);
    transition: font-size 0.3s ease;
}

.screen-sticky-header .header-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0;
    color: var(--header-title-color, #667eea);
    transition: font-size 0.3s ease;
}

.screen-sticky-header .info-icon-btn {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    opacity: 0.7;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.screen-sticky-header .info-icon-btn:hover {
    opacity: 1;
    background: var(--button-hover);
    transform: scale(1.1);
}

.screen-sticky-header .info-icon-btn.shine {
    animation: pulseShine 2s ease-in-out infinite;
}

/* Compact state when needed */
.screen-sticky-header.compact .header-icon {
    font-size: 1.2rem;
}

.screen-sticky-header.compact .header-title {
    font-size: 1.2rem;
}



.user-name-gradient {
    background: linear-gradient(-45deg, #667eea, #764ba2, #f093fb, #f5576c, #4facfe, #00f2fe);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientBreathe 6s ease-in-out infinite;
    font-weight: 600;
    display: inline;
}

@keyframes gradientBreathe {

    0%,
    100% {
        background-position: 0% 50%;
        opacity: 0.8;
    }

    25% {
        background-position: 25% 50%;
        opacity: 0.9;
    }

    50% {
        background-position: 50% 50%;
        opacity: 1;
    }

    75% {
        background-position: 75% 50%;
        opacity: 0.9;
    }
}

/* Progress Overview Section */
.progress-overview-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 15px;
    margin-top: 70px;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--card-border);
}

.chart-section,
.recommended-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--card-border);
}

.progress-overview-section h2,
.chart-section h2,
.recommended-section h2 {
    color: var(--text-primary);
    font-size: 1.3rem;
    margin-bottom: 12px;
    text-align: center;
    font-weight: 600;
}

.heading-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 12px;
}

.progress-stat {
    flex: 1;
    text-align: center;
    padding: 12px 8px;
    background: var(--placeholder-bg);
    border-radius: 8px;
    border: 1px solid var(--card-border);
}

.progress-stat .stat-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.progress-stat .stat-value {
    display: block;
    font-size: 1.3rem;
    font-weight: 400;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.progress-bar-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 12px;
}

.progress-bar {
    flex: 1;
    height: 12px;
    background: #e9ecef;
    border-radius: 6px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.8s ease;
}

.progress-percentage {
    font-size: 0.9rem;
    font-weight: 600;
    color: #667eea;
    min-width: 35px;
}

.overview-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.metric-item {
    text-align: center;
    padding: 12px 8px;
    background: var(--placeholder-bg);
    border-radius: 8px;
    border: 1px solid var(--card-border);
}



.metric-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.metric-value {
    display: block;
    font-size: 1.2rem;
    font-weight: 400;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Recommended Products Section */
.recommended-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--card-border);
}

.recommended-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.recommended-header h2 {
    margin: 0;
}

/* More button styling - COMMENTED OUT (More button functionality disabled)
.more-button {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #4A5BA3;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.more-button:hover:not(:disabled) {
    background: #6BB6D6;
    transform: translateY(-1px);
}

.more-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.more-button.rate-limited {
    background: linear-gradient(135deg, #ffc107 0%, #ff8c00 100%);
    cursor: not-allowed;
}

.more-button i {
    font-size: 0.9rem;
}
*/

.products-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.product-card {
    display: flex;
    background: #ffffff;
    border-radius: 8px;
    padding: 8px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.product-image {
    width: 75px;
    height: 75px;
    border-radius: 6px;
    object-fit: cover;
    background: #ddd;
    flex-shrink: 0;
    margin-right: 10px;
    align-self: center;
}

.product-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.product-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: #333;
    margin-bottom: 1px;
}

.product-description {
    font-size: 0.75rem;
    color: #666;
    line-height: 1.2;
    margin-bottom: 4px;
}

.product-link {
    color: #667eea;
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    align-self: flex-start;
    transition: all 0.2s ease;
}

.product-link:hover {
    color: #5a67d8;
    text-decoration: underline;
}

.products-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 15px 0 8px;
    padding: 8px;
}

.nav-products-btn {
    background: #667eea;
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.nav-products-btn:hover:not(:disabled) {
    background: #5a67d8;
    transform: scale(1.1);
}

.nav-products-btn:disabled {
    background: var(--neutral-color);
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
}

.products-page-info {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 60px;
    text-align: center;
}

.affiliate-disclosure {
    font-size: 0.5rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 8px;
    padding-top: 8px;
    /*  border-top: 1px solid var(--card-border); */
    font-style: italic;
    opacity: 0.8;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 10px;
}

.chart-header h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.3rem;
    text-align: center;
}



.chart-filters {
    display: flex;
    gap: 8px;
}

.filter-btn {
    padding: 6px 12px;
    border: 1px solid var(--card-border);
    background: var(--button-bg);
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    background: var(--button-hover);
}

.filter-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.chart-container {
    position: relative;
    height: 300px;
    margin: 0 auto;
}



.period-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 6px 8px;
    background: var(--placeholder-bg);
    border-radius: 8px;
    border: 1px solid var(--card-border);
    margin-bottom: 12px;
}

.period-nav-btn {
    background: #667eea;
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    font-weight: normal;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-family: 'Arial', sans-serif;
    line-height: 1;
    text-align: center;
    flex-shrink: 0;
}

.period-nav-btn:hover:not(:disabled) {
    background: #5a67d8;
    transform: scale(1.1);
}

.period-nav-btn:disabled {
    background: var(--neutral-color);
    cursor: not-allowed;
    opacity: 0.6;
}

.period-display {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 160px;
    text-align: center;
    flex-shrink: 1;
}

/* Weight Log Screen Styles */
.log-weight-header {
    display: none;
    /* Hidden since we're using sticky header */
}

.log-weight-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 3px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    color: white;
    text-align: left;
    margin: 0;
    flex: 1;
}



/* History Screen Styles */
.history-header {
    display: none;
    /* Hidden since we're using sticky header */
}

.history-header h2 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.log-weight-form {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 0px none;
    margin-bottom: 10px;
    height: auto;
}

.log-weight-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.log-weight-section h3 {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 15px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.log-weight-section h3 .section-icon {
    color: var(--text-primary);
}

.history-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 0px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 10px;
}

.history-section h3 {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 15px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-section h3 .section-icon {
    color: var(--text-primary);
}

.history-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.history-stat {
    text-align: center;
    padding: 15px 10px;
    background: var(--placeholder-bg);
    border-radius: 8px;
    border: 1px solid var(--card-border);
}

.history-stat .stat-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.history-stat .stat-value {
    display: block;
    font-size: 1.3rem;
    font-weight: 400;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.history-table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--table-border);
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
}

.history-table th,
.history-table td {
    padding: 6px 4px;
    text-align: left;
    border-bottom: 1px solid var(--table-border);
    word-wrap: break-word;
}

.history-table th {
    background: var(--table-header-bg);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.75rem;
    white-space: normal;
    line-height: 1.2;
    vertical-align: top;
}

.history-table th span {
    font-weight: 600;
    color: var(--text-primary);
}

#sort-indicator {
    font-size: 0.7rem;
    margin-left: 4px;
}

.history-table td {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.history-table th:nth-child(1),
.history-table td:nth-child(1) {
    width: 25%;
}

.history-table th:nth-child(2),
.history-table td:nth-child(2) {
    width: 20%;
}

.history-table th:nth-child(3),
.history-table td:nth-child(3) {
    width: 20%;
}

.history-table th:nth-child(4),
.history-table td:nth-child(4) {
    width: 15%;
}

.history-table th:nth-child(5),
.history-table td:nth-child(5) {
    width: 20%;
}

/* Input Group Styles for Unified Input Fields */
.input-group {
    display: flex;
    align-items: stretch;
    gap: 0;
    height: 35px;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--input-bg);
    transition: all 0.3s ease;
}

.input-group:focus-within {
    border-color: var(--input-border-focus);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-group .number-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 6px 12px;
    height: 100%;
}

.input-group .number-input:focus {
    outline: none;
    box-shadow: none;
}

.input-group .unit-label {
    display: flex;
    align-items: center;
    padding: 0 12px;
    background: var(--placeholder-bg);
    border-left: 1px solid var(--input-border);
    color: #667eea;
    font-weight: 500;
    font-size: 0.9rem;
    min-width: 40px;
    justify-content: center;
}

/* Segmented Control for Gender Selection */
.segmented-control {
    display: flex;
    background: var(--placeholder-bg);
    border-radius: 8px;
    border: 1px solid var(--input-border);
    overflow: hidden;
}

.segmented-control input[type="radio"] {
    display: none;
}

.segmented-control .segment {
    flex: 1;
    padding: 8px 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-secondary);
    background: transparent;
}

.segmented-control input[type="radio"]:checked+.segment {
    background: #667eea;
    color: white;
}

.segmented-control .segment:hover:not(input[type="radio"]:checked + .segment) {
    background: var(--button-hover);
}





.weight-change {
    font-weight: 600;
}

.weight-change.goal-positive {
    color: var(--success-color);
}

.weight-change.goal-negative {
    color: var(--danger-color);
}

.weight-change.goal-neutral {
    color: var(--neutral-color);
}

/* Expandable notes styles */
.notes-icon {
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.notes-icon:hover {
    background: var(--button-hover);
    color: var(--text-primary);
}

.expandable-row {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.expandable-row:hover {
    background-color: var(--placeholder-bg);
}

.expanded-notes {
    background-color: var(--placeholder-bg);
}

.expanded-notes td {
    border-top: none;
    padding-top: 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--table-border);
}

.notes-content-expanded {
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 8px 12px;
    background: var(--card-bg);
    border-radius: 6px;
    border: 1px solid var(--input-border);
    margin-top: 8px;
    line-height: 1.4;
}

/* Circular icon buttons */
.circular-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    margin-right: 4px;
}

.edit-btn.circular-icon {
    background: #667eea;
    color: white;
}

.edit-btn.circular-icon:hover {
    background: #5a67d8;
    transform: scale(1.1);
}

.delete-btn.circular-icon {
    background: #dc3545;
    color: white;
}

.delete-btn.circular-icon:hover:not(:disabled) {
    background: #c82333;
    transform: scale(1.1);
}

.delete-btn.circular-icon:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
}

.actions-cell {
    white-space: nowrap;
    position: relative;
}

/* Mobile menu button */
.mobile-menu-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.mobile-menu-btn:hover {
    background: var(--button-hover);
    color: var(--text-primary);
}

/* Context menu */
.context-menu {
    position: absolute;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 100px;
    right: 0;
    top: 100%;
    margin-top: 4px;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.context-menu-item:hover {
    background: var(--button-hover);
    color: var(--text-primary);
}

.context-menu-item:first-child {
    border-radius: 6px 6px 0 0;
}

.context-menu-item:last-child {
    border-radius: 0 0 6px 6px;
}

/* Desktop actions - side by side */
@media (min-width: 768px) {
    .desktop-actions {
        display: flex;
        gap: 6px;
        opacity: 0;
        transition: opacity 0.2s ease;
        align-items: center;
        justify-content: center;
    }

    .history-table tbody tr:hover .desktop-actions {
        opacity: 1;
    }

    .mobile-menu-btn {
        display: none;
    }
}

/* Mobile swipe actions */
@media (max-width: 767px) {
    .history-table {
        table-layout: fixed;
    }

    .table-row {
        position: relative;
        transition: transform 0.3s ease;
        overflow: visible;
        height: 48px;
        min-height: 48px;
    }

    .table-row.swiped-left {
        transform: translateX(-80px);
        overflow: visible;
    }

    .table-row td {
        vertical-align: middle;
        position: relative;
        height: 48px;
        line-height: 1.2;
        padding: 8px 4px;
    }

    .desktop-actions {
        display: none;
    }

    .swipe-actions {
        position: absolute;
        right: -80px;
        top: 0;
        height: 48px;
        width: 80px;
        background: var(--card-bg);
        border-left: 1px solid var(--table-border);
        border-bottom: 1px solid var(--table-border);
        display: none;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 6px;
        z-index: 10;
        box-sizing: border-box;
    }

    .swipe-action {
        width: 30px;
        height: 30px;
        border-radius: 50%;
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.8rem;
        cursor: pointer;
        transition: all 0.2s ease;
        flex-shrink: 0;
    }

    .swipe-action.edit-action {
        background: #667eea;
        color: white;
    }

    .swipe-action.edit-action:hover {
        background: #5a67d8;
        transform: scale(1.1);
    }

    .swipe-action.delete-action {
        background: #dc3545;
        color: white;
    }

    .swipe-action.delete-action:hover {
        background: #c82333;
        transform: scale(1.1);
    }

    /* Prevent text selection during swipe */
    .table-row {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }

    /* Re-enable text selection for notes when expanded */
    .notes-content-expanded {
        -webkit-user-select: text;
        -moz-user-select: text;
        -ms-user-select: text;
        user-select: text;
    }
}

/* Starting weight row styling */
.starting-weight-row {
    background-color: var(--placeholder-bg);
}

.starting-weight-row td {
    background-color: var(--placeholder-bg);
}

/* Notes sub-row styling */
.notes-row {
    border-top: none;
}

.notes-row td {
    border-top: none;
    padding-top: 2px;
    padding-bottom: 8px;
}

.notes-cell {
    padding-left: 12px;
    padding-right: 12px;
}

.notes-content {
    font-size: 0.7rem;
    color: var(--text-light);
    font-style: italic;
    line-height: 1.3;
    padding: 4px 8px;
    background: var(--placeholder-bg);
    border-radius: 4px;
    border: 1px solid var(--card-border);
}

.starting-weight-notes .notes-content {
    background: var(--button-bg);
}

/* Starting weight display above table */
.starting-weight-display {
    background: var(--placeholder-bg);
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    margin-bottom: 5px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-align: center;
}

.starting-weight-display span {
    font-weight: 600;
    color: var(--text-primary);
}



/* Personal Screen Styles */
.personal-header {
    display: none;
    /* Hidden since we're using sticky header */
}

.personal-header h2 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.personal-form {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 0px solid var(--card-border);
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 10px;
}

.personal-section {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.personal-section h3 {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.personal-section h3 .section-icon {
    color: var(--text-primary);
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.date-weight-row,
.height-target-row {
    display: flex;
    gap: 15px;
}

.date-field,
.weight-field,
.height-field,
.target-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.field-label {
    font-weight: 400;
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.text-input,
.number-input {
    padding: 6px 7.5px;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    font-size: 1rem;
    font-weight: normal;
    transition: all 0.3s ease;
    background: var(--input-bg);
    color: var(--text-primary);
    font-family: inherit;
    resize: vertical;
    min-height: 35px;
    height: 35px;
    box-sizing: border-box;
}

.text-input:focus,
.number-input:focus {
    outline: none;
    border-color: var(--input-border-focus);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-with-unit {
    display: flex;
    align-items: stretch;
    gap: 5px;
    height: 35px;
    width: 100%;
    max-width: 100%;
}

.input-with-unit .number-input {
    flex: 1;
    height: 35px;
    min-width: 0;
    width: 0;
}

.unit-display {
    font-size: 1rem;
    color: #667eea;
    font-weight: 400;
    min-width: 30px;
    max-width: 30px;
    display: flex;
    align-items: center;
    height: 35px;
    padding: 0 5px;
    flex-shrink: 0;
}

/* Bottom Navigation Styles */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--nav-bg);
    border-top: 1px solid var(--nav-border);
    padding: 15px 0 15px;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.bottom-nav-content {
    max-width: 500px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-left {
    display: flex;
    gap: 5px;
}

.nav-right {
    display: flex;
    gap: 10px;
}

.nav-button {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    padding: 8px 6px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 60px;
    height: 60px;
    flex-shrink: 0;
}

.nav-button[data-screen="log-weight"] {
    width: 105px;
}

.nav-button:hover {
    background: var(--nav-button-hover);
}

.nav-button.active {
    background: var(--nav-active-bg);
    color: #667eea;
}

.nav-icon {
    font-size: 1.4rem;
    opacity: 0.7;
    transition: all 0.2s ease;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    flex: 0 0 auto;
    height: 28px;
    line-height: 1;
}

.nav-button.active .nav-icon {
    opacity: 1;
    color: #667eea;
}

.nav-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    flex: 0 0 auto;
    height: 16px;
    line-height: 1;
    text-align: center;
}

.nav-button.active .nav-label {
    color: #667eea;
}

/* Bottom padding is now handled in individual screen rules above */

/* Hide navigation bar only on welcome screen */
#welcome-screen~.bottom-nav {
    display: none;
}

/* Show navigation bar when other screens are active */
.screen:not(#welcome-screen):not(.hidden)~.bottom-nav,
#home-screen:not(.hidden)~.bottom-nav,
#personal-screen:not(.hidden)~.bottom-nav,
#log-weight-screen:not(.hidden)~.bottom-nav,
#history-screen:not(.hidden)~.bottom-nav,
#settings-screen:not(.hidden)~.bottom-nav {
    display: block;
}

/* Responsive Design */
@media (max-width: 480px) {
    .container {
        padding: 15px;
        align-items: center;
    }

    /* Enhanced mobile Settings screen scrolling */
    #settings-screen .container {
        align-items: stretch;
        padding: 15px;
        height: 100vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start;
        padding-top: 80px;
        padding-bottom: 120px;
    }

    .settings-form {
        width: 100%;
        max-width: 400px;
        margin: 0 auto 15px;
        padding: 18px;
        box-sizing: border-box;
    }

    .welcome-header h2,
    .settings-header h2,
    .personal-header h2,
    .log-weight-header h2,
    .history-header h2,
    .home-header h2 {
        font-size: 1.5rem;
    }



    /* Consistent card styling for all screens */
    .tips-section,
    .settings-form,
    .personal-form,
    .log-weight-form,
    .history-section,
    .chart-section,
    .recommended-section {
        padding: 18px;
        width: 100%;
        max-width: 400px;
        margin: 0 auto 15px;
        box-sizing: border-box;
    }

    .progress-overview-section {
        padding: 15px;
        width: 100%;
        max-width: 400px;
        margin: 70px auto 15px;
        box-sizing: border-box;
    }



    .products-container {
        align-items: center;
        width: 100%;
    }

    .product-card {
        width: 100%;
        max-width: 360px;
    }

    .bottom-nav-content {
        padding: 0 10px;
        justify-content: space-between;
    }

    .nav-left {
        gap: 3px;
    }

    .nav-right {
        gap: 7px;
    }

    .nav-button {
        width: 55px;
        height: 56px;
        padding: 6px 4px;
    }

    .nav-button[data-screen="log-weight"] {
        width: 98px;
    }

    .nav-icon {
        height: 26px;
        font-size: 1.3rem;
    }

    .nav-label {
        height: 14px;
        font-size: 0.7rem;
    }

    .tip-item {
        gap: 12px;
    }

    .radio-group {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        gap: 6px;
    }

    /* Specific adjustments for theme and weight goal sections */
    .settings-section .radio-group {
        grid-template-columns: repeat(3, 1fr);
        gap: 4px;
    }

    .radio-option {
        padding: 6px 6px;
        font-size: 0.85rem;
        min-width: 0;
        justify-content: center;
    }

    .date-weight-row,
    .height-target-row {
        gap: 12px;
    }

    .date-field,
    .weight-field,
    .height-field,
    .target-field {
        min-width: 0;
        flex: 1;
    }

    .date-field .text-input,
    .weight-field .input-with-unit,
    .height-field .input-with-unit,
    .target-field .input-with-unit {
        width: 100%;
        max-width: 100%;
    }

    .weight-field .number-input,
    .height-field .number-input,
    .target-field .number-input {
        min-width: 0;
        flex: 1;
        max-width: 100%;
    }

    .weight-field .input-with-unit,
    .height-field .input-with-unit,
    .target-field .input-with-unit {
        max-width: 100%;
        overflow: hidden;
    }



    .chart-container {
        height: 250px;
    }

    .chart-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        flex-wrap: nowrap;
    }

    .chart-header h2 {
        font-size: 1.1rem;
        margin: 0;
        flex-shrink: 1;
        min-width: 0;
    }

    /* Modal adjustments for mobile */
    .screen.modal-popup {
        width: 95%;
        max-width: 95%;
        max-height: 90vh;
    }

    .screen.modal-popup .container {
        max-height: 90vh;
    }

    .chart-filters {
        gap: 6px;
    }

    .filter-btn {
        padding: 5px 10px;
        font-size: 0.8rem;
    }

    /* Ensure navigation buttons don't get cut off */
    .period-navigation {
        overflow: visible;
        flex-wrap: nowrap;
    }

    /* Mobile-specific period navigation fixes */
    .period-navigation {
        gap: 4px;
        padding: 4px 6px;
    }

    .period-nav-btn {
        width: 28px;
        height: 28px;
        min-width: 28px;
        min-height: 28px;
        font-size: 0.75rem;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .period-display {
        font-size: 0.75rem;
        min-width: 120px;
        flex-shrink: 1;
    }
}

/* Toast Notification */
.toast-notification {
    position: fixed;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--success-color);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
    z-index: 1001;
    opacity: 0;
    animation: slideInUp 0.4s ease-out forwards, slideOutDown 0.3s ease-in 2.5s forwards;
    min-width: 200px;
    text-align: center;
}

@keyframes slideInUp {
    from {
        transform: translateX(-50%) translateY(100px);
        opacity: 0;
    }

    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

@keyframes slideOutDown {
    from {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }

    to {
        transform: translateX(-50%) translateY(100px);
        opacity: 0;
    }
}

/* Info Screen Styles */
.info-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Removed .data-management-link styles as requested */

/* Breadcrumb navigation styles */
.breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.breadcrumb-link {
    color: #667eea;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s ease;
}

.breadcrumb-link:hover {
    color: #5a67d8;
    text-decoration: underline;
}

.breadcrumb-separator {
    color: var(--text-muted);
    font-weight: normal;
}

.breadcrumb-current {
    color: var(--text-primary);
    font-weight: 500;
}

.info-main-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 25px 25px 25px 25px;
    width: 100%;
    max-width: 450px;
    max-height: calc(90vh + 20px);
    overflow-y: auto;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--card-border);
    animation: slideUpIn 0.3s ease-out;
    position: relative;
}

/* Content wrapper for swipe transitions */
.content-wrapper {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
}

.settings-content {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
}

/* About Calculator, Privacy Policy, and Terms content styles */
.about-content,
.privacy-content,
.terms-content {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
}

.about-content-wrapper,
.privacy-content-wrapper,
.terms-content-wrapper {
    padding: 0 5px;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
}

.about-intro,
.privacy-intro,
.terms-intro {
    background: var(--placeholder-bg);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #667eea;
}

.about-intro p,
.privacy-intro p,
.terms-intro p {
    margin: 0 0 8px 0;
    line-height: 1.5;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.about-intro p:last-child,
.privacy-intro p:last-child,
.terms-intro p:last-child {
    margin-bottom: 0;
}

.about-sections,
.privacy-sections,
.terms-sections {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.about-section,
.privacy-section,
.terms-section {
    background: var(--placeholder-bg);
    padding: 18px;
    border-radius: 8px;
    border: 1px solid var(--card-border);
}

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.section-number {
    font-size: 1.4rem;
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.section-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.2;
}

.section-details {
    margin-left: 0;
}

.section-details p {
    margin: 0 0 10px 0;
    line-height: 1.5;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.section-details p:last-child {
    margin-bottom: 0;
}

.section-details ul {
    margin: 10px 0;
    padding-left: 20px;
}

.section-details li {
    margin-bottom: 5px;
    color: var(--text-secondary);
    line-height: 1.4;
    font-size: 0.9rem;
}

.section-details strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {

    .about-intro,
    .privacy-intro,
    .terms-intro {
        padding: 12px;
        margin-bottom: 15px;
    }

    .about-intro p,
    .privacy-intro p,
    .terms-intro p {
        font-size: 0.85rem;
    }

    .about-sections,
    .privacy-sections,
    .terms-sections {
        gap: 12px;
    }

    .about-section,
    .privacy-section,
    .terms-section {
        padding: 15px;
    }

    .section-header {
        gap: 10px;
        margin-bottom: 12px;
    }

    .section-number {
        font-size: 1.2rem;
        min-width: 28px;
    }

    .section-header h3 {
        font-size: 1rem;
    }

    .section-details p {
        font-size: 0.85rem;
    }

    .section-details li {
        font-size: 0.85rem;
    }
}

@keyframes slideUpIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

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

.info-header {
    text-align: center;
    margin-bottom: 25px;
    position: relative;
}

.info-header h2 {
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.info-close-btn-top {
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--button-bg);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.info-close-btn-top:hover {
    background: var(--button-hover);
    transform: scale(1.1);
}

.info-cards-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 25px;
}

.info-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 16px;
    background: var(--placeholder-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    height: 50%;
}

.info-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    background: var(--button-hover);
}

.info-card-icon {
    font-size: 1.8rem;
    width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.info-card-content {
    flex: 1;
}

.info-card-content h3 {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 4px 0;
    line-height: 1.2;
}

.info-card-content p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 0;
    line-height: 1.3;
}



/* Log weight header adjustment for info icon positioning */
.log-weight-header {
    position: relative;
    display: flex;
    align-items: left;
    justify-content: space-between;
}

.info-icon-btn {
    position: absolute;
    top: 0;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    opacity: 0.8;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.info-icon-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.info-icon-btn.shine {
    animation: pulseShine 2s ease-in-out infinite;
}

@keyframes pulseShine {

    0%,
    100% {
        opacity: 0.8;
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4);
    }

    50% {
        opacity: 1;
        box-shadow: 0 0 0 8px rgba(255, 255, 255, 0);
    }
}

/* Settings card within info screen */
.info-settings-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    width: 100%;
    max-width: 450px;
    min-height: 85vh;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--card-border);
    position: relative;
    margin: 0 auto;
}

.settings-form-compact {
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-height: auto;
    overflow-y: visible;
    margin: 00px;
}

.settings-section-compact {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.settings-section-compact h3 {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    gap: 6px;
}

.setting-item-compact {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.info-actions {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

.info-back-btn,
.info-save-btn {
    flex: 1;
    padding: 12px 20px;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.info-back-btn {
    background: var(--button-bg);
    color: var(--text-primary);
}

.info-back-btn:hover {
    background: var(--button-hover);
    transform: translateY(-1px);
}

.info-save-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.info-save-btn:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b4c9a 100%);
    transform: translateY(-1px);
}

/* Weighing Practices Content Styles */
.practices-content-wrapper {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
}

.practices-intro {
    background: var(--placeholder-bg);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 25px;
    border-left: 4px solid #667eea;
}

.practices-intro p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
}

.practices-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 25px;
}

.practice-item {
    background: var(--placeholder-bg);
    border-radius: 10px;
    border: 1px solid var(--card-border);
    overflow: hidden;
}

.practice-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 18px;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    color: white;
}

.practice-number {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1rem;
    flex-shrink: 0;
}

.practice-header h3 {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.2;
}

.practice-details {
    padding: 18px;
}

.practice-details p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0 0 12px 0;
}

.practice-details p:last-child {
    margin-bottom: 0;
}

.practices-additional-tips {
    background: var(--placeholder-bg);
    border-radius: 10px;
    border: 1px solid var(--card-border);
    padding: 20px;
    margin-bottom: 15px;
}

.practices-additional-tips h3 {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 15px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--card-border);
}

.practices-additional-tips ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.practices-additional-tips li {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 12px;
    padding-left: 15px;
    position: relative;
}

.practices-additional-tips li:last-child {
    margin-bottom: 0;
}

.practices-additional-tips li::before {
    content: '•';
    color: var(--bg-gradient-start);
    font-weight: bold;
    position: absolute;
    left: 0;
}

.practices-additional-tips strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* First Time Setup Content Styles */
.setup-content-wrapper {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
}

.setup-intro {
    background: var(--placeholder-bg);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 25px;
    border-left: 4px solid #667eea;
}

.setup-intro p {
    margin: 0;
    line-height: 1.5;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.setup-sections {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 25px;
}

.setup-section {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--placeholder-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.setup-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    background: var(--button-hover);
}

.section-icon-wrapper {
    font-size: 1.6rem;
    width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.section-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.section-content h3 {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.2;
}

.section-content p {
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin: 0;
    line-height: 1.3;
}

.status-indicator {
    margin-top: 2px;
}

.status-badge {
    display: inline-block;
    padding: 3px 6px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-badge.status-pending {
    background: rgba(255, 193, 7, 0.2);
    color: #856404;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.status-badge.status-complete {
    background: rgba(40, 167, 69, 0.2);
    color: #155724;
    border: 1px solid rgba(40, 167, 69, 0.3);
}

.nav-arrow {
    font-size: 1.2rem;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.setup-section:hover .nav-arrow {
    color: var(--text-primary);
    transform: translateX(4px);
}

.setup-help {
    background: var(--placeholder-bg);
    border-radius: 10px;
    border: 1px solid var(--card-border);
    padding: 20px;
    margin-bottom: 15px;
}

.setup-help h3 {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 15px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--card-border);
}

.help-icons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.help-icon-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.help-icon-item i {
    font-size: 1.4rem;
    width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.help-icon-item span {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.4;
}

/* Mobile adjustments for setup content */
@media (max-width: 768px) {
    .setup-intro {
        padding: 12px;
        margin-bottom: 20px;
    }

    .setup-intro p {
        font-size: 0.85rem;
    }

    .setup-sections {
        gap: 10px;
        margin-bottom: 20px;
    }

    .setup-section {
        padding: 12px 14px;
        gap: 10px;
    }

    .section-icon-wrapper {
        font-size: 1.4rem;
        width: 32px;
    }

    .section-content h3 {
        font-size: 0.95rem;
    }

    .section-content p {
        font-size: 0.75rem;
    }

    .status-badge {
        font-size: 0.65rem;
        padding: 2px 5px;
    }

    .setup-help {
        padding: 15px;
    }

    .setup-help h3 {
        font-size: 1rem;
    }

    .help-icon-item i {
        font-size: 1.2rem;
        width: 28px;
    }

    .help-icon-item span {
        font-size: 0.8rem;
    }
}

/* Mobile adjustments for info screen */
@media (max-width: 480px) {

    .info-main-card,
    .info-settings-card {
        padding: 20px;
        max-height: 95vh;
    }

    .info-close-btn-top {
        top: -5px;
        right: -5px;
        width: 28px;
        height: 28px;
        font-size: 1rem;
    }

    .info-card {
        padding: 14px;
        gap: 12px;
    }

    .info-card-icon {
        font-size: 1.6rem;
        width: 35px;
    }

    .info-card-content h3 {
        font-size: 0.95rem;
    }

    .info-card-content p {
        font-size: 0.8rem;
    }

    .info-icon-btn {
        font-size: 1.1rem;
        width: 36px;
        height: 36px;
        position: fixed;
        top: 10px;
        right: 15px;
    }

    .settings-section-compact h3 {
        font-size: 0.95rem;
    }

    .info-actions {
        gap: 10px;
    }

    .info-back-btn,
    .info-save-btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    .practices-intro {
        padding: 12px;
        margin-bottom: 20px;
    }

    .practices-intro p {
        font-size: 0.85rem;
    }

    .practices-list {
        gap: 15px;
        margin-bottom: 20px;
    }

    .practice-header {
        padding: 12px 15px;
        gap: 10px;
    }

    .practice-number {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }

    .practice-header h3 {
        font-size: 1rem;
    }

    .practice-details {
        padding: 15px;
    }

    .practice-details p {
        font-size: 0.85rem;
    }

    .practices-additional-tips {
        padding: 15px;
    }

    .practices-additional-tips h3 {
        font-size: 1rem;
    }
}

/* Show confetti animation */
function showConfettiAnimation() {