/**
 * Client Portal — Frontend Styles
 *
 * Minimal, clean styles. Designed to work within Elementor layouts
 * without fighting the theme. Uses cp- prefix for all classes.
 *
 * @package ClientPortal
 */

/* ─── Typography Utility Classes ────────────────────────────────── */
/* Tune font, size, weight here — applies across all shortcodes.    */

.cp-label { 
    font-family: Poppins, sans-serif;
    font-size: 14px !important;
    font-weight: 700;
    color: #1f2124 !important;
}

.cp-sec-label { 
    font-family: Poppins, sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #1f2124 !important;
}

.cp-data { 
    font-family: Poppins, sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #1f2124 !important;
}


/* ─── Base ──────────────────────────────────────────────────────── */

.cp-section {
    margin-bottom: 24px;
}

.cp-portal-message {
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    text-align: center;
    color: #666;
}

.cp-portal-message a {
    color: #2271b1;
    text-decoration: underline;
}

/* ─── Buttons ───────────────────────────────────────────────────── */

.cp-button {
    display: inline-block;
    padding: 1rem;
    background: #F9CF3A;
    color: #000000;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    font-family: Akshar, sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.4;
    box-shadow: 5px 5px 0px 0px #757575;
}

.cp-button:hover,
.cp-button:focus,
.cp-button:active,
button.cp-button:hover,
button.cp-button:focus,
button.cp-button:active {
    background: #F9CF3A !important;
    color: #000000 !important;
    border: none !important;
    box-shadow: 5px 5px 0px 0px #757575 !important;
    outline: none !important;
    text-decoration: none !important;
    transform: none !important;
    opacity: 1 !important;
}

/* ─── Badges ────────────────────────────────────────────────────── */

.cp-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
}

.cp-badge-locked {
    background: #f0f0f1;
    color: #999;
}

.cp-badge-complete {
    background: #edfaef;
    color: #00a32a;
}

.cp-badge-pending {
    background: #fef8e8;
    color: #996800;
}

/* ─── Organizer Info ────────────────────────────────────────────── */

/* The organizer card reuses .cp-member-card. These are organizer-specific extras. */

.cp-organizer-title {
    display: block;
    margin-bottom: 4px;
    color: #666;
    font-style: italic;
    font-size: 13px;
}

.cp-organizer-bio {
    margin: 8px 0 0;
    font-size: 13px;
    color: #555;
    line-height: 1.5;
}

/* ─── Program Info ──────────────────────────────────────────────── */

.cp-program-name {
    margin: 0 0 8px;
    font-family: Poppins, Sans-Serif;
    font-size: 40px;
    font-weight: 700;
    font-style: italic;
    color: #ffffff;
    text-transform: uppercase;
    text-align: center;
}

.cp-program-description {
    color: #555;
    line-height: 1.6;
    text-align: center;
}

/* ─── Cohort Info / Group Directory ─────────────────────────────── */

.cp-group-directory {
    margin-top: 12px;
}

/* ─── Member Card Grid ─────────────────────────────────────────── */

.cp-member-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.cp-member-grid-single {
    grid-template-columns: 1fr;
    max-width: 320px;
}

.cp-member-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    transition: box-shadow 0.15s;
}

.cp-member-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.cp-member-card-avatar {
    flex-shrink: 0;
}

.cp-member-card-body {
    flex: 1;
    min-width: 0;
}

.cp-member-card-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #888;
    margin-bottom: 2px;
}

.cp-member-card-name {
    display: block;
    margin-bottom: 6px;
    line-height: 1.3;
}

/* ─── Avatar ───────────────────────────────────────────────────── */

.cp-avatar {
    border-radius: 50%;
    object-fit: cover;
    background: #e0e0e0;
}

/* ─── Contact & Social Icons (display) ─────────────────────────── */

.cp-contact-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-top: 4px;
}

/* Legacy class kept for render_icons() standalone use */
.cp-social-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-top: 4px;
}

.cp-social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e8e8e8;
    color: #555;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
}

.cp-social-icon:hover {
    background: #333;
    color: #fff;
}

.cp-social-icon svg {
    width: 14px;
    height: 14px;
}

/* ─── Collapsible Sections ──────────────────────────────────────── */

.cp-collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.cp-collapsible-header h4 {
    margin: 0;
}

.cp-collapsible-toggle {
    font-size: 18px;
    font-weight: bold;
    color: #888;
    width: 24px;
    text-align: center;
    line-height: 1;
    flex-shrink: 0;
}

.cp-collapsible-header:hover .cp-collapsible-toggle {
    color: #333;
}

/* ─── Profile Edit Section ─────────────────────────────────────── */

.cp-profile-edit {
    margin-top: 20px;
    padding: 16px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}

.cp-profile-edit > h4 {
    margin: 0 0 12px;
}

/* ─── Avatar Upload ────────────────────────────────────────────── */

.cp-avatar-edit {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e0e0e0;
}

.cp-avatar-preview .cp-avatar {
    width: 80px;
    height: 80px;
}

