/* dashboard.css — WOW redesign v5.1 (UX visionary pass) */

/* =============== DASHBOARD SCREEN =============== */
#dashboard {
    background: var(--bg-dashboard) !important;
}

#dashboard .main-content {
    padding: 0 20px 100px;
    overflow-y: auto;
    scrollbar-width: none;
}
#dashboard .main-content::-webkit-scrollbar {
    display: none;
}

/* =============== HERO HEADER =============== */
.dashboard-hero {
    background: var(--gradient-primary);
    color: white;
    padding: 10px 20px 10px;
    flex-shrink: 0;
}

.hero-top-row {
    display: none;
}

.hero-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hero-date {
    font-size: 11px;
    opacity: 0.75;
    font-weight: 400;
    white-space: nowrap;
}

.hero-center {
    flex: 1;
    text-align: center;
}

.hero-greeting {
    font-size: 15px;
    font-weight: 600;
}

.hero-subtitle {
    font-size: 11px;
    opacity: 0.7;
    font-weight: 400;
    margin-top: 1px;
}

.hero-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.22);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.15s;
}

.hero-avatar:active {
    transform: scale(0.9);
}

/* =============== PROGRESS RING SECTION (secondary focus) =============== */
.progress-section {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 20px;
    margin: 16px 0 12px;
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.progress-ring-wrapper {
    display: flex;
    align-items: center;
    gap: 20px;
}

.progress-ring-container {
    position: relative;
    width: 96px;
    height: 96px;
    flex-shrink: 0;
}

.progress-ring-svg {
    transform: rotate(-90deg);
    width: 96px;
    height: 96px;
}

.progress-ring-bg {
    fill: none;
    stroke: var(--border);
    stroke-width: 6;
}

.progress-ring-fill {
    fill: none;
    stroke: var(--primary);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 263.89;
    stroke-dashoffset: 263.89;
    transition: stroke-dashoffset 1.2s cubic-bezier(0.65, 0, 0.35, 1);
}

.progress-ring-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.progress-ring-count {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.progress-ring-label {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.progress-info {
    flex: 1;
    min-width: 0;
}

.progress-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

/* Переключатель недель на дашборде */
.dash-week-switcher {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 6px;
}

.dash-week-arrow {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    padding: 0;
}

.dash-week-arrow:active {
    transform: scale(0.93);
    background: var(--primary-very-light);
    color: var(--primary);
    border-color: var(--primary);
}

.dash-week-arrow:disabled {
    opacity: 0.3;
    pointer-events: none;
}

.dash-week-center {
    text-align: center;
    min-width: 140px;
}

.dash-week-label {
    font-size: 15px;
    font-weight: 700;
    color: var(--dark);
}

.dash-week-motto {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 1px;
}

.dash-week-dots {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-bottom: 8px;
}

.dash-week-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border);
    transition: var(--transition-fast);
}

.dash-week-dot.active {
    background: var(--primary);
    width: 16px;
    border-radius: 3px;
}

.dash-week-dot.current {
    background: var(--primary-very-light);
    border: 1px solid var(--primary);
}

[data-theme="dark"] .dash-week-arrow {
    border-color: var(--border);
    background: var(--surface-secondary);
}

.progress-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

/* Week dots */
.week-dots {
    display: flex;
    gap: 6px;
}

.week-dot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.week-dot-label {
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 500;
}

.week-dot-circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--surface-secondary);
    border: 2px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.week-dot-circle.completed {
    background: var(--primary);
    border-color: var(--primary);
}
.week-dot-circle.completed::after {
    content: '';
    width: 8px;
    height: 5px;
    border-left: 2px solid white;
    border-bottom: 2px solid white;
    transform: rotate(-45deg) translateY(-1px);
}

.week-dot-circle.scheduled {
    border-color: var(--primary);
    background: var(--primary-very-light);
}

.week-dot-circle.today {
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.25);
}

