/**
 * HYROX - Tools & Account Pages
 * Missing class definitions for tools/ and account/ templates.
 * Scoped to .entry-content to match hyrox-missing.css pattern.
 * Design tokens via .hx-app (hyrox.css lines 12-133).
 *
 * Covers:
 *   tools/plan-generator.php
 *   account/dashboard.php
 *   account/add-result.php
 *   account/settings.php
 *
 * @package Hyrox
 * @since 1.0.0
 */

/* ==========================================================================
   UTILITY HELPERS
   ========================================================================== */

.entry-content .hx-ml-2  { margin-left: 0.5rem; }
.entry-content .hx-mt-4  { margin-top: 1rem; }
.entry-content .hx-mt-6  { margin-top: 1.5rem; }
.entry-content .hx-mb-4  { margin-bottom: 1rem; }
.entry-content .hx-p-0   { padding: 0 !important; }
.entry-content .hx-link  { color: #1A1A1A; text-decoration: underline; font-weight: 500; }
.entry-content .hx-link:hover { color: var(--hx-primary-dark, #6B7A00); text-decoration: none; }
.entry-content .hx-font-semibold { font-weight: 600; }

/* ==========================================================================
   BADGES — colour variants used across tools & account
   ========================================================================== */

/* Base badge is in hyrox.css. Colour variants below. */
.entry-content .hx-badge-division {
    background: rgba(26, 26, 26, 0.08);
    color: #1A1A1A;
    font-weight: 700;
}

.entry-content .hx-badge-gold {
    background: rgba(255, 215, 0, 0.15);
    color: #9A6E00;
    font-weight: 700;
}

.entry-content .hx-badge-success {
    background: rgba(0, 200, 83, 0.12);
    color: #007A3D;
    font-weight: 600;
}

.entry-content .hx-badge-info {
    background: rgba(33, 150, 243, 0.12);
    color: #0D6EFD;
    font-weight: 600;
}

.entry-content .hx-badge-muted {
    background: #F1F3F5;
    color: #6C757D;
    font-weight: 500;
}

.entry-content .hx-badge-blue {
    background: rgba(33, 150, 243, 0.12);
    color: #0D6EFD;
    font-weight: 600;
}

.entry-content .hx-badge-pink {
    background: rgba(233, 30, 99, 0.1);
    color: #C2185B;
    font-weight: 600;
}

/* ==========================================================================
   ALERTS — success / error
   ========================================================================== */

.entry-content .hx-alert-success {
    background: rgba(0, 200, 83, 0.08);
    border: 1px solid rgba(0, 200, 83, 0.3);
    color: #00622A;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin: 1rem 0;
    font-weight: 500;
    font-size: 0.9375rem;
}

.entry-content .hx-alert-error {
    background: rgba(255, 51, 102, 0.06);
    border: 1px solid rgba(255, 51, 102, 0.25);
    color: #C0002A;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin: 1rem 0;
    font-weight: 500;
    font-size: 0.9375rem;
}

.entry-content .hx-alert-link {
    color: inherit;
    font-weight: 700;
    text-decoration: underline;
    background: none;
    border: none;
    cursor: pointer;
    font-size: inherit;
    padding: 0;
    font-family: inherit;
}

.entry-content .hx-alert-link:hover { text-decoration: none; }

/* ==========================================================================
   LOADING & EMPTY STATES
   ========================================================================== */

.entry-content .hx-loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 3rem 1.5rem;
    color: #6C757D;
    font-size: 0.9375rem;
}

/* Spinner on dark background (inside .hx-btn-primary loading) is in hyrox.css.
   This variant is for light-background loading states. */
.entry-content .hx-spinner {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 2.5px solid #E9ECEF;
    border-top-color: #1A1A1A;
    border-radius: 50%;
    animation: hxSpinTA 0.65s linear infinite;
    flex-shrink: 0;
}

@keyframes hxSpinTA {
    to { transform: rotate(360deg); }
}

.entry-content .hx-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 3.5rem 1.5rem;
    color: #6C757D;
    gap: 0.75rem;
}

.entry-content .hx-empty-state h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1A1A1A;
    margin: 0;
}

.entry-content .hx-empty-state p {
    margin: 0;
    max-width: 360px;
    line-height: 1.6;
}

.entry-content .hx-empty-state-icon {
    width: 56px;
    height: 56px;
    background: #F1F3F5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ADB5BD;
    flex-shrink: 0;
}

/* ==========================================================================
   AUTH GATE (login prompt shown on account pages when logged out)
   ========================================================================== */