.cp-avatar-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.cp-avatar-controls .description {
    width: 100%;
    font-size: 12px;
    color: #888;
    margin: 0;
}

.cp-avatar-status {
    font-size: 13px;
}


/* ─── Social Links Editor ──────────────────────────────────────── */

.cp-social-edit {
    margin-top: 0;
}

.cp-social-edit h5 {
    margin: 0 0 4px;
}

.cp-social-edit > .description {
    margin: 0 0 12px;
    font-size: 13px;
    color: #666;
}

.cp-social-edit-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.cp-social-edit-row select.cp-social-platform {
    width: 140px;
    min-width: 120px;
    flex-shrink: 0;
}

.cp-social-edit-row input.cp-social-url {
    flex: 1;
    min-width: 0;
}

.cp-social-edit-row .cp-social-remove {
    background: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 28px;
    height: 28px;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    color: #999;
    flex-shrink: 0;
    padding: 0;
}

.cp-social-edit-row .cp-social-remove:hover {
    color: #d63638;
    border-color: #d63638;
}

.cp-social-edit-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 4px;
}

.cp-social-status {
    font-size: 13px;
    margin-left: 4px;
}

/* ─── Form Tree ─────────────────────────────────────────────────── */

.cp-form-tree {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

.cp-round {
    border-bottom: 1px solid #e0e0e0;
}

.cp-round:last-child {
    border-bottom: none;
}

.cp-round-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #404040;
    color: #ffffff;
    font-weight: 600;
}

.cp-round-header .cp-round-title {
    color: #ffffff !important;
}

.cp-round-locked .cp-round-header {
    color: #999;
}

.cp-round-header[role="button"] {
    cursor: pointer;
    user-select: none;
}

.cp-round-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    color: #ffffff;
    flex-shrink: 0;
}

.cp-form-list {
    list-style: none;
    padding: 0;
    margin: 0;
    background: #ffffff;
}

.cp-form-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px 10px 24px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
}

.cp-form-item:last-child {
    border-bottom: none;
}

.cp-form-item:hover {
    background: #f0f6fc;
}

.cp-form-item.cp-form-active {
    background: #e7f0f9;
    border-left: 3px solid #2271b1;
    padding-left: 21px;
}

.cp-form-status-icon {
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.cp-icon-complete {
    color: #00a32a;
    font-weight: bold;
    font-size: 16px;
}

.cp-icon-not-started {
    color: #999;
    font-size: 16px;
}

.cp-form-title {
    flex: 1;
}

.cp-form-complete .cp-form-title {
    color: #666;
}

/* ─── Form Workspace ────────────────────────────────────────────── */

.cp-form-workspace {
    /* No border, no padding, no radius — the Formaloo form's own dark
       background should fill the entire Elementor container seamlessly. */
    min-height: 400px;
}

.cp-workspace-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    color: #999;
    text-align: center;
}

.cp-workspace-content {
    /* No padding here — it would squeeze the iframe. */
    padding: 0;
}

.cp-workspace-title {
    margin: 0 0 16px;
    padding: 0 20px;       /* title gets its own padding so it's not flush-left */
    font-size: 18px;
}

/* The container that holds the iframe — fills full width. */
.cp-workspace-iframe-container {
    width: 100%;
    box-sizing: border-box;
}

.cp-formaloo-iframe {
    display: block;         /* removes inline element bottom gap */
    width: 100%;
    min-height: 700px;
    border: none;
}

.cp-workspace-complete {
    text-align: center;
    padding: 40px 20px;
}

.cp-complete-message {
    font-size: 16px;
    color: #00a32a;
    margin-bottom: 16px;
}

.cp-complete-message .cp-icon-complete {
    font-size: 24px;
    margin-right: 8px;
}

/* ─── Schedule ──────────────────────────────────────────────────── */

.cp-schedule h3 {
    display: none;
}

.cp-session-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cp-session {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}

.cp-session-past {
    opacity: 0.6;
}

.cp-session-date {
    flex: 1;
    font-weight: 600;
}

/* ─── Tabs (Aggregated Answers) ─────────────────────────────────── */

.cp-tab-toggle {
    display: none;
    width: 100%;
    padding: 10px 16px;
    background: #f9cf2a;
    font-family: Akshar, sans-serif !important;
    font-size: 14px !important;
    color: #000000 !important;
    border: none;
    box-shadow: 3px 3px 0px 0px #757575 !important;
    cursor: pointer;
    text-align: left;
    align-items: center;
    gap: 8px;
}

.cp-tab-toggle-icon {
    font-size: 18px;
    line-height: 1;
}

.cp-tab-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    border-bottom: none;
    margin-bottom: 16px;
}

.cp-tab-btn {
    /*padding: 8px 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;*/
    background: #f9cf2a;
    font-family: Akshar, sans-serif !important;
    font-size: 14px !important;
    color: #000000 !important;
    box-shadow: 3px 3px 0px 0px #757575 !important;
    border: none;
}

.cp-tab-btn:hover {
    color: #2271b1;
}

