/* =====================================================
   GymLog — استایل‌های افزوده

   ۱) متغیرهای تم (--gl-*) برای کلاس‌هایی که جایگزین style="" های ثابت شده‌اند
   ۲) یادداشت جلسه/حرکت، دکمه‌ی استراحت و تایمر
   حالت تیره با body.dark-mode فعال می‌شود (همان مکانیزم برنامه).
   اگر در style.css متغیرهای تم دارید، مقدار --gl-* را به آن‌ها وصل کنید.
===================================================== */
:root {
    --gl-surface: #ffffff;
    --gl-surface-2: #f9fafb;
    --gl-border: #e2e8f0;
    --gl-border-soft: #f3f4f6;
    --gl-text: #0f172a;
    --gl-muted: #64748b;
    --gl-faint: #9ca3af;
    --gl-accent: #2563eb;
    --gl-accent-soft: #eff6ff;
    --gl-chip-bg: #f1f5f9;
    --gl-chip-text: #475569;
    --gl-danger: #dc2626;
    --gl-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

body.dark-mode {
    --gl-surface: #1e293b;
    --gl-surface-2: #172033;
    --gl-border: #334155;
    --gl-border-soft: #2a3649;
    --gl-text: #f1f5f9;
    --gl-muted: #94a3b8;
    --gl-faint: #7c8aa0;
    --gl-accent: #60a5fa;
    --gl-accent-soft: rgba(96, 165, 250, 0.16);
    --gl-chip-bg: #273449;
    --gl-chip-text: #cbd5e1;
    --gl-danger: #f87171;
    --gl-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* ---------- عمومی ---------- */
.gl-view-pad { padding: 24px; }
.gl-muted-sm { font-size: 12px; color: var(--gl-muted); }
.gl-unit { color: var(--gl-faint); }
.gl-empty-pad { padding: 16px; color: var(--gl-faint); }
.gl-cell-flex { display: flex; align-items: center; gap: 8px; }
.gl-btn-block { width: 100%; }
.gl-danger-text { color: var(--gl-danger); }
.gl-hint { display: block; margin-top: 6px; font-size: 11px; color: var(--gl-faint); }

/* ---------- تاریخچه ---------- */
.gl-hist-head { flex-wrap: wrap; gap: 12px; }
.gl-hist-title { margin: 0 0 4px; }

/* ---------- تقویم موبایل ---------- */
.gl-cal-mobile { max-width: 400px; margin: 0 auto; }
.gl-cal-mobile-card {
    width: 100%;
    max-width: 100%;
    border: 1px solid var(--gl-border);
    box-shadow: var(--gl-shadow);
}
.gl-cal-title { margin: 0; font-size: 15px; font-weight: 700; }
.gl-cal-day { margin-top: 16px; }

/* ---------- صفحه‌ی برنامه‌ها ---------- */
.gl-upload-box {
    background: var(--gl-surface);
    border: 1px solid var(--gl-border);
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--gl-shadow);
}
.gl-upload-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 20px; }
.gl-upload-content { display: flex; align-items: flex-start; gap: 16px; max-width: 640px; }
.gl-upload-icon {
    width: 48px; height: 48px; border-radius: 12px; flex-shrink: 0;
    background: var(--gl-accent-soft); color: var(--gl-accent);
    display: flex; align-items: center; justify-content: center; font-size: 24px;
}
.gl-upload-text h3 { margin: 0 0 6px; font-size: 16px; font-weight: 800; color: var(--gl-text); }
.gl-upload-text p { margin: 0 0 10px; font-size: 13px; color: var(--gl-muted); line-height: 1.6; }
.gl-upload-badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gl-badge {
    padding: 4px 8px; border-radius: 6px; font-size: 11px; font-weight: 600;
    background: var(--gl-chip-bg); color: var(--gl-chip-text);
}
.gl-upload-btn {
    cursor: pointer; padding: 12px 24px; font-size: 14px; font-weight: 700; border-radius: 10px;
    display: inline-flex; align-items: center; gap: 8px;
}
.gl-section-title { margin-bottom: 16px; }
.gl-section-title h3 { margin: 0; font-size: 17px; font-weight: 800; color: var(--gl-text); }
.gl-program-card { margin-bottom: 16px; padding: 20px; }
.gl-program-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.gl-program-card-title { margin: 0; font-size: 18px; font-weight: 800; }