.week-dot-circle.rest-day {
    background: var(--surface-secondary);
    border-color: var(--border);
}

/* Empty state for progress */
.progress-empty {
    text-align: center;
    padding: 32px 20px;
    background: linear-gradient(135deg, var(--primary-very-light) 0%, rgba(var(--primary-rgb), 0.08) 100%);
    border-radius: var(--border-radius);
    border: 1px solid rgba(var(--primary-rgb), 0.15);
    cursor: pointer;
    transition: var(--transition);
}

.progress-empty:active {
    transform: scale(0.97);
}

.progress-empty-icon {
    color: var(--primary);
    margin-bottom: 10px;
}

.progress-empty-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.progress-empty-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* =============== TODAY WORKOUT CARD (primary focus) =============== */
#dashboard .today-workout-card {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 16px 20px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(0, 0, 0, 0.04);
    color: var(--text-primary);
    position: relative;
    overflow: hidden;
}
#dashboard .today-workout-card::before {
    display: none;
}

#dashboard .today-workout-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

#dashboard .today-workout-badge {
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-very-light);
    padding: 3px 10px;
    border-radius: var(--border-radius-pill);
}

#dashboard .week-badge {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-very-light);
    padding: 6px 14px;
    border-radius: var(--border-radius-pill);
    text-align: center;
    margin-bottom: 12px;
}

#dashboard .today-workout-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

#dashboard .today-workout-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 14px;
}

#dashboard .today-workout-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

#dashboard .today-workout-meta-item svg {
    flex-shrink: 0;
}

#dashboard .today-workout-cta {
    width: 100%;
    padding: 16px 20px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--border-radius-small);
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    animation: ctaBreath 4s ease-in-out infinite;
}

#dashboard .today-workout-cta:active {
    transform: scale(0.97);
    animation: none;
}

/* Rest day card */
.today-rest-card {
    background: linear-gradient(135deg, var(--surface) 0%, rgba(var(--primary-rgb), 0.05) 100%);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 12px;
    text-align: center;
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.today-rest-icon {
    font-size: 40px;
    margin-bottom: 8px;
    animation: float 4s ease-in-out infinite;
}

.today-rest-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.today-rest-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Completed workout card */
.today-done-card {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 12px;
    text-align: center;
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(0, 0, 0, 0.04);
    animation: celebrationBurst 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    position: relative;
    overflow: hidden;
}

.today-done-icon {
    font-size: 40px;
    margin-bottom: 8px;
}

.today-done-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 4px;
}

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

/* Confetti particles */
.confetti-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: confettiDrop 1.2s ease-out forwards;
    pointer-events: none;
}

/* =============== LOTTIE ANIMATIONS =============== */
.today-done-lottie {
    width: 64px;
    height: 64px;
    margin: 0 auto 4px;
}

/* =============== NAV CARDS (tertiary focus) =============== */
.dash-nav-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.dash-nav-card {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 16px;
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(0, 0, 0, 0.04);
    cursor: pointer;
    transition: var(--transition);
}

.dash-nav-card:active {
    transform: scale(0.97);
}

.dash-nav-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.dash-nav-icon.workout {
    background: var(--primary-very-light);
}
.dash-nav-icon.nutrition {
    background: var(--primary-very-light);
}

.dash-nav-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.dash-nav-subtitle {
    font-size: 11px;
    color: var(--text-secondary);
}

/* =============== QUICK START CARD =============== */
#quickStartCard {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 16px 20px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(0, 0, 0, 0.04);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 14px;
}

#quickStartCard:active {
    transform: scale(0.97);
}

.quick-start-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--primary-very-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.quick-start-content {
    flex: 1;
    min-width: 0;
}

.quick-start-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.quick-start-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

.quick-start-arrow {
    color: var(--text-secondary);
    flex-shrink: 0;
}

/* =============== PROMPT CARDS (subtle focus) =============== */
.dash-prompt-card {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 14px 20px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-card);
    border: 1px dashed rgba(var(--primary-rgb), 0.2);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 14px;
}