.cp-tab-btn.cp-tab-active {
    color: #2271b1 !important;
    border-bottom-color: #2271b1;
    font-weight: 600 !important;
}

.cp-tab-panel {
    display: none;
    min-width: 0;
    overflow: hidden;
}

.cp-tab-panel.cp-tab-panel-active {
    display: block;
}

/* ─── Answers Table ─────────────────────────────────────────────── */

.cp-aggregated {
    min-width: 0;               /* allow shrinking inside flex/grid parents */
    overflow: hidden;           /* hard boundary — nothing escapes */
}

.cp-answers-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;        /* columns honour assigned widths */
}

.cp-answers-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    vertical-align: top;
    overflow-wrap: break-word;
    word-break: break-word;
}

.cp-answer-q {
    font-weight: 600;
    width: 40%;
    color: #333;
}

.cp-answer-a {
    color: #555;
}

.cp-answers-side-by-side {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    min-width: 0;
}

.cp-answers-column {
    min-width: 0;               /* prevent grid child from overflowing */
    overflow: hidden;
}

.cp-answers-column h4 {
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0e0e0;
}

.cp-no-data {
    color: #999;
    font-style: italic;
}

.cp-pdf-link {
    margin-top: 16px;
}

/* ─── Documents (Roadmap / Accountability Plan) ─────────────────── */

.cp-doc-content {
    min-height: 200px;
    padding: 16px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fff;
    line-height: 1.6;
    outline: none;
}

.cp-doc-content:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

.cp-doc-content h4 {
    margin: 16px 0 8px;
    color: #333;
}

.cp-doc-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.cp-doc-status {
    font-size: 13px;
    margin-left: 8px;
}

.cp-doc-status-success {
    color: #00a32a;
}

.cp-doc-status-error {
    color: #d63638;
}

.cp-doc-empty {
    color: #999;
    font-style: italic;
    padding: 20px;
    text-align: center;
    background: #f9f9f9;
    border-radius: 6px;
}

/* ─── Login Error ────────────────────────────────────────────────── */

.cp-login-error {
    padding: 12px 16px;
    margin-bottom: 16px;
    background: #fce4e4;
    border: 1px solid #d63638;
    border-radius: 4px;
    color: #8b1a1a;
    font-size: 14px;
    text-align: center;
}

/* ─── Document Sections (Roadmap / Accountability Plan Sections) ── */

.cp-doc-section {
    padding: 20px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 24px;
}

.cp-doc-section-item {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.cp-doc-section-item:last-child {
    border-bottom: none;
}

.cp-doc-section-answer {
    font-size: 15px;
    color: #333;
    line-height: 1.5;
}

.cp-doc-section-answer.cp-editable {
    outline: none;
    cursor: text;
    border-bottom: 1px dashed #ccc;
    padding-bottom: 2px;
    transition: border-color 0.2s;
}

.cp-doc-section-answer.cp-editable:focus {
    border-bottom-color: #2271b1;
}

/* ─── Document Action Bar ───────────────────────────────────────── */

.cp-doc-actions-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.cp-doc-actions-bar .cp-doc-status {
    font-size: 13px;
    margin-left: 4px;
}

/* ─── Responsive ────────────────────────────────────────────────── */

@media (max-width: 1024px) {

    .cp-answers-side-by-side {
        grid-template-columns: 1fr;
    }

    .cp-session {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    /* Stack answer rows vertically on narrow screens */
    .cp-answers-table,
    .cp-answers-table tbody,
    .cp-answers-table tr,
    .cp-answers-table td {
        display: block;
        width: 100%;
    }

    .cp-answers-table tr {
        padding: 8px 0;
        border-bottom: 1px solid #eee;
    }

    .cp-answers-table td {
        border-bottom: none;
        padding: 4px 12px;
    }

    .cp-answer-q {
        width: 100%;
        padding-bottom: 2px;
    }

    .cp-answer-a {
        width: 100%;
    }

    .cp-tab-nav {
        display: none;
        flex-direction: column;
        gap: 0;
        margin-bottom: 0;
    }

    .cp-tab-nav.cp-tab-nav-open {
        display: flex;
    }

    .cp-tab-nav .cp-tab-btn {
        width: 100%;
        text-align: left;
        box-shadow: none !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    }

    .cp-tab-toggle {
        display: flex;
        margin-bottom: 16px;
    }

    .cp-tab-toggle[aria-expanded="true"] {
        box-shadow: 3px 0px 0px 0px #757575 !important;
        margin-bottom: 0;
    }

    .cp-tab-nav.cp-tab-nav-open {
        display: flex;
        margin-bottom: 16px;
    }

    /* Social link edit rows stack on narrow screens */
    .cp-social-edit-row {
        flex-wrap: wrap;
    }

    .cp-social-edit-row select.cp-social-platform {
        width: 100%;
    }

    .cp-social-edit-row input.cp-social-url {
        flex: 1 1 calc(100% - 40px);
    }

    /* Avatar edit stacks vertically */
    .cp-avatar-edit {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .cp-avatar-controls {
        justify-content: center;
    }
}
