* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
    -webkit-touch-callout: none; /* Disable callout on long-press */
}

/* Global scrollbar styling */
/* Hide scrollbar for Chrome, Safari and Opera */
::-webkit-scrollbar {
    display: none;
}

/* Hide scrollbar for IE, Edge and Firefox */
* {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

:root {
    /* Light theme (default) */
    --primary-color: #6c40c0;
    --secondary-color: #e2d2fd;
    --light-purple: #e6d1ff;
    --dark-purple: #3a2f6a;
    --success-color: #76c771;
    --card-bg-1: #e9d3ff;
    --card-bg-2: #ffe6d7;
    --card-bg-3: #e8f1d8;
    --card-bg-4: #f1d8e8;
    
    /* Common variables */
    --text-color: #180e3b;
    --background-color: #ffffff;
    --card-background: #ffffff;
    --border-color: #e0e0e0;
    --icon-color: #424242;
    --secondary-text: #666666;
}

/* Dark theme variables */
[data-theme="dark"] {
    --text-color: #e2e2e2;
    --background-color: #121212;
    --card-background: #1e1e1e;
    --border-color: #333333;
    --icon-color: #bbbbbb;
    --secondary-text: #aaaaaa;
    
    --primary-color: #8257df;
    --secondary-color: #614a9e;
    --light-purple: #3d2e70;
    --dark-purple: #c4b0ff;
    --card-bg-1: #2a204d;
    --card-bg-2: #352c2a;
    --card-bg-3: #263323;
    --card-bg-4: #2e2433;
}

/* Apply theme variables */
body {
    background-color: var(--background-color);
    color: var(--text-color);
    height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 100%;
    margin: 0 auto;
    position: relative;
}

header {
    background-color: var(--background-color);
    color: var(--text-color);
    padding: 0.6rem 1rem;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1001;
    border-bottom: 1px solid var(--border-color);
}

.header-left {
    display: flex;
    align-items: center;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

header h1 {
    font-size: 2.2rem;
    font-weight: 700;
}

.app-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--light-purple);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.3s;
}

.app-icon i {
    color: var(--primary-color);
    font-size: 16px;
}

.app-icon:hover {
    background-color: var(--secondary-color);
}

.notification-badge {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background-color: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-badge i {
    color: var(--primary-color);
}

.notification-badge span {
    font-weight: bold;
    margin-left: 0.25rem;
}

.content {
    flex: 1;
    padding: 1rem 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    background-color: var(--background-color);
}

.content h2 {
    margin-bottom: 2rem;
    color: var(--text-color);
    font-size: 1.8rem;
    font-weight: 600;
    text-align: left;
    line-height: 1.4;
}

.content h2 .greeting {
    display: block;
    font-size: 1.4rem;
    color: var(--text-color);
    margin-top: 0.5rem;
    font-weight: 500;
    line-height: 1.5;
}

.content h2 .greeting .username {
    display: inline-block;
    position: relative;
    padding-bottom: 2px;
    line-height: 1.6;
}

.content h2 .greeting .username::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transform-origin: right;
    transform: scaleX(0);
    animation: underlineAnimate 1s ease-in-out forwards;
}

@keyframes underlineAnimate {
    0% {
        transform: scaleX(0);
        transform-origin: right;
    }
    50% {
        transform: scaleX(1);
        transform-origin: right;
    }
    50.1% {
        transform: scaleX(1);
        transform-origin: left;
    }
    100% {
        transform: scaleX(1);
        transform-origin: left;
    }
}

.card {
    background-color: var(--card-bg-4);
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    position: relative;
    display: flex;
    justify-content: space-between;
    transition: transform 0.2s;
    border: 1px solid var(--border-color);
}

.card:nth-child(2) {
    background-color: var(--card-bg-2);
}

.card:nth-child(3) {
    background-color: var(--card-bg-3);
}

.card:nth-child(4) {
    background-color: var(--card-background);
}

.card-left {
    flex: 1;
}

