/**
 * Dashboard Page Styles - Linear-Inspired Design
 * Page-specific layout only - components loaded via HTML link tag
 *
 * NOTE: Component styles (header, buttons, cards) are loaded separately
 * via <link rel="stylesheet" href="styles/components/index.css">
 */

/* ============================================================================
   Page-Specific Base Layout
   ============================================================================ */

html:has(body.dashboard-page) {
    height: auto !important;
}

body.dashboard-page {
    background: var(--bg-base) !important;
    background-image: radial-gradient(circle at 20% 10%, rgba(var(--accent-rgb), 0.03) 0%, transparent 50%),
                      radial-gradient(circle at 80% 80%, rgba(var(--accent-rgb), 0.02) 0%, transparent 50%) !important;
    color: var(--text-primary) !important;
    min-height: 100vh !important;
    position: relative !important;
    height: auto !important;
    width: 100% !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: -0.006em;
    /* Page-wide vertical-pan permission. Even though card-link elements have
       their own touch-action: pan-y, applying it at body level ensures any
       descendant that doesn't explicitly opt out inherits the
       scroll-routing behavior. iOS Safari respects this for page-wide
       scroll-gesture vs click-tap discrimination. */
    touch-action: pan-y;
}

.dashboard-app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 100%;
}

/* ============================================================================
   Main Content Layout
   ============================================================================ */

.dashboard-main {
    flex: 1;
    padding: 3rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* ============================================================================
   XP Card Specifics
   ============================================================================ */

.xp-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.level-badge {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.level-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: -0.01em;
}

.xp-progress {
    margin-bottom: 2rem;
}

.xp-bar {
    height: 6px;
    background: var(--gray-2);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.xp-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent-hover) 100%);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.xp-text {
    font-size: var(--font-size-xs-mid);
    color: var(--text-tertiary);
    font-weight: 400;
    letter-spacing: -0.01em;
}

.streak-badge {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-subtle);
}

.streak-fire {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.streak-fire svg {
    width: 20px;
    height: 20px;
    stroke: #ffffff;
}

.streak-count {
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.streak-label {
    font-size: var(--font-size-xs-mid);
    color: var(--text-tertiary);
    font-weight: 400;
    letter-spacing: -0.01em;
}

.today-xp {
    margin-left: auto;
    font-size: var(--font-size-xs-mid);
    color: var(--text-tertiary);
    font-weight: 400;
    letter-spacing: -0.01em;
}

/* ============================================================================
   Dashboard Sections
   ============================================================================ */

.dashboard-section {
    margin-bottom: 4rem;
}

.dashboard-section--cta {
    margin-bottom: 3rem;
}

/* ========================================================================
   Log Your Training — primary CTA
   ======================================================================== */
.log-training-cta {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: var(--accent);
    color: var(--accent-on);
    border-radius: 16px;
    text-decoration: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    position: relative;
    overflow: hidden;
}

.log-training-cta:hover,
.log-training-cta:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
    outline: none;
}

.log-training-cta:focus-visible {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22), 0 0 0 3px var(--text-primary);
}

.log-training-cta:active {
    transform: translateY(0);
}

.log-training-cta__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 12px;
}

.log-training-cta__icon svg {
    width: 22px;
    height: 22px;
}

.log-training-cta__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.log-training-cta__title {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.25;
}

.log-training-cta__sub {
    font-size: 0.875rem;
    opacity: 0.85;
    margin-top: 2px;
}

.log-training-cta__arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.log-training-cta:hover .log-training-cta__arrow,
.log-training-cta:focus-visible .log-training-cta__arrow {
    transform: translateX(4px);
}

.log-training-cta__arrow svg {
    width: 22px;
    height: 22px;
}

@media (max-width: 480px) {
    .log-training-cta {
        padding: 1rem 1.25rem;
        gap: 0.875rem;
    }
    .log-training-cta__title {
        font-size: 1rem;
    }
    .log-training-cta__sub {
        font-size: 0.8125rem;
    }
}

.dashboard-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
    text-align: center;
}

.section-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    gap: 0.5rem;
}

.section-header h2 {
    margin-bottom: 0;
}

.today-date {
    font-size: var(--font-size-xs-mid);
    color: var(--text-tertiary);
    font-weight: 400;
    letter-spacing: -0.01em;
}

/* ============================================================================
   Today's Classes Section
   ============================================================================ */

