/* ========================================
   GymTracker - Main Stylesheet
   ======================================== */

/* === CSS Variables (Dark theme - default) === */
:root {
    --bg-primary: #0f0f14;
    --bg-secondary: #1a1a24;
    --bg-card: #22222e;
    --bg-elevated: #2a2a38;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #606070;
    --accent-primary: #7c3aed;
    --accent-secondary: #a855f7;
    --accent-gradient: linear-gradient(135deg, #7c3aed 0%, #a855f7 50%, #ec4899 100%);
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --border-color: #333344;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    /* Chart colors (used by JS) */
    --chart-grid: #333344;
    --chart-text: #a0a0b0;
}

/* === Light Theme === */
html.theme-light {
    --bg-primary: #f4f4f8;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-elevated: #eaeaf0;
    --text-primary: #1a1a2e;
    --text-secondary: #6b6b80;
    --text-muted: #9999aa;
    --accent-primary: #7c3aed;
    --accent-secondary: #a855f7;
    --accent-gradient: linear-gradient(135deg, #7c3aed 0%, #a855f7 50%, #ec4899 100%);
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --border-color: #d8d8e4;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.1);
    --chart-grid: #d8d8e4;
    --chart-text: #6b6b80;
}

html.theme-light body {
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(124, 58, 237, 0.06), transparent),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(236, 72, 153, 0.04), transparent),
        var(--bg-primary);
}

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

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

body {
    background: 
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(124, 58, 237, 0.15), transparent),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(236, 72, 153, 0.1), transparent),
        var(--bg-primary);
}

/* === Layout === */
.app-container {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px;
    padding-bottom: 100px;
}

/* === Header === */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0 24px;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    width: 44px;
    height: 44px;
    background: var(--accent-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: var(--shadow-md);
}

.header-text h1 {
    font-size: 20px;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-text p {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 2px solid var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

/* === Navigation Tabs === */
.nav-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: var(--bg-secondary);
    padding: 6px;
    border-radius: var(--radius-lg);
}

.nav-tab {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-tab.active {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--shadow-sm);
}

.nav-tab:not(.active):hover {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

/* === Tab Content === */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

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

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

/* === Section Header === */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-badge {
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-card);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

/* === Workout Cards === */
.workout-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.workout-card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md);
}

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

.exercise-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.exercise-info > div {
    min-width: 0;
    overflow: hidden;
}

.exercise-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.exercise-name {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
}

.exercise-category {
    font-size: 12px;
    color: var(--text-secondary);
}

/* === Card Actions === */
.card-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.delete-btn, .confirm-btn, .edit-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 16px;
}