.card-right {
    display: flex;
    align-items: center;
}

.card-tag {
    display: inline-block;
    background-color: var(--background-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 0.3rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.card h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.card-image {
    width: 80px;
    height: 80px;
    margin-left: 1rem;
}

.card-svg {
    width: 80px;
    height: 80px;
    margin-left: 1rem;
    filter: drop-shadow(0px 3px 5px rgba(0, 0, 0, 0.1));
}

.card-profile {
    position: absolute;
    bottom: -10px;
    right: 20px;
    display: flex;
}

.profile-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #d9d9d9;
    border: 2px solid white;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: -10px;
    transition: all 0.3s ease; /* Add transition for smooth color changes */
}

.profile-circle i {
    color: white;
}

.profile-circle.check {
    background-color: var(--success-color);
    width: 20px;
    height: 20px;
    position: absolute;
    bottom: -2px;
    right: -2px;
    margin-left: 0;
    z-index: 1;
}

.profile-circle.check i {
    font-size: 0.6rem;
}

.profile-circle.check i.fa-check {
    color: white;
}

.profile-circle.check i.fa-times {
    color: white;
}

.profile-circle.check.alert {
    background-color: #ff6b6b;
}

.completion-message {
    margin: 2rem 0;
    text-align: center;
}

.completion-message .check-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: black;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem auto;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.completion-message .check-circle img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 8px;
}

.completion-message h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.completion-message p {
    color: var(--secondary-text);
    font-size: 1rem;
    max-width: 80%;
    margin: 0 auto;
}

.activity-timeline {
    position: absolute;
    left: 1.5rem;
    top: 7rem;
    bottom: 6rem;
    width: 3px;
    background-color: var(--border-color);
    z-index: 0;
}