.classes-summary {
    min-height: 120px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

.today-classes-card-link,
.xp-card-link {
    text-decoration: none !important;
    color: inherit;
    display: block;
    /* pan-y routes vertical drag gestures to native scroll instead of
       firing the link click. Pairs with attachTapDiscriminator in
       dashboard.js — both layers cooperate so a finger-drag never
       triggers navigation. */
    touch-action: pan-y;
}

.today-classes-card-link {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.today-classes-card-link:hover,
.xp-card-link:hover {
    text-decoration: none !important;
}

.today-classes-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 2rem;
    transition: all 0.2s ease;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.today-classes-card:hover {
    background: var(--bg-hover);
    border-color: var(--border-medium);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* Class Items */
.class-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--gray-1);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    transition: all 0.15s ease;
    text-decoration: none !important;
}

.class-item:hover {
    background: var(--gray-2);
    border-color: var(--border-medium);
    text-decoration: none !important;
}

.class-item * {
    text-decoration: none !important;
}

.class-item.completed {
    opacity: 0.7;
}

.class-status {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.875rem;
    font-weight: 600;
    flex-shrink: 0;
}

.class-status.pending {
    color: var(--text-quaternary);
    background: transparent;
    border: 2px solid var(--border-subtle);
}

.class-status.completed {
    color: var(--text-primary);
    background: var(--gray-3);
    border: 2px solid var(--border-medium);
}

.class-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.class-time {
    font-size: var(--font-size-sm-mid);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    min-width: 80px;
}

.class-name {
    font-size: var(--font-size-sm-mid);
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: -0.01em;
    flex: 1;
}

.class-games {
    font-size: var(--font-size-xs-mid);
    color: var(--text-tertiary);
    font-weight: 400;
    padding: 0.25rem 0.75rem;
    background: var(--gray-2);
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
}

.no-classes-message {
    text-align: center;
    padding: 2rem;
    color: var(--text-tertiary);
}

.no-classes-message p {
    font-size: var(--font-size-sm-mid);
    font-weight: 400;
}

/* ============================================================================
   Weekly Progress Section
   ============================================================================ */

.weekly-progress-section .section-header {
    flex-direction: row;
    justify-content: center;
    align-items: center;
    position: relative;
}

.weekly-progress-section .section-header h2 {
    text-align: center;
}

.weekly-progress-section .view-summary-btn {
    /* Below the card, centered */
}

.view-summary-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: var(--font-size-xs-mid);
    font-weight: 500;
    color: var(--accent);
    background: transparent;
    border: 1px solid var(--accent);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.view-summary-btn:hover {
    background: var(--accent);
    color: white;
}

.view-summary-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.weekly-progress-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 2rem;
    max-width: 800px;
    margin: 0 auto;
    box-shadow: var(--shadow-sm);
}

.weekly-progress-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
    color: var(--text-tertiary);
}

.loading-spinner-small {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-subtle);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.weekly-progress-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    color: var(--text-tertiary);
}

.weekly-progress-empty .empty-icon {
    margin-bottom: 1rem;
    opacity: 0.5;
}

.weekly-progress-empty .empty-icon svg {
    stroke: var(--text-quaternary);
}

.weekly-progress-empty p {
    font-size: var(--font-size-sm-mid);
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.weekly-progress-empty .empty-hint {
    font-size: var(--font-size-xs-mid);
    color: var(--text-tertiary);
}

.weekly-progress-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.weekly-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.week-label {
    font-size: var(--font-size-sm-mid);
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: -0.01em;
}

.weekly-stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.weekly-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    background: var(--gray-1);
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
}

.weekly-stat .stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.weekly-stat .stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-top: 0.25rem;
}

.weekly-focus-areas {
    padding-top: 1rem;
    border-top: 1px solid var(--border-subtle);
}

.focus-areas-label {
    font-size: var(--font-size-xs-mid);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.focus-area-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    background: var(--gray-1);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    border: 1px solid var(--border-subtle);
}

.focus-area-item:last-child {
    margin-bottom: 0;
}

.focus-area-item.focus-area-empty {
    align-items: center;
    color: var(--text-tertiary);
    padding: 1rem;
}

.focus-system {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
}

.focus-battle {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-tertiary);
}

/* Legacy support for focus-label and focus-ratio */
.focus-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.focus-ratio {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.focus-ratio.high {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.focus-ratio.medium {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.focus-ratio.low {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}
/* ============================================================================
   Coach Notes Section (From Your Coach)
   ============================================================================ */

.coach-notes-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 800px;
    margin: 0 auto;
}

.coach-note-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-sm);
}