.entry-content .hx-auth-gate {
    max-width: 480px;
    margin: 2rem auto;
}

.entry-content .hx-auth-gate-icon {
    width: 72px;
    height: 72px;
    background: #F1F3F5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ADB5BD;
    margin: 0 auto 1.25rem;
}

.entry-content .hx-auth-gate-register {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: #6C757D;
}

.entry-content .hx-auth-gate-register a {
    color: #1A1A1A;
    font-weight: 600;
    text-decoration: underline;
}

/* ==========================================================================
   COLLAPSE ICON (chevron arrow used in collapsible card headers)
   ========================================================================== */

.entry-content .hx-collapse-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ADB5BD;
    flex-shrink: 0;
    transition: transform 0.25s ease;
}

.entry-content .hx-collapse-icon-open {
    transform: rotate(180deg);
}

/* ==========================================================================
   FORM EXTENSIONS
   (grid variants & elements not in hyrox.css base)
   ========================================================================== */

/* 4-column responsive grid for split time inputs */
.entry-content .hx-form-row-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.875rem;
}

@media (max-width: 900px) {
    .entry-content .hx-form-row-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .entry-content .hx-form-row-4 {
        grid-template-columns: 1fr;
    }
}

/* 2-column grid for totals row */
.entry-content .hx-form-row-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.875rem;
}

@media (max-width: 480px) {
    .entry-content .hx-form-row-2 {
        grid-template-columns: 1fr;
    }
}

/* Textarea variant of .hx-input */
.entry-content .hx-input-textarea {
    width: 100%;
    min-height: 90px;
    padding: 0.6875rem 0.875rem;
    border: 1.5px solid #DEE2E6;
    border-radius: 6px;
    font-size: 1rem;
    background: #FFFFFF;
    color: #1A1A1A;
    resize: vertical;
    line-height: 1.5;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.entry-content .hx-input-textarea:focus {
    outline: none;
    border-color: #1A1A1A;
    box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.08);
}

/* Submit / action row */
.entry-content .hx-form-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding: 1.5rem 0 0.5rem;
    flex-wrap: wrap;
}

/* ==========================================================================
   CARD HEADER COLLAPSIBLE VARIANT
   ========================================================================== */

.entry-content .hx-card-header-collapsible {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #E9ECEF;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease;
}

.entry-content .hx-card-header-collapsible:hover {
    background: #F8F9FA;
}

/* ==========================================================================
   TABLE EXTENSIONS
   ========================================================================== */

/* Personal-best row highlight */
.entry-content .hx-row-pb td {
    background: rgba(232, 255, 0, 0.06) !important;
    font-weight: 600;
}

.entry-content .hx-row-pb td:first-child {
    border-left: 3px solid #E8FF00;
}

/* ==========================================================================
   ICON BUTTONS (delete / action icons in table rows)
   ========================================================================== */

.entry-content .hx-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 6px;
    border: 1.5px solid #DEE2E6;
    background: transparent;
    cursor: pointer;
    color: #6C757D;
    transition: all 0.15s ease;
    padding: 0;
    flex-shrink: 0;
}

.entry-content .hx-btn-icon:hover {
    background: #F1F3F5;
    color: #1A1A1A;
    border-color: #ADB5BD;
}

.entry-content .hx-btn-icon-danger {
    color: #FF3366;
    border-color: rgba(255, 51, 102, 0.2);
}

.entry-content .hx-btn-icon-danger:hover {
    background: rgba(255, 51, 102, 0.08);
    border-color: rgba(255, 51, 102, 0.4);
    color: #C0002A;
}

/* Danger button (for modal confirm) */
.entry-content .hx-btn-danger {
    background: #FF3366;
    color: #FFFFFF;
    border: 2px solid #FF3366;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.entry-content .hx-btn-danger:hover {
    background: #E0002A;
    border-color: #E0002A;
}

.entry-content .hx-btn-danger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==========================================================================
   MODAL
   ========================================================================== */

.entry-content .hx-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 10, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1rem;
    backdrop-filter: blur(3px);
}

.entry-content .hx-modal {
    background: #FFFFFF;
    border-radius: 12px;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: hxModalIn 0.2s ease-out;
}