.activity-checkpoint {
    position: absolute;
    left: -10px;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background-color: var(--success-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.activity-checkpoint i {
    color: white;
    font-size: 0.8rem;
}

/* Bottom Navigation */
.bottom-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    background-color: var(--background-color);
    padding: 0.8rem 0;
    position: fixed;
    bottom: 0;
    width: 100%;
    z-index: 1000;
    border-top: 1px solid var(--border-color);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    width: 20%;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.nav-item i {
    font-size: 1.3rem;
    margin-bottom: 0.3rem;
    color: var(--icon-color);
}

.nav-item span {
    font-size: 0.7rem;
    color: var(--icon-color);
}

.nav-item.active i {
    color: var(--primary-color);
}

.nav-item.active span{
color: var(--text-color);
}

.nav-item.active span {
    background-color: var(--secondary-color);
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
}

.cta-button {
    background-color: var(--primary-color);
    color: white;
    width: 100%;
    padding: 1rem;
    text-align: center;
    border-radius: 10px;
    font-weight: 600;
    margin: 1rem 0;
    box-shadow: 0 2px 8px rgba(108, 64, 192, 0.3);
    cursor: pointer;
}

/* App Menu Popup */
.app-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: flex-end;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.app-menu-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.app-menu-popup {
    background: white;
    width: 90%;
    max-width: 500px;
    border-radius: 16px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    padding: 20px;
    transform: translateY(50px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    touch-action: pan-y;
    will-change: transform, opacity;
}

.app-menu-overlay.visible .app-menu-popup {
    transform: translateY(0);
    opacity: 1;
}

.app-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.app-menu-header h3 {
    font-size: 1.3rem;
    color: var(--text-color);
}

.close-button {
    background: none;
    border: none;
    color: #999;
    font-size: 1.2rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.close-button:hover {
    background-color: #f5f5f5;
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    padding-bottom: 20px;
}

.app-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-color);
    transition: transform 0.2s;
}

.app-item:hover {
    transform: scale(1.05);
}

.app-icon-large {
    width: 70px;
    height: 70px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.app-icon-large i {
    font-size: 30px;
    color: white;
}

.app-name {
    font-weight: 600;
    font-size: 0.9rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .content {
        padding: 0.8rem 1.2rem;
        margin-bottom: 70px; /* Space for bottom nav */
    }
    
    .app-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .app-icon-large {
        width: 60px;
        height: 60px;
    }
    
    .card-svg {
        width: 70px;
        height: 70px;
    }
    
    .content h2 {
        font-size: 1.6rem;
    }
    
    .content h2 .greeting {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .nav-item i {
        font-size: 1.2rem;
    }
    
    .nav-item span {
        font-size: 0.7rem;
    }
    
    .bottom-nav {
        padding: 0.25rem 0;
    }
    
    .app-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .app-icon-large {
        width: 50px;
        height: 50px;
    }
    
    .app-icon-large i {
        font-size: 24px;
    }
    
    .card-svg {
        width: 60px;
        height: 60px;
    }

    .profile-popup {
        padding: 0;
    }
    
    .popup-content {
        border-radius: 15px 15px 0 0;
        max-width: 100%;
    }

    .content h2 {
        font-size: 1.4rem;
    }
    
    .content h2 .greeting {
        font-size: 1.1rem;
        line-height: 1.4;
    }
}

/* For very small screens */
@media (max-width: 320px) {
    .nav-item span {
        display: none; /* Hide text on very small screens */
    }
    
    .nav-item i {
        margin-bottom: 0;
    }
    
    .app-menu-popup {
        padding: 1rem;
    }
    
    .app-grid {
        gap: 10px;
    }
    
    .app-icon-large {
        width: 45px;
        height: 45px;
    }
    
    .app-icon-large i {
        font-size: 20px;
    }
    
    .app-name {
        font-size: 0.8rem;
    }
    
    .card-svg {
        width: 50px;
        height: 50px;
    }

    .popup-content {
        padding: 15px;
    }
    
    .popup-image {
        width: 80px;
        height: 80px;
    }
    
    .popup-field input {
        padding: 6px;
    }
    
    .popup-actions button {
        padding: 6px 12px;
    }

    .content h2 .greeting .username {
        max-width: 100px;
    }
}

/* Signup Overlay */
.signup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
}


.signup-form {
    background-color: white;
    width: 100%;
    height: 100%;
    max-width: 100%;
    border-radius: 0;
    padding: 2rem;
    animation: fadeIn 0.5s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
}

.signup-form > * {
    width: 100%;
    max-width: 450px;
}

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

.signup-form h2 {
    color: var(--text-color);
    margin-bottom: 0.5rem;
    text-align: center;
}

.signup-form p {
    color: var(--secondary-text);
    margin-bottom: 1.5rem;
    text-align: center;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.form-group input {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
}

.image-upload-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.image-preview {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background-color: var(--light-purple);
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
    overflow: hidden;
}

.image-preview i {
    font-size: 3rem;
    color: white;
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upload-button {
    background-color: var(--primary-color);
    color: white;
    padding: 0.6rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    font-size: 0.9rem;
}

.upload-button i {
    margin-right: 0.5rem;
}

#saveUserBtn {
    margin-top: 1rem;
    width: 100%;
}

/* Responsive adjustments for signup */
@media (max-width: 480px) {
    .signup-form {
        padding: 1.5rem;
        width: 95%;
    }
    
    .image-preview {
        width: 100px;
        height: 100px;
    }
}

.user-profile .profile-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--light-purple);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px solid white;
}

.user-profile .profile-circle img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* Profile Popup */
.profile-popup {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.5);
}

.popup-content {
    background-color: var(--background-color);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    transform: translateY(100%);
    animation: popupSlideIn 0.3s ease forwards;
    position: relative;
    will-change: transform, opacity;
    transition: transform 0.3s ease, opacity 0.3s ease;
    touch-action: pan-y;
}

/* Settings icon in popup */
.popup-header-actions {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
}

.settings-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--background-color);
    color: var(--primary-color);
    text-decoration: none;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.settings-link i {
    font-size: 1.2rem;
}

