/**
 * CertFlow Client Dashboard Portal — Modern SaaS-style dashboard styles.
 * All classes use the .certflow-client-* prefix for full isolation.
 */

/* ===== Layout ===== */
.certflow-client-portal {
    /* Themed via inline CSS variables in Assets.php; fallbacks match defaults. */
    --cf-client-sidebar: #1a1a2e;
    --cf-client-accent: #6366f1;
    --cf-client-accent-rgb: 99, 102, 241;
    --cf-client-content-bg: #f8f9fb;

    /* Radius scale (two-tier): containers 6px, controls 4px, chips 3px. No 8px. */
    --cf-r-container: 6px;
    --cf-r-control: 4px;
    --cf-r-chip: 3px;

    display: flex;
    min-height: 600px;
    background: var(--cf-client-content-bg);
    color: #1a1a2e;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    border-radius: var(--cf-r-container);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
}

/* ===== Theme isolation (stops host-theme bleed) =====
   The .certflow-client-* prefix only stops our class NAMES from colliding. It
   does NOT stop the active WordPress theme's element-level rules — button, a,
   input, and especially their :hover states — from applying inside the portal.
   Many themes animate button:hover / a:hover with a transform or margin shift,
   which made bare controls (e.g. the course toggle) jump on hover.

   Base reset uses :where() so it carries ZERO specificity — every
   .certflow-client-* component rule still wins over it. The interactive-state
   neutralizer is deliberately forceful: it only sets values we never animate
   ourselves (no transform/animation on buttons or links), so !important is safe
   and guarantees no theme can reintroduce hover movement. */
:where(.certflow-client-portal) button,
:where(.certflow-client-portal) input,
:where(.certflow-client-portal) select,
:where(.certflow-client-portal) textarea {
    -webkit-appearance: none;
    appearance: none;
    background: none;
    border: none;
    box-shadow: none;
    border-radius: 0;
    margin: 0;
    color: inherit;
    font: inherit;
    text-transform: none;
    letter-spacing: normal;
}

:where(.certflow-client-portal) select {
    -webkit-appearance: menulist;
    appearance: menulist;
}

:where(.certflow-client-portal) a {
    text-decoration: none;
    box-shadow: none;
    border: 0;
}

:where(.certflow-client-portal) button {
    cursor: pointer;
}

.certflow-client-portal a:hover,
.certflow-client-portal a:focus,
.certflow-client-portal button:hover,
.certflow-client-portal button:focus,
.certflow-client-portal button:active {
    transform: none !important;
    animation: none !important;
    text-decoration: none;
}

/* Root cause of "toggle moves on hover": host themes commonly add a border on
   button:hover (militra-lt's design-tokens.css sets `border: 1px solid` on every
   button:hover). A borderless portal button then GROWS by the border width on
   hover and shifts. Component buttons (.certflow-client-btn) already carry a
   border + their own hover, so exclude them; pin every other (bare) portal
   button so no theme-added border can change its box. */
.certflow-client-portal button:not(.certflow-client-btn):hover,
.certflow-client-portal button:not(.certflow-client-btn):focus,
.certflow-client-portal button:not(.certflow-client-btn):active {
    border: 0;
}

.certflow-client-sidebar {
    flex: 0 0 220px;
    background: var(--cf-client-sidebar);
    color: #e5e7eb;
    padding: 24px 0;
    display: flex;
    flex-direction: column;
}

.certflow-client-sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 16px;
}

.certflow-client-avatar {
    flex: 0 0 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--cf-client-accent);
    color: #fff;
    font-weight: 600;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.certflow-client-user-info {
    min-width: 0;
}

.certflow-client-user-name {
    font-weight: 600;
    font-size: 14px;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.certflow-client-user-role {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 2px;
}

.certflow-client-nav {
    display: flex;
    flex-direction: column;
    padding: 0 12px;
    gap: 2px;
}

.certflow-client-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--cf-r-control);
    color: #cbd5e1;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.certflow-client-nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.certflow-client-nav-item.active {
    background: rgba(var(--cf-client-accent-rgb), 0.18);
    color: #fff;
    border-left-color: var(--cf-client-accent);
}

.certflow-client-nav-item .cf-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Logout pinned to the bottom of the sidebar */
.certflow-client-sidebar-footer {
    margin-top: auto;
    padding: 12px 12px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.certflow-client-logout:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #fecaca;
}

.certflow-client-content {
    flex: 1 1 auto;
    padding: 32px 36px;
    background: var(--cf-client-content-bg);
    overflow-y: auto;
    min-width: 0;
}

.certflow-client-tab-header {
    margin-bottom: 24px;
}

.certflow-client-tab-header h2 {
    font-size: 22px;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0;
}

.certflow-client-tab-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.certflow-client-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 24px 0 12px;
}