.dash-prompt-card:active {
    transform: scale(0.97);
}

.dash-prompt-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dash-prompt-icon.workout {
    background: var(--primary-very-light);
}
.dash-prompt-icon.nutrition {
    background: var(--primary-very-light);
}

.dash-prompt-content {
    flex: 1;
    min-width: 0;
}

.dash-prompt-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1px;
}

.dash-prompt-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

.dash-prompt-arrow {
    color: var(--text-secondary);
    flex-shrink: 0;
}

/* =============== STAGGER ANIMATION =============== */
.dash-stagger {
    opacity: 0;
    animation: dashSlideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
/* Fallback: если анимация не сработала (iOS WebView), показать через 1s */
.dash-stagger.dash-visible {
    opacity: 1 !important;
    transform: none !important;
}
.dash-stagger:nth-child(1) { animation-delay: 0ms; }
.dash-stagger:nth-child(2) { animation-delay: 70ms; }
.dash-stagger:nth-child(3) { animation-delay: 140ms; }
.dash-stagger:nth-child(4) { animation-delay: 210ms; }
.dash-stagger:nth-child(5) { animation-delay: 280ms; }
.dash-stagger:nth-child(6) { animation-delay: 350ms; }
.dash-stagger:nth-child(7) { animation-delay: 420ms; }

/* =============== QUICK WORKOUTS (dashboard) =============== */
.quick-workouts-header {
    padding: 0 4px;
    margin-bottom: 12px;
    margin-top: 8px;
}
.quick-workouts-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--dark);
}
.quick-workouts-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}
.quick-workouts-cat-header {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
    padding: 0 4px;
    margin-bottom: 8px;
    margin-top: 16px;
}
.quick-workouts-cat-header:first-child {
    margin-top: 0;
}
.quick-workouts-carousel {
    margin-bottom: 4px;
}
.quick-workout-card {
    flex-shrink: 0;
    width: 44vw;
    max-width: 200px;
    background: var(--surface);
    border-radius: var(--border-radius-small, 12px);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.15s;
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(0, 0, 0, 0.04);
}
.quick-workout-card:first-child {
    margin-left: 4px;
}
.quick-workout-card:last-child {
    margin-right: 4px;
}
.quick-workout-card:active {
    transform: scale(0.97);
}
.quick-workout-thumb {
    width: 100%;
    aspect-ratio: 1/1;
    position: relative;
    overflow: hidden;
    background: var(--muted, #C9BFA9);
}
.quick-workout-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.quick-workout-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(var(--primary-rgb), 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.quick-workout-name {
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--dark);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Модалка видео с замытием */
.quick-video-overlay {
    background: rgba(0, 0, 0, 0.4) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.quick-video-overlay .library-modal {
    width: 100%;
    max-width: 500px;
    height: auto;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}
.quick-video-overlay .library-modal-video-wrap {
    background: transparent;
    flex: none;
}
.quick-video-overlay .library-modal-video {
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 0;
}

/* Dark theme */
[data-theme="dark"] .quick-workout-card {
    border-color: var(--border);
}
[data-theme="dark"] .quick-workout-thumb {
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.2) 0%, rgba(var(--primary-rgb), 0.1) 100%);
}

/* =============== TRANSFORMATION STORIES CAROUSEL =============== */
.stories-section {
    margin-top: 20px;
    padding-bottom: 8px;
}

.stories-header {
    padding: 0 0 16px;
    text-align: center;
}

.stories-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.2px;
}

.stories-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.stories-carousel {
    position: relative;
    overflow: hidden;
}

.story-card {
    width: 100%;
    background: var(--surface);
    border-radius: 16px;
    padding: 14px;
    border: 1px solid rgba(0, 0, 0, 0.04);
    box-shadow: var(--shadow-card);
    transition: box-shadow 0.2s, border-color 0.2s;
}

