/**
 * @license
 * Copyright (c) 2026 Elson Lleshi
 * SPDX-License-Identifier: UNLICENSED
 */

.my-plan-section {
    padding: 40px 0 60px;
    background: #111318;
    color: rgba(255,255,255,0.85);
    min-height: 70vh;
}

.plans-container {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.loading-state,
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: #1a1d25;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    color: rgba(255,255,255,0.6);
}

.loading-state i,
.empty-state i {
    font-size: 3rem;
    color: var(--primary-color, #f97316);
    margin-bottom: 16px;
}

.empty-state h2 {
    font-size: 1.4rem;
    margin: 8px 0;
    color: rgba(255,255,255,0.85);
}

.empty-state.error i { color: #ef4444; }

.plan-card {
    background: #1a1d25;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}

.plan-card-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 2px solid var(--primary-color, #f97316);
    padding-bottom: 12px;
    margin-bottom: 24px;
}

.plan-card-header h2 {
    font-size: 1.5rem;
    color: var(--primary-color, #f97316);
    letter-spacing: 1px;
    margin: 0;
}

.plan-updated {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.4);
}

.plan-day {
    margin-bottom: 24px;
}

.plan-day-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.05rem;
    margin: 0 0 12px;
    color: rgba(255,255,255,0.75);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.day-name { color: var(--primary-color, #f97316); font-weight: 700; }

.day-count {
    background: rgba(249,115,22,0.15);
    color: var(--primary-color, #f97316);
    border-radius: 12px;
    padding: 2px 10px;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.plan-exercise-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}

@media (min-width: 560px) { .plan-exercise-list { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .plan-exercise-list { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1280px){ .plan-exercise-list { grid-template-columns: repeat(4, 1fr); } }

.plan-exercise {
    display: flex;
    flex-direction: column;
    background: #14171d;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    overflow: hidden;
    position: relative;
    transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}
.plan-exercise:hover {
    transform: translateY(-2px);
    border-color: rgba(249,115,22,0.5);
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}

.plan-exercise.in-superset {
    border-left: 4px solid var(--primary-color, #f97316);
}

.ex-order {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    width: 30px;
    height: 30px;
    background: var(--primary-color, #f97316);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.85rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.ex-media {
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #0c0e12;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.ex-media img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ex-icon i {
    font-size: 3rem;
    color: var(--primary-color, #f97316);
    opacity: 0.6;
}

.ex-body {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.ex-name {
    font-weight: 700;
    font-size: 1.05rem;
    color: rgba(255,255,255,0.95);
    line-height: 1.25;
}
.ex-name .ex-name-link {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dashed currentColor;
}
.ex-name .ex-name-link:hover { color: var(--primary-color, #f97316); }
.ex-name .yt-icon { color: #ff0000; margin-left: 4px; font-size: 0.9em; }

.ex-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 12px;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.6);
}
.ex-stats .stat.sets { grid-column: span 2; }
.ex-stats .stat.max-weight-stat { grid-column: span 2; }

.ex-stats .stat {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.ex-stats .stat strong {
    color: var(--primary-color, #f97316);
    font-size: 0.95rem;
}

.ex-stats .stat em {
    font-style: normal;
    color: rgba(255,255,255,0.35);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ex-stats .superset-flag {
    color: var(--primary-color, #f97316);
}

/* Trainer-written notes shown under the stats row. */
.ex-notes {
    margin-top: 8px;
    padding: 6px 10px;
    background: rgba(249,115,22,0.08);
    border-left: 3px solid var(--primary-color, #f97316);
    border-radius: 4px;
    color: rgba(255,255,255,0.82);
    font-size: 0.85rem;
    font-style: italic;
    display: flex;
    align-items: flex-start;
    gap: 6px;
}
.ex-notes i { color: var(--primary-color, #f97316); margin-top: 2px; }

.my-plan-footer {
    margin-top: 36px;
    text-align: center;
}

.secondary-button {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.14);
    color: rgba(255,255,255,0.85);
    border-radius: 8px;
    padding: 10px 22px;
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 600;
    transition: all 0.2s;
}

.secondary-button:hover {
    background: var(--primary-color, #f97316);
    border-color: var(--primary-color, #f97316);
    color: #fff;
}

.empty-day {
    color: rgba(255,255,255,0.4);
    font-style: italic;
}

/* Inline max-weight edit */
.max-weight-stat {
    position: relative;
}
.max-weight-edit,
.max-weight-save,
.max-weight-cancel {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.55);
    cursor: pointer;
    padding: 2px 6px;
    margin-left: 4px;
    border-radius: 4px;
    font-size: 0.78rem;
    transition: color 0.15s, background 0.15s;
}
.max-weight-edit:hover {
    color: var(--primary-color, #f97316);
    background: rgba(249,115,22,0.1);
}
.max-weight-save { color: #4ade80; }
.max-weight-save:hover { background: rgba(74,222,128,0.15); }
.max-weight-cancel:hover { color: #f87171; background: rgba(248,113,113,0.12); }
.max-weight-input {
    width: 64px;
    padding: 2px 6px;
    border: 1px solid var(--primary-color, #f97316);
    background: rgba(255,255,255,0.08);
    color: #fff;
    border-radius: 4px;
    font-size: 0.85rem;
    -moz-appearance: textfield;
}
.max-weight-input::-webkit-outer-spin-button,
.max-weight-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.max-weight-stat.editing { background: rgba(249,115,22,0.08); border-radius: 6px; padding: 2px 6px; }

/* ── Plan history (read-only view for the member) ──────────────────────── */
.plan-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.plan-history-btn {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.85);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s, border-color 0.15s;
}
.plan-history-btn:hover {
    background: rgba(249,115,22,0.15);
    border-color: var(--primary-color, #f97316);
}
.plan-history-btn i { color: var(--primary-color, #f97316); }

.plan-history-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 90;
}
.plan-history-overlay[hidden] { display: none; }

.plan-history-modal {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: min(540px, 92vw);
    max-height: 80vh;
    background: #1a1d25;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 50px rgba(0,0,0,0.6);
    overflow: hidden;
}
.plan-history-modal[hidden] { display: none; }

.plan-history-header {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.plan-history-header h3 {
    margin: 0;
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    display: flex; align-items: center; gap: 8px;
}
.plan-history-header h3 i { color: var(--primary-color, #f97316); }

.plan-history-close {
    margin-left: auto;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.55);
    font-size: 1rem;
    cursor: pointer;
    padding: 4px 8px;
}
.plan-history-close:hover { color: #fff; }

/* "View only" banner shown above the list so the member knows they can't change anything. */
.plan-history-readonly-note {
    background: rgba(249,115,22,0.08);
    color: rgba(255,255,255,0.75);
    font-size: 0.82rem;
    padding: 8px 18px;
    border-bottom: 1px solid rgba(249,115,22,0.18);
    text-align: center;
}

.plan-history-body {
    padding: 8px 6px;
    overflow-y: auto;
}

.plan-history-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.plan-history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.plan-history-item:last-child { border-bottom: none; }

.plan-history-item-info { flex: 1; min-width: 0; }

.plan-history-item-name {
    color: #fff;
    font-weight: 600;
    font-size: 0.92rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.plan-history-item-when {
    color: rgba(255,255,255,0.55);
    font-size: 0.78rem;
    margin-top: 2px;
}

.hist-latest {
    display: inline-block;
    padding: 1px 6px;
    background: var(--primary-color, #f97316);
    color: #fff;
    border-radius: 3px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-right: 6px;
    letter-spacing: 0.04em;
}

.plan-history-empty,
.plan-history-loading,
.plan-history-error {
    color: rgba(255,255,255,0.55);
    padding: 16px;
    text-align: center;
    font-style: italic;
    list-style: none;
}
.plan-history-error { color: #f87171; font-style: normal; }

/* ── Read-only body snapshot card ─────────────────────────────────────── */
.my-body-card {
    max-width: 960px;
    margin: 24px auto 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 18px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.my-body-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.my-body-header h3 {
    margin: 0;
    color: #111827;
    font-size: 1.1rem;
}

.my-body-header h3 i { color: #f97316; margin-right: 6px; }

.my-body-hint {
    color: #6b7280;
    font-size: 0.85rem;
    font-style: italic;
}

.my-body-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
}

.my-body-cell {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 12px;
    text-align: center;
}

.my-body-label {
    color: #6b7280;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.my-body-value {
    color: #111827;
    font-size: 1.05rem;
    font-weight: 600;
}

.my-body-unit {
    color: #9ca3af;
    font-weight: 400;
    font-size: 0.85rem;
    margin-left: 2px;
}

.my-body-health {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed #e5e7eb;
}

.my-body-health h4 {
    margin: 0 0 4px;
    color: #111827;
    font-size: 0.95rem;
}

.my-body-health h4 i { color: #ef4444; margin-right: 6px; }

.my-body-health p {
    margin: 0;
    color: #374151;
    white-space: pre-wrap;
}

/* ── Top action bar (above the plan) ──────────────────────────────────── */
.my-plan-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.my-plan-actions .secondary-button,
.my-plan-actions .cta-button {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Section titles inside the profile popup. */
.my-body-section-title {
    margin: 14px 0 10px;
    color: #111827;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.my-body-section-title i { color: #f97316; }

.my-body-section-title:first-of-type { margin-top: 0; }

/* ── Profile popup: form-like row layout (on dark modal background) ───── */
.my-profile-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.my-profile-row:last-child {
    border-bottom: 0;
}

.my-profile-label {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.82rem;
    flex: 0 0 auto;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.my-profile-value {
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    text-align: right;
    word-break: break-word;
}

.my-profile-unit {
    color: rgba(255, 255, 255, 0.4);
    font-weight: 400;
    font-size: 0.85rem;
    margin-left: 4px;
}

/* Section titles inside the dark popup. */
.plan-history-modal .my-body-section-title {
    margin: 14px 16px 6px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: flex;
    align-items: center;
    gap: 6px;
}
.plan-history-modal .my-body-section-title i { color: #f97316; }
.plan-history-modal .my-body-section-title:first-of-type { margin-top: 6px; }

/* Health-notes block inside the popup. */
.plan-history-modal .my-body-health {
    margin: 14px 16px 6px;
    padding-top: 12px;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
}
.plan-history-modal .my-body-health h4 {
    margin: 0 0 6px;
    color: #fff;
    font-size: 0.95rem;
}
.plan-history-modal .my-body-health h4 i { color: #ef4444; margin-right: 6px; }
.plan-history-modal .my-body-health p {
    margin: 0;
    color: rgba(255, 255, 255, 0.78);
    white-space: pre-wrap;
}

/* "No body data" empty-state line inside the popup. */
.plan-history-modal #myBodyEmpty {
    color: rgba(255, 255, 255, 0.55) !important;
}