.certflow-client-section-title:first-child {
    margin-top: 0;
}

/* ===== Cards ===== */
.certflow-client-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: var(--cf-r-container);
    padding: 20px 22px;
    margin-bottom: 14px;
    /* Transition only paint properties — never transform/layout — so hover is
       crisp and stable (no sub-pixel drift, no hit-area jitter at the edges). */
    transition: box-shadow 0.16s ease, border-color 0.16s ease;
}

.certflow-client-card:hover {
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    border-color: #d1d5db;
}

.certflow-client-course-card {
    position: relative;
}

.certflow-client-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.certflow-client-card-title {
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.35;
}

.certflow-client-course-code {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.03em;
    padding: 2px 7px;
    border-radius: var(--cf-r-chip);
    margin-right: 8px;
    vertical-align: middle;
    background: color-mix(in srgb, var(--cfg-course-accent, #6b7280) 14%, #fff);
    color:      color-mix(in srgb, var(--cfg-course-accent, #6b7280) 75%, #1f2937);
    border: 1px solid color-mix(in srgb, var(--cfg-course-accent, #6b7280) 30%, #e5e7eb);
}

.certflow-client-course-card .certflow-client-card-actions {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px dashed #e5e7eb;
}

.certflow-client-card-subtitle {
    font-size: 13px;
    color: #6b7280;
    margin-top: 4px;
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
}

.certflow-client-card-badges {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

/* Enrolled date shown top-right of the course card (moved out of the journey rail) */
.certflow-client-card-enrolled {
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
}

.certflow-client-card-dates {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 13px;
    color: #6b7280;
    margin-top: 12px;
}

.certflow-client-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    flex-wrap: wrap;
}

/* ===== Course Status (canceled badge — used by the journey rail's canceled row) ===== */
.certflow-client-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    flex-shrink: 0;
    border: 1px solid transparent;
}

.certflow-client-status-canceled {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

/* ===== Badges ===== */
.certflow-client-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.certflow-client-badge-success {
    background: #d1fae5;
    color: #065f46;
}

.certflow-client-badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.certflow-client-badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.certflow-client-badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.certflow-client-badge-secondary {
    background: #f3f4f6;
    color: #4b5563;
}

/* ===== Buttons ===== */
.certflow-client-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: var(--cf-r-control);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    transition: background 0.15s, border-color 0.15s, color 0.15s, filter 0.15s;
    line-height: 1;
}

.certflow-client-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    color: #111827;
}

/* Press feedback via brightness only — no transform, so buttons never shift. */
.certflow-client-btn:active {
    filter: brightness(0.96);
}

.certflow-client-btn-primary {
    background: var(--cf-client-accent, #6366f1);
    border-color: var(--cf-client-accent, #6366f1);
    color: #fff;
}

.certflow-client-btn-primary:hover {
    background: var(--cf-client-accent, #6366f1);
    border-color: var(--cf-client-accent, #6366f1);
    color: #fff;
    filter: brightness(0.92);
}

.certflow-client-btn-warning {
    background: #f59e0b;
    border-color: #f59e0b;
    color: #fff;
}

.certflow-client-btn-warning:hover {
    background: #d97706;
    border-color: #d97706;
    color: #fff;
}

.certflow-client-btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.certflow-client-btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===== Form Fields (Profile) ===== */
.certflow-client-profile-form form {
    max-width: 600px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: var(--cf-r-container);
    padding: 24px;
}

.certflow-client-form-field {
    margin-bottom: 16px;
}

.certflow-client-form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.certflow-client-form-input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: var(--cf-r-control);
    font-size: 14px;
    color: #1a1a2e;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}

.certflow-client-form-input:focus {
    outline: none;
    border-color: var(--cf-client-accent);
    box-shadow: 0 0 0 3px rgba(var(--cf-client-accent-rgb), 0.15);
}

.certflow-client-form-value {
    padding: 9px 0;
    font-size: 14px;
    color: #6b7280;
}

.certflow-client-form-actions {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

/* ===== Progress Bar (Learning) ===== */
.certflow-client-progress-bar {
    height: 8px;
    background: #e5e7eb;
    border-radius: var(--cf-r-chip);
    overflow: hidden;
    margin: 12px 0;
}

.certflow-client-progress-fill {
    height: 100%;
    background: var(--cf-client-accent);
    transition: width 0.3s ease;
}

/* ===== Notifications ===== */
.certflow-client-notification {
    padding: 12px 16px;
    border-radius: var(--cf-r-container);
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
    border-left: 4px solid;
}

.certflow-client-notification-success {
    background: #d1fae5;
    color: #065f46;
    border-left-color: #10b981;
}

.certflow-client-notification-error {
    background: #fee2e2;
    color: #991b1b;
    border-left-color: #ef4444;
}

/* ===== States ===== */
.certflow-client-loading,
.certflow-client-empty,
.certflow-client-error {
    text-align: center;
    padding: 48px 24px;
    color: #6b7280;
    font-size: 14px;
}

.certflow-client-error {
    color: #991b1b;
}

/* ===== Message Pages (login / no account) ===== */
.certflow-client-message {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: var(--cf-r-container);
    padding: 64px 32px;
    text-align: center;
    max-width: 480px;
    margin: 64px auto;
}

.certflow-client-message h2 {
    font-size: 22px;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0 0 12px;
}

.certflow-client-message p {
    color: #6b7280;
    font-size: 14px;
    margin: 0 0 24px;
}

/* ===== Helpers ===== */
.certflow-client-text-muted {
    color: #6b7280;
    font-size: 12px;
}

.certflow-client-text-warning {
    color: #92400e;
    font-size: 12px;
    font-weight: 500;
}

.certflow-client-order-total {
    font-weight: 600;
    color: #1a1a2e;
}

.certflow-client-order-items {
    margin-top: 12px;
    padding: 10px 12px;
    background: #f9fafb;
    border-radius: var(--cf-r-container);
    font-size: 13px;
    color: #4b5563;
}

.certflow-client-order-item {
    padding: 2px 0;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .certflow-client-portal {
        flex-direction: column;
        min-height: auto;
    }

    .certflow-client-sidebar {
        flex: 0 0 auto;
        flex-direction: row;
        padding: 12px;
        overflow-x: auto;
    }

    .certflow-client-sidebar-header {
        flex: 0 0 auto;
        padding: 0 16px 0 8px;
        margin: 0 12px 0 0;
        border-bottom: none;
        border-right: 1px solid rgba(255, 255, 255, 0.08);
    }

    .certflow-client-nav {
        flex-direction: row;
        padding: 0;
        gap: 4px;
        flex: 1 1 auto;
    }

    .certflow-client-nav-item {
        flex: 0 0 auto;
        padding: 8px 12px;
        border-left: none;
        border-bottom: 3px solid transparent;
    }

    .certflow-client-nav-item.active {
        border-left: none;
        border-bottom-color: var(--cf-client-accent);
    }

    .certflow-client-nav-item span {
        display: none;
    }

    .certflow-client-sidebar-footer {
        margin: 0 0 0 auto;
        padding: 0;
        border-top: none;
    }

    .certflow-client-content {
        padding: 20px 16px;
    }

    .certflow-client-card {
        padding: 16px;
    }

}

/* Reschedule modal */
.certflow-client-modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.5);
    display: flex; align-items: center; justify-content: center; z-index: 100000; padding: 16px;
}
.certflow-client-modal {
    background: #fff; border-radius: var(--cf-r-container); padding: 24px; max-width: 460px; width: 100%;
    max-height: 80vh; overflow-y: auto; box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.certflow-client-modal-title { margin: 0 0 8px; font-size: 18px; }
.certflow-client-modal-prompt, .certflow-client-modal-empty { font-size: 14px; color: #444; margin: 0 0 16px; }
.certflow-client-modal-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.certflow-client-modal-option {
    display: flex; gap: 10px; align-items: flex-start; padding: 12px;
    border: 1px solid #e2e2e2; border-radius: var(--cf-r-control); cursor: pointer; font-size: 13px; line-height: 1.5;
}
.certflow-client-modal-option:hover { border-color: #999; }
.certflow-client-modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
/* Secondary == the neutral outline style (matches the base .certflow-client-btn),
   so "Change date", modal "Cancel" and "View details" all look identical. */
.certflow-client-btn-secondary {
    background: #fff;
    border-color: #d1d5db;
    color: #374151;
}
.certflow-client-btn-secondary:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    color: #111827;
}

/* ===== My Courses: course count ===== */
.certflow-client-courses-count {
    font-size: 13px; color: #6b7280; font-weight: 600; margin: 0 0 16px;
}

/* ===== My Courses: journey hairline (numberless overall progress) ===== */
.certflow-client-journey-hairline {
    height: 3px; background: #e5e7eb; border-radius: 999px; overflow: hidden; margin: 0 0 16px;
}
.certflow-client-journey-fill {
    display: block; height: 100%; background: var(--cf-client-accent);
    border-radius: 999px; transition: width .4s ease;
}

/* ===== My Courses: vertical journey rail ===== */
.certflow-client-rail { margin: 4px 0 0; }
.certflow-client-rail-row { position: relative; display: flex; gap: 12px; padding-bottom: 16px; }
.certflow-client-rail-row.is-last { padding-bottom: 0; }
.certflow-client-rail-row:not(.is-last)::before {
    content: ''; position: absolute; left: 12px; top: 26px; bottom: 0; width: 2px; background: #e5e7eb;
}
.certflow-client-rail-row.is-done:not(.is-last)::before { background: var(--cf-client-accent); }
.certflow-client-rail-row.is-upcoming:not(.is-last)::before,
.certflow-client-rail-row.is-awaiting:not(.is-last)::before {
    background: transparent; border-left: 2px dashed #e5e7eb; width: 0;
}
.certflow-client-rail-node {
    position: relative; z-index: 1; flex: 0 0 26px; width: 26px; height: 26px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: #fff; border: 2px solid #e5e7eb; color: #9ca3af;
}
.certflow-client-rail-node .cf-icon { width: 14px; height: 14px; }
.certflow-client-rail-row.is-done .certflow-client-rail-node {
    background: var(--cf-client-accent); border-color: var(--cf-client-accent); color: #fff;
}
.certflow-client-rail-row.is-current .certflow-client-rail-node {
    border-color: var(--cf-client-accent); color: var(--cf-client-accent);
    /* Static accent ring — marks the current step without perpetual motion. */
    box-shadow: 0 0 0 3px rgba(var(--cf-client-accent-rgb), 0.15);
}
.certflow-client-rail-row.is-awaiting .certflow-client-rail-node {
    border-color: var(--cf-client-accent); color: var(--cf-client-accent);
}
.certflow-client-rail-body { flex: 1 1 auto; min-width: 0; padding-top: 3px; }
.certflow-client-rail-label { font-size: 14px; font-weight: 500; color: #6b7280; }
.certflow-client-rail-row.is-done .certflow-client-rail-label { color: #374151; }
.certflow-client-rail-row.is-current .certflow-client-rail-label { color: #0f172a; font-weight: 600; }
.certflow-client-rail-date { display: block; font-size: 12px; color: #9ca3af; margin-top: 2px; }
.certflow-client-rail-panel {
    margin-top: 10px; padding: 14px;
    background: rgba(var(--cf-client-accent-rgb), .05); border-radius: var(--cf-r-container, 6px);
}
.certflow-client-rail-sub { font-size: 13px; color: #4b5563; margin-bottom: 8px; }
.certflow-client-rail-awaiting { margin-bottom: 0; color: #6b7280; }
.certflow-client-rail-canceled { display: flex; align-items: center; gap: 8px; }
.certflow-client-rail-canceled .cf-icon { width: 16px; height: 16px; color: #991b1b; }

/* ===== My Courses: collapsible (completed / canceled) ===== */
.certflow-client-course-toggle {
    background: none; border: none; cursor: pointer; padding: 4px; margin-left: 4px;
    color: #9ca3af; display: inline-flex; border-radius: var(--cf-r-control);
    transition: color 0.15s, background 0.15s;
}
/* Explicit hover so no theme button:hover (transform/background) can reach it. */
.certflow-client-course-toggle:hover {
    transform: none;
    background: rgba(var(--cf-client-accent-rgb), 0.08);
    color: var(--cf-client-accent);
}
.certflow-client-course-toggle .cf-icon { width: 18px; height: 18px; transition: transform .15s; }
.certflow-client-course-card.is-collapsed .certflow-client-rail,
.certflow-client-course-card.is-collapsed .certflow-client-journey-hairline { display: none; }
.certflow-client-course-card:not(.is-collapsed) .certflow-client-course-toggle .cf-icon { transform: rotate(90deg); }
.certflow-client-course-card.is-canceled { opacity: .65; }

/* ===== My Courses: skeleton loader ===== */
.certflow-client-skeleton-card { pointer-events: none; }
.certflow-client-skel { background: #eef0f3; border-radius: 6px; overflow: hidden; position: relative; }
.certflow-client-skel::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.6), transparent);
    transform: translateX(-100%); animation: certflow-skel-shimmer 1.3s infinite;
}
.certflow-client-skel-title { width: 55%; height: 16px; margin-bottom: 18px; }
.certflow-client-skel-row { width: 100%; height: 12px; margin-bottom: 12px; }
@keyframes certflow-skel-shimmer { 100% { transform: translateX(100%); } }

/* ===== My Courses: rich empty state ===== */
.certflow-client-empty-rich { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.certflow-client-empty-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 56px; height: 56px; border-radius: 50%;
    background: rgba(var(--cf-client-accent-rgb), .10); color: var(--cf-client-accent); margin-bottom: 8px;
}
.certflow-client-empty-icon .cf-icon { width: 28px; height: 28px; }
.certflow-client-empty-rich h3 { margin: 0; font-size: 16px; color: #1a1a2e; }
.certflow-client-empty-rich p { margin: 0; font-size: 13px; color: #6b7280; }

/* ===== My Courses: reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
    .certflow-client-skel::after { animation: none; }
    .certflow-client-journey-fill { transition: none; }
}
