/* CSS Variables */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a24;
    --bg-card-hover: #22222e;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #606070;
    --accent-blue: #3b82f6;
    --accent-green: #22c55e;
    --accent-yellow: #eab308;
    --accent-red: #ef4444;
    --accent-purple: #a855f7;
    --border-color: #2a2a3a;
    --success: #22c55e;
    --gradient-blue: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    --gradient-green: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    --gradient-yellow: linear-gradient(135deg, #eab308 0%, #ca8a04 100%);
    --gradient-red: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    --radius: 16px;
    --radius-sm: 10px;
}

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

html {
    font-size: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
}

/* App Container */
.app {
    max-width: 500px;
    margin: 0 auto;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: 0 16px;
    padding-bottom: calc(env(safe-area-inset-bottom) + 100px);
}

/* Header */
.header {
    padding: 24px 0 16px;
    text-align: center;
    position: sticky;
    top: 0;
    background: var(--bg-primary);
    z-index: 10;
}

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

.date-display {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.history-btn {
    background: var(--bg-card);
    border: none;
    color: var(--text-secondary);
    padding: 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.history-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.phase-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.phase-badge.phase-1 {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.phase-badge.phase-2 {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.phase-badge.phase-3 {
    background: rgba(234, 179, 8, 0.15);
    color: var(--accent-yellow);
    border: 1px solid rgba(234, 179, 8, 0.3);
}

.phase-badge.phase-4 {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.day-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 8px 0;
}

/* Rest Day */
.rest-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    text-align: center;
    padding: 40px 20px;
}

.rest-icon {
    font-size: 80px;
    margin-bottom: 24px;
}

.rest-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.rest-message {
    font-size: 1rem;
    color: var(--text-secondary);
    max-width: 280px;
    line-height: 1.6;
}

/* Workout Section */
.workout-section {
    margin-bottom: 24px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding: 0 4px;
}

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

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Exercise Card */
.exercise-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    margin-bottom: 10px;
    overflow: hidden;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.exercise-card:active {
    transform: scale(0.98);
}

.exercise-card.completed {
    background: rgba(34, 197, 94, 0.08);
    border-color: rgba(34, 197, 94, 0.2);
}

.exercise-card.completed .exercise-name {
    color: var(--text-secondary);
}

.exercise-card.completed .exercise-checkbox {
    background: var(--success);
    border-color: var(--success);
}

.exercise-card.completed .exercise-checkbox svg {
    opacity: 1;
}

.exercise-inner {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
    cursor: pointer;
}

.exercise-checkbox {
    width: 26px;
    height: 26px;
    min-width: 26px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-top: 2px;
}

.exercise-checkbox svg {
    width: 14px;
    height: 14px;
    stroke: white;
    stroke-width: 3;
    opacity: 0;
    transition: opacity 0.2s;
}

.exercise-content {
    flex: 1;
}

.exercise-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    transition: color 0.2s;
}

.exercise-details {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.exercise-tip {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    line-height: 1.4;
}

/* Running Section */
.running-info {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 10px;
}

.running-info h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.running-info p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Simulado Section */
.simulado-card {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.simulado-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    border-bottom: 1px solid rgba(239, 68, 68, 0.15);
}

.simulado-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-red);
}

/* Progress Container */
.progress-container {
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom) + 80px);
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 468px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-secondary);
    padding: 12px 16px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.progress-container.visible {
    opacity: 1;
    visibility: visible;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-card);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-green);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 45px;
    text-align: right;
}

/* Complete Button */
.complete-btn {
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom) + 16px);
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 468px;
    padding: 18px;
    background: var(--bg-card);
    color: var(--text-muted);
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: not-allowed;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    z-index: 100;
}

.complete-btn:not(:disabled) {
    background: var(--gradient-green);
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.4);
}

.complete-btn:not(:disabled):active {
    transform: translateX(-50%) scale(0.98);
}

.complete-btn .check-icon {
    display: none;
}

.complete-btn:not(:disabled) .check-icon {
    display: block;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal.open {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-secondary);
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    border-radius: var(--radius) var(--radius) 0 0;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.modal.open .modal-content {
    transform: translateY(0);
}

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

.modal-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* History Item */
.history-item {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 12px;
}

.history-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.history-workout {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.history-phase {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.history-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
}

/* Celebration */
.celebration {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.celebration.show {
    opacity: 1;
    visibility: visible;
}

.celebration-content {
    text-align: center;
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.celebration.show .celebration-content {
    transform: scale(1);
}

.celebration-icon {
    font-size: 80px;
    margin-bottom: 24px;
    animation: bounce 0.6s ease infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.celebration h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.celebration p {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* Notes Section */
.notes-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.notes-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.note-card {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-bottom: 10px;
}

.note-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

/* Hide progress and button on rest days */
.rest-day-mode .progress-container,
.rest-day-mode .complete-btn {
    display: none;
}

/* Week indicator */
.week-indicator {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 8px;
}