@keyframes hxModalIn {
    from { opacity: 0; transform: scale(0.95) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.entry-content .hx-modal h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1A1A1A;
    margin: 0 0 0.5rem;
}

.entry-content .hx-modal p {
    color: #6C757D;
    font-size: 0.9375rem;
    margin: 0 0 1.5rem;
}

.entry-content .hx-modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* ==========================================================================
   DASHBOARD ACTIONS BAR
   ========================================================================== */

.entry-content .hx-dashboard-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin: 1.5rem 0;
    flex-wrap: wrap;
}

/* ==========================================================================
   PLAN GENERATOR TOOL
   ========================================================================== */

.entry-content .hx-plan-generator {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Plan header strip shown after generation */
.entry-content .hx-plan-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    background: #FFFFFF;
    border: 1px solid #E9ECEF;
    border-radius: 12px;
    padding: 1.5rem;
    flex-wrap: wrap;
}

.entry-content .hx-plan-header-info {
    flex: 1;
    min-width: 200px;
}

.entry-content .hx-plan-header-info h2 {
    font-size: 1.25rem;
    font-weight: 800;
    color: #1A1A1A;
    margin: 0 0 0.375rem;
    letter-spacing: -0.02em;
}

.entry-content .hx-plan-header-info p {
    font-size: 0.9375rem;
    color: #6C757D;
    margin: 0;
    line-height: 1.5;
}

/* Phase overview chips row */
.entry-content .hx-phases-overview {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.entry-content .hx-phase-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.875rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 600;
    border: 1.5px solid transparent;
}

.entry-content .hx-phase-chip-weeks {
    background: rgba(0, 0, 0, 0.08);
    border-radius: 999px;
    padding: 0.1rem 0.4rem;
    font-size: 0.6875rem;
}

/* Phase type colours */
.entry-content .hx-phase-base {
    background: rgba(33, 150, 243, 0.1);
    border-color: rgba(33, 150, 243, 0.25);
    color: #0D47A1;
}

.entry-content .hx-phase-build {
    background: rgba(255, 179, 0, 0.1);
    border-color: rgba(255, 179, 0, 0.3);
    color: #7A4F00;
}

.entry-content .hx-phase-peak {
    background: rgba(232, 255, 0, 0.12);
    border-color: rgba(232, 255, 0, 0.4);
    color: #5A6300;
}

.entry-content .hx-phase-taper {
    background: rgba(0, 200, 83, 0.08);
    border-color: rgba(0, 200, 83, 0.25);
    color: #00622A;
}

/* Phase section (wraps all weeks of one phase) */
.entry-content .hx-plan-phase {
    border: 1px solid #E9ECEF;
    border-radius: 12px;
    overflow: hidden;
}

.entry-content .hx-plan-phase-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #E9ECEF;
}

.entry-content .hx-plan-phase-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #1A1A1A;
    margin: 0 0 0.25rem;
}

.entry-content .hx-plan-phase-header p {
    font-size: 0.875rem;
    color: #6C757D;
    margin: 0;
    line-height: 1.5;
}

/* Phase header colour variants */
.entry-content .hx-phase-header-base {
    background: rgba(33, 150, 243, 0.05);
    border-bottom-color: rgba(33, 150, 243, 0.15);
}

.entry-content .hx-phase-header-build {
    background: rgba(255, 179, 0, 0.06);
    border-bottom-color: rgba(255, 179, 0, 0.2);
}

.entry-content .hx-phase-header-peak {
    background: rgba(232, 255, 0, 0.06);
    border-bottom-color: rgba(232, 255, 0, 0.2);
}

.entry-content .hx-phase-header-taper {
    background: rgba(0, 200, 83, 0.05);
    border-bottom-color: rgba(0, 200, 83, 0.15);
}

/* Week collapsible block */
.entry-content .hx-plan-week {
    border-bottom: 1px solid #E9ECEF;
}

.entry-content .hx-plan-week:last-child {
    border-bottom: none;
}

.entry-content .hx-plan-week-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    background: #FFFFFF;
    transition: background 0.15s ease;
}

.entry-content .hx-plan-week-header:hover {
    background: #F8F9FA;
}

.entry-content .hx-plan-week-label {
    font-weight: 700;
    font-size: 0.9375rem;
    color: #1A1A1A;
}

/* Week body — contains session grid */
.entry-content .hx-plan-week-body {
    padding: 1rem 1.25rem 1.25rem;
    background: #F8F9FA;
}

/* Session cards grid */
.entry-content .hx-session-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.875rem;
}

@media (max-width: 540px) {
    .entry-content .hx-session-grid {
        grid-template-columns: 1fr;
    }
}