.delete-btn {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

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

.confirm-btn {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.confirm-btn:hover {
    background: var(--success);
    color: white;
}

.edit-btn {
    background: rgba(124, 58, 237, 0.1);
    color: var(--accent-primary);
}

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

/* === Sets === */
.sets-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.set-row {
    display: flex;
    gap: 6px;
    align-items: center;
    width: 100%;
}

.set-number {
    width: 28px;
    min-width: 28px;
    height: 28px;
    background: var(--bg-elevated);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
}

.set-number.warmup {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.set-number.failure {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.set-input {
    flex: 1;
    min-width: 0;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    transition: all 0.2s ease;
}

.set-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--bg-card);
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.2);
}

.set-input::placeholder {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 13px;
}

.set-delete {
    width: 28px;
    min-width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 16px;
}

.set-delete:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* Copy from previous set button */
.copy-prev-btn {
    width: 100%;
    padding: 5px 0;
    margin: 2px 0 4px 0;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.copy-prev-btn:active {
    background: rgba(124, 58, 237, 0.08);
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

/* === Buttons === */
.repeat-last-btn {
    width: 100%;
    padding: 6px 10px;
    margin-bottom: 6px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.repeat-last-btn:hover {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border-color: var(--text-muted);
}

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

.add-set-btn {
    width: 100%;
    padding: 10px;
    margin-top: 8px;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.add-set-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(124, 58, 237, 0.05);
}

.save-exercise-btn {
    width: 100%;
    padding: 14px;
    margin-top: 12px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--success);
    color: white;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.save-exercise-btn:active {
    transform: scale(0.97);
    opacity: 0.9;
}

.add-exercise-btn {
    width: 100%;
    padding: 20px;
    border: none;
    border-radius: var(--radius-lg);
    background: var(--accent-gradient);
    color: white;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    margin-top: 16px;
}

.add-exercise-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.add-exercise-btn:active {
    transform: translateY(0);
}

.add-exercise-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* === Categories Grid === */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.category-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.category-card.selected {
    border-color: var(--accent-primary);
    background: rgba(124, 58, 237, 0.1);
}

.category-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.category-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* === Exercise List === */
.exercise-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.exercise-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: all 0.2s ease;
}

.exercise-item:hover {
    border-color: var(--accent-primary);
    background: rgba(124, 58, 237, 0.05);
}

.exercise-item-name {
    font-weight: 600;
    font-size: 14px;
}

.exercise-type-badge {
    display: inline-block;
    font-size: 10px;
    color: var(--text-muted);
    background: var(--bg-elevated);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    font-weight: 500;
}

.exercise-item-info {
    flex: 1;
    min-width: 0;
    cursor: pointer;
}

.exercise-item-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.exercise-item-add {
    width: 28px;
    min-width: 28px;
    height: 28px;
    min-height: 28px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    flex-shrink: 0;
    cursor: pointer;
}

.favorite-toggle {
    font-size: 20px;
    cursor: pointer;
    opacity: 0.4;
    transition: opacity 0.2s, transform 0.2s;
    user-select: none;
    line-height: 1;
}

.favorite-toggle.active {
    opacity: 1;
}

.favorite-toggle:active {
    transform: scale(1.3);
}

.exercise-section-header {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 12px 0 6px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.exercise-section-header:first-child {
    padding-top: 4px;
}

.exercise-section-hint {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    padding: 20px 16px;
    line-height: 1.5;
}

/* === Progress Section === */
.progress-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
}

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

.progress-title {
    font-size: 16px;
    font-weight: 700;
}

.progress-select {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 32px 8px 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23a0a0b0' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.progress-select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.chart-container {
    height: 200px;
    margin-top: 16px;
}

/* === Stats Grid === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 16px;
    border: 1px solid var(--border-color);
}

.stat-value {
    font-size: 24px;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* === History Section === */
.history-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.history-control-btn {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.history-control-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.history-item {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: all 0.2s ease;
}

.history-item:hover {
    border-color: var(--accent-primary);
}

.history-header {
    padding: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.history-date {
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-summary {
    font-size: 12px;
    color: var(--text-secondary);
}

.history-toggle {
    color: var(--text-muted);
    transition: transform 0.3s ease;
    font-size: 18px;
}

.history-item.expanded .history-toggle {
    transform: rotate(180deg);
}

.history-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.history-item.expanded .history-details {
    max-height: 2000px;
}

.history-exercise {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
}

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

.history-exercise-name {
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}

.history-exercise-category {
    font-size: 11px;
    color: var(--text-muted);
    padding: 2px 6px;
    background: var(--bg-elevated);
    border-radius: 4px;
}

.history-exercise-category.exercise-type-label {
    background: var(--accent-primary);
    color: #ffffff;
    margin-left: 4px;
}

.history-exercise-actions {
    display: flex;
    gap: 6px;
}

.history-action-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
}

.history-action-btn.edit {
    background: rgba(124, 58, 237, 0.1);
    color: var(--accent-primary);
}

.history-action-btn.edit:hover {
    background: var(--accent-primary);
    color: white;
}

.history-action-btn.delete {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.history-action-btn.delete:hover {
    background: var(--danger);
    color: white;
}

.history-sets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.history-set {
    background: var(--bg-elevated);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* === Modal === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    align-items: flex-end;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 24px;
    animation: slideUp 0.3s ease;
}

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

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

.modal-title {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.modal-back {
    width: 36px;
    min-width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    transition: background 0.2s, color 0.2s;
}

.modal-back svg {
    display: block;
}

.modal-back:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.edit-modal-content {
    padding-bottom: 80px;
}

.modal-save-btn {
    position: absolute;
    bottom: 24px;
    left: 24px;
    right: 24px;
    padding: 16px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--accent-gradient);
    color: white;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-save-btn:hover {
    opacity: 0.9;
}

/* === Search === */
.search-input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    margin-bottom: 16px;
    transition: all 0.2s ease;
}

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

.search-input::placeholder {
    color: var(--text-muted);
}

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 40px 20px;
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
}

.empty-state-text {
    color: var(--text-secondary);
    font-size: 14px;
}

/* === Loading === */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-elevated);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* === Toast === */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-elevated);
    color: var(--text-primary);
    padding: 14px 24px;
    border-radius: var(--radius-lg);
    font-size: 14px;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

/* === Confirm Dialog === */
.confirm-dialog {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.confirm-dialog.active {
    display: flex;
}

.confirm-dialog-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 24px;
    max-width: 320px;
    width: 90%;
    text-align: center;
}

.confirm-dialog-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
}

.confirm-dialog-text {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
}

.confirm-dialog-buttons {
    display: flex;
    gap: 12px;
}

.confirm-dialog-btn {
    flex: 1;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.confirm-dialog-btn.cancel {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

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

.confirm-dialog-btn:hover {
    opacity: 0.9;
}

/* === Profile Modal === */
.profile-user-info {
    text-align: center;
    margin-bottom: 20px;
}

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    color: white;
    margin: 0 auto 12px;
}

.profile-name {
    font-size: 18px;
    font-weight: 700;
}

.profile-username {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.profile-subscription-status {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin-bottom: 20px;
}

.profile-subscription-status.status-active {
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.08);
}

.profile-subscription-status.status-trial {
    border-color: var(--accent-primary);
    background: rgba(124, 58, 237, 0.08);
}

.profile-subscription-status.status-grace {
    border-color: var(--warning);
    background: rgba(245, 158, 11, 0.08);
}

.profile-subscription-status.status-expired {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.08);
}

.profile-status-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 500;
}

.profile-status-value {
    font-size: 15px;
    font-weight: 700;
}

.profile-plans-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 12px;
}