.coach-note-top-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.coach-note-type {
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.coach-note-type--pending {
    color: #60a5fa;
}

.coach-note-date {
    font-size: 0.6875rem;
    color: var(--text-tertiary);
    margin-left: auto;
}

.coach-note-card--pending {
    border-color: rgba(96, 165, 250, 0.25);
}

.coach-note-pending-label {
    font-size: 0.75rem;
    color: #60a5fa;
    font-style: italic;
}

.coach-note-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    margin-bottom: 0.375rem;
}

.coach-note-desc {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.coach-note-video {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: var(--gray-1);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 500;
    text-decoration: none;
    margin-bottom: 0.5rem;
    transition: background var(--duration-fast) var(--ease-out);
}

.coach-note-video:hover {
    background: var(--gray-2);
}

.coach-note-video-wrap {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 0.75rem;
    background: #000;
}

.coach-note-video-wrap iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.coach-note-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.5rem;
}

.coach-note-coach {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.coach-note-action {
    padding: 0.375rem 0.75rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity var(--duration-fast) var(--ease-out);
}

.coach-note-action:hover {
    opacity: 0.9;
}

.coach-note-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Inline note form on assignment cards — lives on its own row between the
   description and the footer, full width of the card. */
.coach-note-form {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 0.75rem;
}

.coach-note-textarea {
    width: 100%;
    min-height: 56px;
    padding: 10px 12px;
    border: 1px solid var(--border-medium);
    border-radius: 10px;
    background: var(--bg-input, rgba(255, 255, 255, 0.03));
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.8125rem;
    line-height: 1.5;
    resize: vertical;
    box-sizing: border-box;
}

.coach-note-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.coach-note-textarea::placeholder {
    color: var(--text-tertiary);
}

.coach-note-counter {
    font-size: 0.6875rem;
    color: var(--text-tertiary);
    text-align: right;
}

.coach-notes-empty {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-tertiary);
    font-size: 0.875rem;
}

/* Messages unread badge on quick action card */
.quick-action-card {
    position: relative;
}

.messages-unread-badge {
    position: absolute;
    top: 0.625rem;
    right: 0.625rem;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--accent);
    color: #fff;
    border-radius: 9px;
    font-size: 0.6875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.curriculum-ready-badge {
    position: absolute;
    top: 0.625rem;
    right: 0.625rem;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--accent);
    color: #fff;
    border-radius: 9px;
    font-size: 0.6875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* ============================================================================
   Weekly Suggestions
   ============================================================================ */

.empty-suggestions {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
}

.empty-suggestions p {
    color: var(--text-tertiary);
    font-size: var(--font-size-sm-mid);
    margin-bottom: 1.5rem;
}

.suggestions-generate-btn {
    padding: 0.75rem 1.5rem !important;
    font-size: 0.9375rem !important;
}

.suggestions-generate-btn svg {
    width: 16px !important;
    height: 16px !important;
}

/* ============================================================================
   Mobile Responsiveness
   ============================================================================ */

@media (max-width: 1024px) {
    .class-info {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
        width: 100%;
        text-align: center;
    }

    .class-time {
        min-width: unset;
    }

    .class-games {
        align-self: center;
    }

    .class-item {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}

/* ── Membership Nudge Banner ────────────────────────────────────── */

.membership-nudge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-md);
    border-radius: var(--radius-md);
    background: rgba(var(--accent-rgb), 0.1);
    border: 1px solid rgba(var(--accent-rgb), 0.25);
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}

.membership-nudge__actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-shrink: 0;
}

.membership-nudge__view-btn {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    background: var(--brand-primary);
    color: #fff;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.membership-nudge__view-btn:hover {
    opacity: 0.9;
}

.membership-nudge__dismiss {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1;
}

.membership-nudge__dismiss:hover {
    color: var(--text-primary);
}

/* Past-due (failed payment) variant — danger-toned container signals urgency.
   The CTA button keeps the brand-blue fill (white-on-red would fail WCAG 4.5:1
   in dark theme); urgency reads from the red banner + left accent, while the
   body text stays --text-primary for high contrast in both themes. */
.membership-nudge--past-due {
    background: rgba(var(--accent-danger-rgb), 0.1);
    border: 1px solid rgba(var(--accent-danger-rgb), 0.3);
    border-left: 3px solid var(--accent-danger);
}

@media (max-width: 480px) {
    .membership-nudge {
        flex-direction: column;
        text-align: center;
    }
}

/* §312k cancellation link (EU gyms only) — persistent, unobtrusive footer link
   to the public no-login cancellation page. Legally must be reachable. */
.membership-cancel-link {
    margin-top: var(--space-lg);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-subtle);
    text-align: center;
}

.membership-cancel-link a {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    text-decoration: underline;
}

.membership-cancel-link a:hover {
    color: var(--accent);
}
