:root {
    --primary: #aed805;
    /* Lima AcompañaFit */
    --primary-dark: #9bc204;
    --bg-dark: #121212;
    --card-bg: #1e1e1e;
    --text-main: #ffffff;
    --text-muted: #a0a0a0;
    --border: #2c2c2c;
    --success: #aed805;
    --radius-lg: 16px;
    --radius-md: 12px;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.5;
    overflow-x: hidden;
    padding-bottom: 80px;
    /* Space for bottom nav */
}

/* single page app style tabs */
.page-tab {
    display: none;
    animation: fadeIn 0.3s ease;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.container {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 12px 0;
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.7rem;
    gap: 4px;
    transition: var(--transition);
    cursor: pointer;
}

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

.nav-item i {
    font-size: 1.2rem;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.user-welcome h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.user-welcome span {
    color: var(--primary);
}

/* Progress Bar Card */
.progress-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--radius-lg);
    margin-bottom: 25px;
    box-shadow: var(--shadow);
}

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

.progress-header span {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
}

.progress-header .percentage {
    color: var(--primary);
    font-size: 1.2rem;
}

.progress-bar-bg {
    height: 8px;
    background: #333;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.5s ease;
}

/* Exercise Cards */
.section-title {
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.exercise-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.exercise-card.completed {
    border-color: var(--primary);
    background: rgba(174, 216, 5, 0.05);
}

.exercise-info h4 {
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.exercise-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.check-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #444;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.exercise-card.completed .check-btn {
    background: var(--primary);
    border-color: var(--primary);
    color: #000;
}

/* Global Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-family: inherit;
    font-size: 0.95rem;
    gap: 8px;
    width: 100%;
}

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

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: #2c2c2e;
    color: white;
    border: 1px solid var(--border);
}

.btn-secondary:active {
    background: #3a3a3c;
}

/* Chat Tab Overrides */
.chat-tab-container {
    height: calc(100vh - 150px);
    display: flex;
    flex-direction: column;
}

/* For modern mobile viewports */
@supports (height: 100svh) {
    .chat-tab-container {
        height: calc(100svh - 150px);
    }
}

.chat-box {
    flex: 1;
    overflow-y: auto;
    padding: 5px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.msg.ai {
    background: #2c2c2e;
    color: white;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.msg.user {
    background: var(--primary);
    color: #000;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-input-row {
    background: var(--card-bg);
    padding: 8px 12px;
    border-radius: 25px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 5px;
}

.chat-input-row input {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    outline: none;
    padding: 8px 5px;
    font-size: 16px;
    /* Crucial to prevent iOS auto-zoom */
}

/* Auth Pages */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-color: var(--bg-dark);
}

.auth-card {
    background: var(--card-bg);
    width: 100%;
    max-width: 400px;
    padding: 40px 30px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.auth-footer {
    text-align: center;
    margin-top: 25px;
    font-size: 0.9rem;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
}

.form-input {
    width: 100%;
    background: #2c2c2e;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
    outline: none;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(174, 216, 5, 0.1);
}

/* Profile List */
.profile-menu {
    list-style: none;
}

.profile-menu-item {
    background: var(--card-bg);
    padding: 18px;
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.profile-menu-item i:first-child {
    margin-right: 15px;
    color: var(--primary);
}

/* Calendar Styles */
.calendar-container {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: var(--shadow);
}

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

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    text-align: center;
}

.calendar-day-head {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    padding-bottom: 10px;
}

.calendar-day {
    aspect-ratio: 1/1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.calendar-day:hover {
    background: rgba(255, 255, 255, 0.1);
}

.calendar-day.active {
    background: var(--primary);
    color: #000;
    font-weight: 700;
}

.calendar-day.today {
    border-color: var(--primary);
}

.calendar-day.empty {
    cursor: default;
}

.calendar-day.empty:hover {
    background: transparent;
}

/* Modal Simple para marcar manual */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.modal-content {
    background: var(--card-bg);
    padding: 25px;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 350px;
}
/* Premium Stat Widgets */
.stats-grid-visual {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 25px;
}

.stat-widget {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
}

.stat-widget.wide {
    grid-column: span 2;
}

.stat-widget h4 {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.stat-widget .value {
    font-size: 1.8rem;
    font-weight: 700;
}

.stat-widget .sub-value {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.progress-ring__circle {
    transition: stroke-dashoffset 0.35s;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
}

.chart-container {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    height: 100px;
    padding-top: 10px;
    gap: 5px;
}

.chart-bar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.chart-bar {
    width: 100%;
    max-width: 12px;
    background: #333;
    border-radius: 6px;
    height: 0%;
    transition: height 0.5s ease-out;
}

.chart-bar.active {
    background: var(--primary);
}

.chart-day {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 600;
}
