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

:root {
    --primary-color: #4CAF50;
    --primary-dark: #388E3C;
    --secondary-color: #2196F3;
    --danger-color: #F44336;
    --warning-color: #FF9800;
    --success-color: #4CAF50;
    --bg-color: #f5f5f5;
    --bg-card: #ffffff;
    --text-primary: #212121;
    --text-secondary: #666666;
    --border-color: #eeeeee;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
}

[data-theme="dark"] {
    --bg-color: #121212;
    --bg-card: #1e1e1e;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --border-color: #333333;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    transition: background-color 0.3s, color 0.3s;
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* HEADER */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 1rem;
    box-shadow: var(--shadow-lg);
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 100%;
}

.logo {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(255,255,255,0.2);
    padding: 4px;
}

.header h1 {
    flex: 1;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.menu-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

/* SIDEBAR */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    background: var(--bg-card);
    box-shadow: 2px 0 8px rgba(0,0,0,0.1);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 200;
    overflow-y: auto;
    padding-top: 1rem;
}

.sidebar.active {
    transform: translateX(0);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
    font-size: 1.3rem;
}

.close-menu {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-primary);
}

.menu-list {
    list-style: none;
    padding: 1rem 0;
}

.menu-list li {
    margin: 0;
}

.menu-link {
    display: block;
    padding: 1rem 1.5rem;
    color: var(--text-primary);
    text-decoration: none;
    border-left: 4px solid transparent;
    transition: all 0.2s;
}

.menu-link:hover {
    background: var(--bg-color);
    border-left-color: var(--primary-color);
    color: var(--primary-color);
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    padding-bottom: 80px;
}

.page {
    display: none;
    animation: fadeIn 0.3s;
}

.page.active {
    display: block;
}

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

/* HOME PAGE */
.home-hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 2rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    text-align: center;
}

.home-hero h2 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.home-hero p {
    font-size: 1rem;
    opacity: 0.95;
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: var(--shadow);
    border-top: 4px solid var(--primary-color);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    display: block;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.action-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    font-size: 2.5rem;
}

.action-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.action-btn span {
    font-size: 1.8rem;
}

.info-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary-color);
}

.info-card h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.info-card ul {
    list-style: none;
}

.info-card li {
    padding: 0.5rem 0;
    color: var(--text-secondary);
}

/* EXERCISES PAGE */
.filter-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.filter-btn {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    color: var(--text-primary);
    font-weight: 500;
}

.filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

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

.exercises-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.exercise-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: var(--shadow);
    border: 2px solid transparent;
}

.exercise-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.exercise-card .emoji {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    display: block;
}

.exercise-card h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.exercise-card .category {
    font-size: 0.75rem;
    background: var(--bg-color);
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 0.5rem;
}

.exercise-card .level {
    font-size: 0.85rem;
    color: var(--primary-color);
    font-weight: 600;
}

/* MODAL */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 300;
    overflow-y: auto;
    padding: 1rem;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-primary);
}

#exerciseDetails h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

#exerciseDetails .detail-section {
    margin-bottom: 1.5rem;
}

#exerciseDetails .detail-section h3 {
    font-size: 1rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

#exerciseDetails .detail-section ol,
#exerciseDetails .detail-section ul {
    margin-left: 1.5rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

#exerciseDetails .detail-section li {
    margin-bottom: 0.5rem;
}

#exerciseDetails .intensity {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--bg-color);
    border-radius: 8px;
    font-weight: 600;
    margin: 0.5rem 0;
}

.modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 2rem;
}

/* BUTTONS */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    font-size: 1rem;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #1976D2;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #D32F2F;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

/* PROGRESS PAGE */
.progress-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.progress-tab {
    background: none;
    border: none;
    padding: 1rem;
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 600;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.progress-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.chart-container {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.progress-details {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.stat-item {
    background: var(--bg-color);
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}

.stat-title {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.stat-number {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.progress-list {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.workout-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.workout-info {
    flex: 1;
}

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

.workout-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.workout-time {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* GOALS PAGE */
.goals-section {
    margin-bottom: 2rem;
}

.goal-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.goal-header {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.goal-header h4 {
    flex: 1;
    min-width: 150px;
}

.goal-input {
    width: 120px;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-color);
    color: var(--text-primary);
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: var(--bg-color);
    border-radius: 10px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: width 0.5s ease;
}

.preset-goals {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.preset-goals h3 {
    margin-bottom: 1rem;
}

.preset-btn {
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    padding: 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    margin-bottom: 1rem;
    transition: all 0.3s;
    color: var(--text-primary);
}

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

.preset-btn strong {
    display: block;
    margin-bottom: 0.5rem;
}

/* HELP PAGE */
.faq-container {
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.faq-item {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

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

.faq-item h3 {
    cursor: pointer;
    user-select: none;
    padding-bottom: 0.5rem;
    color: var(--primary-color);
    font-weight: 600;
    transition: all 0.3s;
}

.faq-item h3:hover {
    transform: translateX(4px);
}

.faq-item p {
    display: none;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-top: 0.5rem;
}

.faq-item.open p {
    display: block;
}

.health-tips {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.health-tips ul {
    list-style: none;
    margin-top: 1rem;
}

.health-tips li {
    padding: 0.75rem 0;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    padding-left: 1.5rem;
    position: relative;
}

.health-tips li:before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: 700;
}

/* PROFILE PAGE */
.profile-card {
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.profile-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.profile-avatar {
    font-size: 3rem;
    width: 80px;
    height: 80px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-info h3 {
    font-size: 1.3rem;
    margin-bottom: 0.25rem;
}

.profile-info p {
    opacity: 0.9;
    font-size: 0.9rem;
}

.profile-form {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

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

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-color);
    color: var(--text-primary);
    font-size: 1rem;
}

.checkbox-group {
    display: grid;
    gap: 0.5rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 400;
    cursor: pointer;
}

.checkbox-group input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.profile-stats {
    padding: 1.5rem;
}

.stats-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1rem;
}

.stats-2col > div {
    text-align: center;
    background: var(--bg-color);
    padding: 1rem;
    border-radius: 8px;
}

.stats-2col p:first-child {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.big-number {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color) !important;
}

/* SETTINGS PAGE */
.settings-group {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.settings-group h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.setting-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

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

.setting-item label {
    flex: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.setting-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.time-input {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-color);
    color: var(--text-primary);
}

.setting-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.setting-buttons .btn {
    width: 100%;
}

/* BOTTOM NAVIGATION */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
    border-top: 1px solid var(--border-color);
    z-index: 150;
}

.nav-btn {
    background: none;
    border: none;
    padding: 0.75rem 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.8rem;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    border-top: 3px solid transparent;
}

.nav-btn.active {
    color: var(--primary-color);
    border-top-color: var(--primary-color);
}

/* RESPONSIVE */
@media (min-width: 768px) {
    .exercises-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }

    .stats-2col {
        grid-template-columns: repeat(4, 1fr);
    }

    .setting-buttons {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

/* ANIMATIONS */
@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

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

.loading {
    animation: pulse 1.5s infinite;
}