/* ---------- پشتیبان و تنظیمات ---------- */
.gl-panel { padding: 24px; max-width: 640px; margin: 0 auto; }
.gl-panel-col { display: flex; flex-direction: column; gap: 20px; }
.gl-panel-title { margin: 0 0 6px; font-size: 18px; font-weight: 700; }
.gl-panel-col .gl-panel-title { margin: 0; }
.gl-panel-desc { margin: 0 0 20px; font-size: 13px; color: var(--gl-muted); }
.gl-info-box {
    background: var(--gl-surface-2); border: 1px solid var(--gl-border);
    border-radius: 10px; padding: 16px; margin-bottom: 20px;
}
.gl-info-box strong { display: block; font-size: 13px; margin-bottom: 4px; }
.gl-info-box span { font-size: 12px; color: var(--gl-muted); }
.gl-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gl-file-label { cursor: pointer; text-align: center; }
.gl-setting-row { border-bottom: 1px solid var(--gl-border-soft); padding-bottom: 16px; }
@media (max-width: 520px) { .gl-grid-2 { grid-template-columns: 1fr; } }

/* ---------- یادداشت‌ها ---------- */
.session-note-card { padding: 14px 16px; margin-top: 12px; }
.session-note-label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.session-note-input,
.exercise-note-input {
    width: 100%; box-sizing: border-box; resize: vertical; font: inherit; font-size: 13px;
    padding: 10px 12px; border-radius: 10px; line-height: 1.7;
    border: 1px solid var(--gl-border); background: var(--gl-surface-2); color: var(--gl-text);
}
.session-note-input:focus,
.exercise-note-input:focus { outline: 2px solid var(--gl-accent); outline-offset: 0; }
.exercise-note { margin-top: 10px; }
.exercise-note > summary { cursor: pointer; font-size: 13px; color: var(--gl-muted); padding: 4px 0; user-select: none; }
.exercise-note[open] > summary { margin-bottom: 6px; }
.exercise-prev-note {
    font-size: 12px; color: var(--gl-muted); background: var(--gl-accent-soft);
    border-radius: 8px; padding: 6px 10px; margin-bottom: 8px; white-space: pre-wrap;
}
.exercise-history-note,
.dv-detail-note {
    margin: 8px 0 0; font-size: 12px; color: var(--gl-muted); white-space: pre-wrap; line-height: 1.7;
}
.dv-detail-note-session {
    background: var(--gl-accent-soft); border-radius: 8px; padding: 8px 10px; margin-bottom: 12px;
}

/* ---------- دکمه‌ی استراحت ---------- */
.exercise-rest-btn {
    font: inherit; font-size: 13px; cursor: pointer; padding: 8px 12px; border-radius: 10px;
    border: 1px solid var(--gl-border); background: var(--gl-surface); color: var(--gl-text);
}
.exercise-rest-btn:active { transform: scale(0.97); }