.settings-link:hover {
    background-color: var(--primary-color);
    color: white;
    transform: rotate(30deg);
}

@keyframes popupSlideIn {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes popupSlideOut {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(100%);
    }
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .profile-popup {
        padding: 0;
    }
    
    .popup-content {
        border-radius: 15px 15px 0 0;
        max-width: 100%;
    }

    .content h2 .greeting .username {
        max-width: 150px;
    }
}

@media (max-width: 320px) {
    .popup-content {
        padding: 15px;
    }
    
    .popup-image {
        width: 80px;
        height: 80px;
    }
    
    .popup-field input {
        padding: 6px;
    }
    
    .popup-actions button {
        padding: 6px 12px;
    }

    .content h2 .greeting .username {
        max-width: 100px;
    }
}

.popup-image-container {
    position: relative;
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.popup-image {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background-color: var(--light-purple);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.popup-image i {
    font-size: 2.5rem;
    color: white;
}

.popup-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.edit-image-btn {
    position: absolute;
    bottom: 0;
    right: 100px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    font-size: 0.8rem;
}

.popup-info {
    margin-bottom: 20px;
}

.popup-field {
    margin-bottom: 20px;
    position: relative;
}

.popup-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--text-color);
}

.popup-field input {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    transition: border-color 0.3s ease;
    background-color: var(--background-color);
    color: var(--text-color);
}

.popup-field input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.popup-field input:disabled {
    background-color: var(--background-color);
    cursor: not-allowed;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.popup-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.popup-actions button {
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
}

#saveProfileBtn {
    background-color: var(--primary-color);
    color: white;
}