.story-photos {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    position: relative;
}

.story-photo-wrapper {
    width: 50%;
    position: relative;
}

.story-photo {
    width: 100%;
    aspect-ratio: 3 / 4;
    border-radius: 10px;
    object-fit: cover;
    display: block;
}

.story-photo-placeholder {
    width: 100%;
    aspect-ratio: 3 / 4;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-photo-placeholder.before {
    background: linear-gradient(135deg, #e0d5cc 0%, #c9b8a8 100%);
}

.story-photo-placeholder.after {
    background: linear-gradient(135deg, #d4956e 0%, #e8b896 100%);
}

.story-photo-placeholder svg {
    opacity: 0.4;
}

.story-label {
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 8px;
    letter-spacing: 0.3px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.story-arrow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    background: var(--surface);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.15);
    z-index: 2;
    border: 1px solid var(--border);
}

.story-arrow svg {
    color: var(--primary);
}

.story-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.story-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

.story-stars {
    color: #f5a623;
    letter-spacing: 1px;
}

.story-text {
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-style: italic;
}

.stories-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 12px;
    padding-bottom: 4px;
}

.stories-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border);
    transition: background 0.2s, transform 0.2s;
}

.stories-dot.active {
    background: var(--primary);
    transform: scale(1.3);
}

/* =============== HOVER STATES (desktop) =============== */
/* =============== DARK THEME OVERRIDES =============== */
[data-theme="dark"] .dashboard-hero {
    background: linear-gradient(180deg, #3E2C1F 0%, #2A1E14 100%);
}
[data-theme="dark"] .today-workout-card {
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.3);
    border-color: rgba(var(--primary-rgb), 0.12);
}
[data-theme="dark"] .today-rest-card {
    background: linear-gradient(135deg, var(--surface) 0%, rgba(var(--primary-rgb), 0.05) 100%);
    border-color: rgba(var(--primary-rgb), 0.12);
}
[data-theme="dark"] #dashboard .today-workout-cta {
    background: var(--gradient-primary);
}
[data-theme="dark"] .story-card {
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.25);
    border-color: rgba(var(--primary-rgb), 0.1);
}
[data-theme="dark"] .story-photo-placeholder.before {
    background: linear-gradient(135deg, #3a332c 0%, #4a3f35 100%);
}
[data-theme="dark"] .story-photo-placeholder.after {
    background: linear-gradient(135deg, #4a3520 0%, #5a4530 100%);
}
[data-theme="dark"] .story-arrow {
    background: var(--surface);
    border-color: rgba(var(--primary-rgb), 0.12);
}
[data-theme="dark"] .progress-section,
[data-theme="dark"] .today-done-card,
[data-theme="dark"] .dash-nav-card,
[data-theme="dark"] #quickStartCard {
    border-color: var(--border);
}
[data-theme="dark"] .dash-nav-icon,
[data-theme="dark"] .dash-prompt-icon {
    background: rgba(var(--primary-rgb), 0.22);
}

/* =============== HOVER STATES (desktop) =============== */
@media (hover: hover) {
    #dashboard .today-workout-cta:hover {
        box-shadow: 0 8px 28px rgba(var(--primary-rgb), 0.35);
        transform: translateY(-1px);
    }
    .dash-nav-card:hover {
        border-color: rgba(var(--primary-rgb), 0.2);
        transform: translateY(-1px);
        box-shadow: var(--shadow-lg);
    }
    .dash-prompt-card:hover {
        border-color: rgba(var(--primary-rgb), 0.3);
        background: linear-gradient(135deg, var(--surface) 0%, rgba(var(--primary-rgb), 0.04) 100%);
    }
    #quickStartCard:hover {
        border-color: rgba(var(--primary-rgb), 0.2);
        transform: translateY(-1px);
        box-shadow: var(--shadow-lg);
    }
    .week-dot:hover .week-dot-circle {
        transform: scale(1.15);
    }
}