/* ---------- تایمر استراحت ---------- */
.rest-timer {
    position: fixed; z-index: 950; right: 12px; left: 12px; margin: 0 auto; max-width: 420px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    padding: 12px 14px; border-radius: 14px;
    background: var(--gl-surface); color: var(--gl-text);
    border: 1px solid var(--gl-border); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.rest-timer[hidden] { display: none; }
.rest-timer-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rest-timer-label { font-size: 13px; color: var(--gl-muted); }
.rest-timer-time { font-size: 26px; font-variant-numeric: tabular-nums; direction: ltr; }
.rest-timer-track { height: 6px; border-radius: 99px; background: var(--gl-chip-bg); overflow: hidden; margin: 8px 0 10px; }
.rest-timer-track i { display: block; height: 100%; width: 0; background: var(--gl-accent); transition: width 0.25s linear; }
.rest-timer-actions { display: flex; gap: 8px; }
.rest-timer-actions button {
    flex: 1; font: inherit; font-size: 12px; cursor: pointer; padding: 8px 6px; border-radius: 8px;
    border: 1px solid var(--gl-border); background: var(--gl-surface-2); color: var(--gl-text);
}
.rest-timer.done { border-color: #16a34a; }
.rest-timer.done .rest-timer-label { color: #16a34a; font-weight: 700; }
.rest-timer.done .rest-timer-track i { background: #16a34a; }

/* ---------- هشدار تفاوت زیاد با تمرین قبلی ---------- */
.set-warning {
    grid-column: 2 / 4;
    padding: 6px 10px;
    border-radius: 8px;
    background: #fef3c7;
    color: #92400e;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.8;
    text-align: right;
}
.set-warning:empty { display: none; }
.set-row.has-warning input { border-color: #d97706 !important; }
body.dark-mode .set-warning { background: #451a03; color: #fde68a; }
@media (max-width: 1023px) {
    .set-warning { font-size: 14px; }
}


/* =====================================================
   منوی کناری جمع‌شونده (دسکتاپ) + انیمیشن دکمه‌ها
===================================================== */
.sidebar-toggle-btn { display: none; }
.sidebar-nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (min-width: 1024px) {
    .app-sidebar {
        overflow-x: hidden;
        transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    }
    html body .sidebar-header { position: relative; }
    html body .sidebar-toggle-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
        width: 32px;
        height: 32px;
        min-height: 32px;
        margin-inline-start: auto;
        padding: 0;
        border-radius: 8px;
        border: 1px solid var(--gl-border);
        background: var(--gl-surface);
        color: var(--gl-muted);
        font-size: 13px;
        cursor: pointer;
        transition: background 0.15s, color 0.15s, transform 0.15s;
    }
    html body .sidebar-toggle-btn:hover { background: var(--gl-accent-soft); color: var(--gl-accent); }
    .sidebar-toggle-icon { display: inline-block; transform: rotate(180deg); transition: transform 0.28s ease; }
    /* منو در سمت راست است؛ فلش به سمت کناره‌ی منو می‌رود */
    body.sidebar-collapsed .sidebar-toggle-icon { transform: rotate(0deg); }

    body.sidebar-collapsed .app-sidebar { width: 72px; }
    body.sidebar-collapsed .sidebar-title,
    body.sidebar-collapsed .sidebar-nav-label,
    body.sidebar-collapsed .sidebar-footer { display: none; }
    html body.sidebar-collapsed .sidebar-header {
        flex-direction: column;
        justify-content: center;
        gap: 10px;
        padding: 18px 0 14px;
    }
    html body.sidebar-collapsed .sidebar-toggle-btn { margin-inline-start: 0; }
    html body.sidebar-collapsed .sidebar-nav { padding: 12px 8px; }
    html body.sidebar-collapsed .sidebar-nav-item {
        justify-content: center;
        gap: 0;
        padding: 12px 0;
    }
    html body.sidebar-collapsed .sidebar-nav-icon { width: auto; font-size: 20px; }
    body.sidebar-collapsed .sidebar-divider { margin: 8px 10px; }

    /* فرم ساخت برنامه کنار منو */
    html body.sidebar-collapsed .pb-overlay { right: 72px; }
}

/* ---------- انیمیشن دکمه‌ها ---------- */
@keyframes gl-rise {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes gl-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.35); }
    50%      { box-shadow: 0 0 0 9px rgba(37, 99, 235, 0); }
}
@keyframes gl-shine {
    from { transform: translateX(120%) skewX(-20deg); }
    to   { transform: translateX(-220%) skewX(-20deg); }
}

.primary-btn,
.secondary-btn,
.dash-start-workout-btn,
.sidebar-nav-item {
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s, color 0.18s, border-color 0.18s;
}
.primary-btn:hover,
.secondary-btn:hover,
.dash-start-workout-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(0, 0, 0, 0.14); }
.primary-btn:active,
.secondary-btn:active,
.dash-start-workout-btn:active { transform: translateY(0) scale(0.97); box-shadow: none; }
.sidebar-nav-item:hover { transform: translateX(-3px); }
body.sidebar-collapsed .sidebar-nav-item:hover { transform: scale(1.1); }

/* دکمه‌های صفحه‌ی خوش‌آمدگویی */
.dv-welcome-actions .primary-btn,
.dv-welcome-actions .secondary-btn {
    position: relative;
    overflow: hidden;
    animation: gl-rise 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.dv-welcome-actions > :nth-child(1) { animation-delay: 0.05s; }
.dv-welcome-actions > :nth-child(2) { animation-delay: 0.17s; }
.dv-welcome-actions > :nth-child(3) { animation-delay: 0.29s; }
.dv-welcome-actions .dv-welcome-default { animation: gl-rise 0.55s 0.29s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.dv-welcome-actions .dv-welcome-default .secondary-btn { animation: none; }
.dv-welcome-actions .primary-btn { animation: gl-rise 0.55s 0.05s cubic-bezier(0.2, 0.8, 0.2, 1) both, gl-pulse 2.4s 1s ease-in-out infinite; }
.dv-welcome-actions .primary-btn::after {
    content: "";
    position: absolute;
    top: 0; bottom: 0; right: 0;
    width: 40%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    transform: translateX(120%) skewX(-20deg);
    pointer-events: none;
}
.dv-welcome-actions .primary-btn:hover::after { animation: gl-shine 0.7s ease; }
.dv-welcome-actions .primary-btn:hover { animation-play-state: running, paused; }
.dv-welcome-actions .secondary-btn:hover { border-color: var(--gl-accent); }


/* =====================================================
   صفحه‌ی راهنما و سوالات متداول (prefix: hp-)
===================================================== */
.hp-wrap { display: flex; flex-direction: column; gap: 18px; max-width: 900px; margin: 0 auto; }

.hp-hero {
    padding: 22px 20px; border-radius: 14px;
    background: var(--gl-accent-soft); border: 1px solid var(--gl-border);
}
.hp-hero h2 { margin: 0 0 8px; font-size: 22px; font-weight: 800; color: var(--gl-text); }
.hp-hero p { margin: 0; font-size: 14px; line-height: 2; color: var(--gl-muted); }

.hp-block { display: flex; flex-direction: column; gap: 12px; }
.hp-block-title { margin: 0; font-size: 17px; font-weight: 800; color: var(--gl-text); }

.hp-aud-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.hp-aud {
    padding: 16px; border-radius: 12px;
    background: var(--gl-surface); border: 1px solid var(--gl-border); box-shadow: var(--gl-shadow);
}
.hp-aud-icon { display: block; margin-bottom: 6px; font-size: 26px; }
.hp-aud strong { display: block; margin-bottom: 6px; font-size: 15px; color: var(--gl-text); }
.hp-aud p { margin: 0; font-size: 13px; line-height: 2; color: var(--gl-muted); }

.hp-features {
    list-style: none; margin: 0; padding: 0;
    display: grid; grid-template-columns: 1fr; gap: 8px;
}
.hp-features li {
    display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; border-radius: 10px;
    background: var(--gl-surface); border: 1px solid var(--gl-border);
}
.hp-features strong { font-size: 14px; color: var(--gl-accent); }
.hp-features span { font-size: 12.5px; line-height: 1.9; color: var(--gl-muted); }

.hp-search { width: 100%; }
.hp-group { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.hp-group-title { margin: 8px 0 0; font-size: 15px; font-weight: 800; color: var(--gl-text); }

.hp-q {
    border-radius: 12px; background: var(--gl-surface);
    border: 1px solid var(--gl-border); overflow: hidden;
}
.hp-q > summary {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 14px 16px; cursor: pointer; list-style: none;
    font-size: 14px; font-weight: 700; line-height: 1.8; color: var(--gl-text);
}
.hp-q > summary::-webkit-details-marker { display: none; }
.hp-q > summary::after {
    content: "+"; flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--gl-chip-bg); color: var(--gl-chip-text); font-size: 18px; line-height: 1;
}
.hp-q[open] > summary::after { content: "−"; background: var(--gl-accent); color: #ffffff; }
.hp-q[open] > summary { border-bottom: 1px solid var(--gl-border-soft); }
.hp-a { padding: 12px 16px 16px; font-size: 13.5px; line-height: 2.1; color: var(--gl-muted); }
.hp-a p { margin: 0 0 8px; }
.hp-a p:last-child { margin-bottom: 0; }
.hp-a ul, .hp-a ol { margin: 0 0 8px; padding-right: 22px; }
.hp-a li { margin-bottom: 4px; }
.hp-a b { color: var(--gl-text); }

.hp-none { padding: 22px; text-align: center; font-size: 13px; color: var(--gl-muted); }
.hp-none[hidden] { display: none; }

.hp-contact {
    padding: 20px; border-radius: 14px; margin-bottom: 24px;
    background: var(--gl-surface); border: 1px solid var(--gl-border); box-shadow: var(--gl-shadow);
}
.hp-contact h3 { margin: 0 0 6px; font-size: 17px; font-weight: 800; color: var(--gl-text); }
.hp-contact p { margin: 0 0 14px; font-size: 13px; color: var(--gl-muted); }
.hp-contact-links { display: flex; flex-wrap: wrap; gap: 10px; }
.hp-contact-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    text-decoration: none; min-width: 200px;
}

@media (min-width: 900px) {
    .hp-aud-grid { grid-template-columns: repeat(3, 1fr); }
    .hp-features { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1023px) {
    .gl-view-pad { padding: 14px 12px; }
}


/* ---------- دکمه‌های ویرایش/حذف برنامه ---------- */
.gl-program-card-head { gap: 12px; flex-wrap: wrap; }
.gl-program-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.gl-program-card-actions button { min-height: 38px; padding: 6px 14px; font-size: 13px; }


/* ---------- برنامه‌های قبلی: جمع‌شونده ---------- */
.gl-program-card.collapsed .gl-program-card-head { margin-bottom: 0; }
.gl-program-card-head[data-prog-toggle] { cursor: pointer; }
.gl-program-card-head[data-prog-toggle]:hover .gl-program-card-title { color: var(--gl-accent); }
.gl-prog-chev { display: inline-block; margin-right: 6px; color: var(--gl-muted); transition: transform 0.2s ease; }
.gl-program-card.open .gl-prog-chev { transform: rotate(180deg); }
.gl-program-card .dv-prog-sessions[hidden] { display: none; }

/* =====================================================
   همگام‌سازی با بله (prefix: bs-)
===================================================== */
.gl-gap-top { margin-top: 16px; }
.bale-setting { align-items: flex-start; flex-direction: column; }
.bs-panel { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.bs-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; }
.bs-head strong { font-size: 15px; color: var(--gl-text); }
.bs-status { font-size: 12px; line-height: 1.8; color: var(--gl-muted); }
.bs-status.ok { color: #16a34a; }
.bs-status.pending { color: #d97706; }
.bs-status.err { color: var(--gl-danger); }
.bs-desc { margin: 0; font-size: 12.5px; line-height: 1.9; color: var(--gl-muted); }
.bs-sync-btn { width: 100%; }
.bs-fields { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 600px) { .bs-fields { grid-template-columns: 1.6fr 1fr; } }
.bs-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.bs-label { font-size: 13px; font-weight: 600; color: var(--gl-muted); }
.bs-input-row { display: flex; gap: 6px; }
.bs-input-row input { flex: 1; min-width: 0; }
.bs-input-row button { flex: 0 0 auto; min-height: 44px; padding: 6px 12px; font-size: 12px; }
.bs-field input[dir="ltr"] { text-align: left; }
.bs-check { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; line-height: 1.8; cursor: pointer; color: var(--gl-text); }
.bs-check input { flex: 0 0 auto; width: 20px; height: 20px; min-height: 0; margin-top: 3px; }
.bs-check small { display: block; font-size: 11px; color: var(--gl-faint); }
.bs-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.bs-actions button { min-height: 42px; padding: 6px 14px; font-size: 13px; }
.bs-msg { min-height: 18px; margin: 0; font-size: 12.5px; line-height: 1.8; color: var(--gl-muted); }
.bs-msg.ok { color: #16a34a; }
.bs-msg.err { color: var(--gl-danger); }
.backup-warning-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.backup-warning-actions .secondary-btn { min-height: 38px; font-size: 12px; }
.backup-warning-actions [hidden] { display: none; }