#closeProfileBtn {
    background-color: var(--background-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

@media (min-width: 481px) and (max-width: 768px) {
    .popup-content {
        max-width: 350px;
    }
}

@media (min-width: 769px) {
    .popup-content {
        max-width: 400px;
    }
}

.validation-message {
    font-size: 0.8rem;
    margin-top: 5px;
    transition: all 0.3s ease;
}

/* Theme Toggle Styles */
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
    margin: 0 15px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(30px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Locked email field */
.locked-email-field {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--primary-color);
    border-radius: 5px;
    background-color: var(--background-color);
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s ease;
}

.locked-email-field:hover {
    border-color: var(--primary-color);
    background-color: rgba(108, 64, 192, 0.05);
}

.locked-email-field span {
    flex: 1;
}

.locked-email-field i {
    color: var(--primary-color);
    font-size: 0.9rem;
    opacity: 0.7;
}

/* Email change message */
.email-change-message {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    width: 90%;
    max-width: 400px;
    z-index: 9999;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.email-change-message.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.message-content {
    background-color: var(--card-background);
    border-radius: 12px;
    padding: 0.6rem;
    display: flex;
    align-items: flex-start;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.message-content i.fa-info-circle {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-right: 0.8rem;
    flex-shrink: 0;
}

.message-content p {
    flex: 1;
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-color);
}

.close-message {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 0;
    margin-left: 0.8rem;
    font-size: 1rem;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}

.close-message:hover {
    opacity: 1;
}

.bmi-preview, .bmr-preview, .vo2-preview, .tips-preview {
    margin-top: 10px;
    padding: 6px 12px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    font-size: 0.9rem;
    color: var(--text-color);
    display: inline-block;
    line-height: 1.5;
    transition: all 0.3s ease;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tips-preview {
    border: 1px solid var(--border-color);
    background-color: var(--background-color);
}

.tips-preview .loading-dots {
    display: inline-block;
    min-width: 50px;
    color: var(--secondary-text);
    font-style: italic;
}

@keyframes loading-pulse {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

.tips-preview.loading {
    animation: loading-pulse 1.5s infinite;
}

.bmi-preview strong {
    color: var(--primary-color);
}

.bmr-preview strong {
    color: var(--primary-color);
}

.tips-preview strong {
    color: #1dd1a1;
}

.vo2-preview strong {
    color: var(--primary-color);
}

[data-theme="dark"] .bmi-preview, 
[data-theme="dark"] .bmr-preview, 
[data-theme="dark"] .vo2-preview,
[data-theme="dark"] .tips-preview {
    background-color: rgba(0, 0, 0, 0.3);
    color: rgba(255, 255, 255, 0.7);
}

.bmr-preview {
    background-color: var(--background-color);
}

.vo2-preview {
    background-color: var(--background-color);
}

.tips-preview {
    background-color: var(--background-color);
}

/* Swipe indicator for popups */
.swipe-indicator {
    width: 40px;
    height: 5px;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
    margin: 0 auto 15px;
    display: block;
}

[data-theme="dark"] .swipe-indicator {
    background-color: rgba(255, 255, 255, 0.2);
}

.popup-content {
    will-change: transform, opacity;
    transition: transform 0.3s ease, opacity 0.3s ease;
    touch-action: pan-y;
}

/* Swipe tip notification */
.swipe-tip {
    display: none;
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1001;
    pointer-events: none;
    white-space: nowrap;
}

.swipe-tip.visible {
    opacity: 1;
    animation: fade-out 3s forwards;
}

@keyframes fade-out {
    0% { opacity: 1; }
    70% { opacity: 1; }
    100% { opacity: 0; }
}

[data-theme="dark"] .swipe-tip {
    background-color: rgba(255, 255, 255, 0.8);
    color: #333;
}

.theme-toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    font-size: 1.2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-right: 10px;
    transition: background-color 0.2s ease;
}

.theme-toggle-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .theme-toggle-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .theme-toggle-btn i {
    color: var(--text-color);
}

/* Loading Skeleton */
.loading-skeleton {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--background-color);
    z-index: 9999;
    overflow: hidden;
    transition: opacity 0.3s ease;
}

.skeleton-header {
    height: 60px;
    padding: 0.6rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.skeleton-left, .skeleton-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.skeleton-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(90deg, var(--border-color) 0%, var(--card-background) 50%, var(--border-color) 100%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

.skeleton-line {
    width: 120px;
    height: 24px;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--border-color) 0%, var(--card-background) 50%, var(--border-color) 100%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

.skeleton-content {
    padding: 1rem;
}

.skeleton-title {
    width: 70%;
    height: 32px;
    margin: 0 auto 1.5rem;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--border-color) 0%, var(--card-background) 50%, var(--border-color) 100%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

.skeleton-card {
    height: 170px;
    margin-bottom: 1rem;
    border-radius: 12px;
    background: linear-gradient(90deg, var(--border-color) 0%, var(--card-background) 50%, var(--border-color) 100%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    animation-delay: 0.2s;
}

.skeleton-card:nth-child(3) {
    animation-delay: 0.4s;
}

.skeleton-card:nth-child(4) {
    animation-delay: 0.6s;
}

.skeleton-card:nth-child(5) {
    animation-delay: 0.8s;
}

.skeleton-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 65px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    background-color: var(--background-color);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.skeleton-nav-item {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(90deg, var(--border-color) 0%, var(--card-background) 50%, var(--border-color) 100%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

.skeleton-nav-item:nth-child(2) {
    animation-delay: 0.2s;
}

.skeleton-nav-item:nth-child(3) {
    animation-delay: 0.4s;
}

.skeleton-nav-item:nth-child(4) {
    animation-delay: 0.6s;
}

.skeleton-nav-item:nth-child(5) {
    animation-delay: 0.8s;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

[data-theme="dark"] .skeleton-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .skeleton-nav {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.connection-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--card-background);
    border-radius: 12px;
    padding: 1.2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    text-align: center;
    width: 80%;
    max-width: 300px;
    border: 1px solid var(--border-color);
    z-index: 10000;
}

.connection-message i {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    display: block;
    animation: pulse 2s infinite;
}

.connection-message p {
    color: var(--text-color);
    font-size: 1rem;
    margin: 0;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}