.profile-plans {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.profile-plan-card {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.profile-plan-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.plan-badge {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent-gradient);
    color: white;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.plan-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.plan-price {
    font-size: 20px;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}

.plan-per-month {
    font-size: 11px;
    color: var(--text-muted);
}

.profile-note {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

/* === Subscription Badge on Avatar === */
.user-avatar {
    position: relative;
}

.subscription-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 800;
    border: 2px solid var(--bg-primary);
}

.subscription-badge.trial {
    background: var(--accent-primary);
    color: white;
}

.subscription-badge.expired {
    background: var(--danger);
    color: white;
}

/* === Paywall === */
.paywall-container {
    text-align: center;
    padding: 40px 20px;
}

.paywall-chart-placeholder {
    max-width: 300px;
    margin: 0 auto 24px;
    opacity: 0.8;
}

.paywall-chart-svg {
    width: 100%;
    height: auto;
}

.paywall-title {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 8px;
}

.paywall-text {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.paywall-btn {
    padding: 14px 32px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--accent-gradient);
    color: white;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
}

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

/* === Paywall Banner (History) === */
.paywall-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 16px;
}

.paywall-banner-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.paywall-banner-text {
    flex: 1;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.paywall-banner-btn {
    flex-shrink: 0;
    padding: 8px 14px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--accent-gradient);
    color: white;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.paywall-banner-btn:hover {
    opacity: 0.9;
}

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* === Adjustment buttons panel === */
.adjustment-row {
    display: flex;
    gap: 6px;
    align-items: center;
    width: 100%;
    margin-top: 6px;
    padding: 0;
}
.adjustment-spacer {
    width: 28px;
    min-width: 28px;
    flex-shrink: 0;
}
.adjustment-cell {
    flex: 1;
    min-width: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}
.adjustment-cell .adjustment-buttons {
    display: flex;
    gap: 4px;
    justify-content: center;
    flex-wrap: nowrap;
    max-width: 100%;
}
.adj-btn {
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: 11px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    flex-shrink: 0;
}
.adj-btn:active {
    transform: scale(0.93);
}
.adj-btn-minus:hover,
.adj-btn-minus:active {
    border-color: rgba(239, 68, 68, 0.5);
    color: var(--danger);
    background: rgba(239, 68, 68, 0.06);
}
.adj-btn-plus:hover,
.adj-btn-plus:active {
    border-color: rgba(124, 58, 237, 0.5);
    color: var(--accent-primary);
    background: rgba(124, 58, 237, 0.06);
}

/* === Rest Timer === */
.rest-timer {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
    padding: 10px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.rest-timer-close {
    width: 22px;
    height: 22px;
    min-width: 22px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    transition: all 0.15s ease;
}

.rest-timer-close:active {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border-color: var(--danger);
}

.rest-timer-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

.rest-timer-time {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent-primary);
    font-variant-numeric: tabular-nums;
    min-width: 50px;
    text-align: center;
}

.rest-timer-adjust {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-left: auto;
}

.rest-timer-adj-btn {
    padding: 3px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 11px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    line-height: 1.2;
}

.rest-timer-adj-btn:active {
    transform: scale(0.93);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.rest-timer-done .rest-timer-time {
    font-size: 13px;
    color: var(--success);
    font-weight: 600;
}

.rest-timer-done .rest-timer-label {
    display: none;
}

/* === Reminder Settings === */
.profile-reminders {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.profile-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.reminder-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.reminder-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

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

.toggle-slider {
    position: absolute;
    inset: 0;
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    cursor: pointer;
    transition: 0.2s;
}

.toggle-slider:before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: var(--text-muted);
    border-radius: 50%;
    transition: 0.2s;
}

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

.toggle-switch input:checked + .toggle-slider:before {
    background-color: white;
    transform: translateX(20px);
}

.reminder-interval-row {
    margin-top: 8px;
}

.reminder-interval-row .reminder-label {
    display: block;
    margin-bottom: 8px;
}

.reminder-interval-btns {
    display: flex;
    gap: 8px;
}

.reminder-day-btn {
    flex: 1;
    padding: 8px 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

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

.reminder-day-btn:not(.active):active {
    background: var(--bg-elevated);
}

/* === Danger Zone (Profile) === */
.profile-danger-zone {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.danger-btn {
    width: 100%;
    padding: 10px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--danger);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.danger-btn:active {
    background: rgba(239, 68, 68, 0.1);
}

/* Delete Data Dialog */
.delete-data-dialog {
    text-align: center;
    padding: 12px 0;
}

.delete-data-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.delete-data-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--danger);
    margin-bottom: 8px;
}

.delete-data-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
}

.delete-data-confirm {
    margin-bottom: 16px;
}

.delete-data-confirm label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.delete-data-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    text-align: center;
    font-weight: 600;
    letter-spacing: 2px;
    box-sizing: border-box;
}

.delete-data-input:focus {
    outline: none;
    border-color: var(--danger);
}

.delete-data-actions {
    display: flex;
    gap: 8px;
}

.cancel-btn {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.confirm-delete-btn {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--danger);
    border-radius: var(--radius-md);
    background: var(--danger);
    color: white;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.confirm-delete-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.confirm-delete-btn:not(:disabled):active {
    transform: scale(0.97);
}

/* === Onboarding === */
.onboarding-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    overflow: hidden;
    -webkit-user-select: none;
    user-select: none;
}

.onboarding-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.onboarding-skip {
    position: absolute;
    top: 12px;
    right: 16px;
    z-index: 2;
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 4px;
    transition: opacity 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.onboarding-track {
    flex: 1;
    display: flex;
    min-height: 0;
    will-change: transform;
}

.onboarding-slide {
    flex: 0 0 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    padding: 44px 24px 0;
    box-sizing: border-box;
    min-height: 0;
}

.onboarding-image-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    overflow: hidden;
    margin-bottom: 20px;
}

.onboarding-image {
    max-width: 85%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    pointer-events: none;
}

.onboarding-text {
    text-align: center;
    padding-bottom: 8px;
    flex-shrink: 0;
}

.onboarding-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.3;
}

.onboarding-subtitle {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1.5;
    max-width: 320px;
    margin: 0 auto;
}

.onboarding-footer {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 16px 24px 32px;
}

.onboarding-dots {
    display: flex;
    gap: 8px;
}

.onboarding-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.onboarding-dot.active {
    background: var(--accent-primary);
    width: 24px;
    border-radius: 4px;
}

.onboarding-next {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: var(--radius-lg);
    background: var(--accent-gradient);
    color: white;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.onboarding-next:active {
    transform: scale(0.97);
}