/* Individual session card */
.entry-content .hx-session-card {
    background: #FFFFFF;
    border: 1.5px solid #E9ECEF;
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

/* Left-border accent by session type */
.entry-content .hx-session-run    { border-left-color: #2196F3; }
.entry-content .hx-session-strength { border-left-color: #FF8F00; }
.entry-content .hx-session-simulation { border-left-color: #E8FF00; }
.entry-content .hx-session-recovery   { border-left-color: #00C853; }

.entry-content .hx-session-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.entry-content .hx-session-day {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #ADB5BD;
}

.entry-content .hx-session-type-badge {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: capitalize;
    padding: 2px 8px;
    border-radius: 999px;
    background: #F1F3F5;
    color: #495057;
}

.entry-content .hx-session-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #1A1A1A;
    line-height: 1.3;
}

.entry-content .hx-session-exercises {
    margin: 0;
    padding-left: 1.125rem;
    list-style: disc;
    flex: 1;
}

.entry-content .hx-session-exercises li {
    font-size: 0.8125rem;
    color: #495057;
    line-height: 1.5;
    margin-bottom: 0.2rem;
}

.entry-content .hx-session-duration {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: #6C757D;
    font-weight: 500;
    margin-top: 0.25rem;
    padding-top: 0.5rem;
    border-top: 1px solid #F1F3F5;
}

/* Plan footer: print + CTA */
.entry-content .hx-plan-footer {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding: 1rem 0 0.5rem;
    flex-wrap: wrap;
}

/* ==========================================================================
   ADD RESULT — SPLITS SECTION
   ========================================================================== */

.entry-content .hx-add-result {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Outer grid that holds runs / stations / totals sections */
.entry-content .hx-splits-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* ==========================================================================
   ACCOUNT DASHBOARD
   ========================================================================== */

.entry-content .hx-account-dashboard {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* ==========================================================================
   ACCOUNT SETTINGS
   ========================================================================== */

.entry-content .hx-account-settings {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    max-width: 640px;
}

.entry-content .hx-settings-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Fieldset — groups of related settings controls */
.entry-content .hx-fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

.entry-content .hx-fieldset + .hx-fieldset {
    padding-top: 1.5rem;
    border-top: 1px solid #E9ECEF;
}

.entry-content .hx-fieldset-legend {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #1A1A1A;
    margin-bottom: 0.375rem;
    display: block;
}

.entry-content .hx-fieldset-hint {
    font-size: 0.8125rem;
    color: #6C757D;
    margin-bottom: 1rem;
    line-height: 1.5;
}

/* Radio group — settings page */
.entry-content .hx-account-settings .hx-radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Native radio */
.entry-content .hx-radio {
    width: 18px;
    height: 18px;
    accent-color: #1A1A1A;
    cursor: pointer;
    flex-shrink: 0;
}

/* Hint text beside the strong label inside a radio label */
.entry-content .hx-radio-hint {
    font-size: 0.8125rem;
    color: #6C757D;
    font-weight: 400;
    display: block;
    margin-top: 1px;
}

/* Select wrapper — provides custom arrow for the division dropdown */
.entry-content .hx-select-wrapper {
    position: relative;
}

.entry-content .hx-select-wrapper::after {
    content: '';
    position: absolute;
    right: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 8px;
    background: 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 1l5 5 5-5' stroke='%236C757D' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center;
    pointer-events: none;
}

.entry-content .hx-select-wrapper .hx-select {
    width: 100%;
    padding: 0.6875rem 2.5rem 0.6875rem 0.875rem;
    border: 1.5px solid #DEE2E6;
    border-radius: 6px;
    font-size: 1rem;
    background: #FFFFFF;
    color: #1A1A1A;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.entry-content .hx-select-wrapper .hx-select:focus {
    outline: none;
    border-color: #1A1A1A;
    box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.08);
}

/* ==========================================================================
   MODERN TOOL/ACCOUNT FORM SUPPORT
   ========================================================================== */

.entry-content .hx-account-settings .hx-settings-form,
.entry-content .hx-plan-generator .hx-form-row {
    gap: 1rem;
}

.entry-content .hx-plan-generator .hx-input,
.entry-content .hx-account-settings .hx-input,
.entry-content .hx-account-settings .hx-select {
    min-height: 52px;
    border-radius: var(--hx-radius-lg);
}

.entry-content .hx-account-settings .hx-radio-group,
.entry-content .hx-plan-generator .hx-form-row {
    align-items: start;
}

@media (max-width: 768px) {
    .entry-content .hx-plan-generator .hx-form-row {
        flex-direction: column;
    }
}
