/* ==========================================================================
   "My Certificates" front-end dashboard
   All rules namespaced under .cpcg-dashboard to avoid bleeding into the theme.
   ========================================================================== */

.cpcg-dashboard {
    max-width: 1080px;
    margin: 0 auto;
    padding: 24px 0;
    color: #1d1d1f;
    font-size: 15px;
    line-height: 1.5;
}

.cpcg-dashboard *,
.cpcg-dashboard *::before,
.cpcg-dashboard *::after {
    box-sizing: border-box;
}

/* ---------- Header ---------- */
.cpcg-dashboard__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e5e7;
    margin-bottom: 20px;
}

.cpcg-dashboard__title {
    margin: 0 0 4px;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.2;
}

.cpcg-dashboard__subtitle {
    margin: 0;
    color: #555;
    font-size: 14px;
}

.cpcg-dashboard__count {
    display: inline-block;
    margin-left: 12px;
    padding-left: 12px;
    border-left: 1px solid #ddd;
    color: #555;
}

/* ---------- Filters ---------- */
.cpcg-dashboard__filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    background: #fafafa;
    border: 1px solid #ececec;
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 20px;
}

.cpcg-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 180px;
    min-width: 0;
}

.cpcg-field--actions {
    flex: 0 0 auto;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.cpcg-field__label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #555;
}

.cpcg-dashboard input[type="search"],
.cpcg-dashboard input[type="date"],
.cpcg-dashboard input[type="text"] {
    width: 100%;
    padding: 8px 10px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    color: #1d1d1f;
}

.cpcg-dashboard input:focus {
    outline: 2px solid #2271b1;
    outline-offset: 1px;
    border-color: #2271b1;
}

/* ---------- Buttons ---------- */
.cpcg-button {
    display: inline-block;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    text-decoration: none;
    color: #fff;
    background: #1d1d1f;
    border: 1px solid #1d1d1f;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}

.cpcg-button:hover,
.cpcg-button:focus {
    background: #000;
    color: #fff;
    text-decoration: none;
}

.cpcg-button--secondary {
    background: #fff;
    color: #1d1d1f;
}

.cpcg-button--secondary:hover,
.cpcg-button--secondary:focus {
    background: #1d1d1f;
    color: #fff;
}

.cpcg-button--ghost {
    background: transparent;
    color: #555;
    border-color: transparent;
}

.cpcg-button--ghost:hover,
.cpcg-button--ghost:focus {
    background: #efefef;
    color: #1d1d1f;
}

/* ---------- Table ---------- */
.cpcg-dashboard__table-wrap {
    overflow-x: auto;
    border: 1px solid #ececec;
    border-radius: 8px;
    background: #fff;
}

.cpcg-dashboard__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    margin: 0;
}

.cpcg-dashboard__table th,
.cpcg-dashboard__table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.cpcg-dashboard__table th {
    background: #fafafa;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #555;
}

.cpcg-dashboard__table tbody tr:last-child td {
    border-bottom: 0;
}

.cpcg-dashboard__table tbody tr:hover {
    background: #fafafa;
}

.cpcg-dashboard__table code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    background: #f4f4f5;
    padding: 2px 6px;
    border-radius: 4px;
    color: #1d1d1f;
}

.cpcg-dashboard__table tr.cpcg-row--removing {
    opacity: 0.4;
    pointer-events: none;
}

/* ---------- Action buttons in rows ---------- */
.cpcg-col-actions {
    white-space: nowrap;
    width: 1%;
}

.cpcg-action {
    display: inline-block;
    margin-right: 6px;
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 5px;
    border: 1px solid transparent;
    cursor: pointer;
    background: transparent;
    color: #1d1d1f;
}

.cpcg-action--download {
    color: #1d1d1f;
    border-color: #ddd;
    background: #fff;
}

.cpcg-action--download:hover,
.cpcg-action--download:focus {
    background: #1d1d1f;
    color: #fff;
    border-color: #1d1d1f;
}

.cpcg-action--delete {
    color: #b32d2e;
    border-color: transparent;
    background: transparent;
    font-family: inherit;
}

.cpcg-action--delete:hover,
.cpcg-action--delete:focus {
    background: #fbeaea;
    color: #8a1f20;
}

/* ---------- Empty / login states ---------- */
.cpcg-dashboard__empty {
    padding: 48px 16px;
    text-align: center;
    color: #555;
    background: #fafafa;
    border: 1px dashed #ddd;
    border-radius: 8px;
}

.cpcg-dashboard--gated {
    padding: 32px;
    text-align: center;
    background: #fafafa;
    border: 1px solid #ececec;
    border-radius: 8px;
}

/* ---------- Pagination ---------- */
.cpcg-dashboard__pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 16px;
    justify-content: flex-end;
}

.cpcg-page-link a,
.cpcg-page-link span {
    display: inline-block;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 13px;
    text-decoration: none;
    color: #1d1d1f;
    background: #fff;
}

.cpcg-page-link span.current {
    background: #1d1d1f;
    color: #fff;
    border-color: #1d1d1f;
}

.cpcg-page-link a:hover {
    background: #f4f4f5;
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
    .cpcg-dashboard__header {
        flex-direction: column;
        align-items: stretch;
    }

    .cpcg-dashboard__count {
        margin-left: 0;
        padding-left: 0;
        border-left: 0;
        display: block;
        margin-top: 4px;
    }

    .cpcg-field {
        flex: 1 1 100%;
    }
}

/* ==========================================================================
   Forms inside .cpcg-dashboard
   Used by [certificate_form] and [bulk_certificate_form] so the single,
   bulk and list blocks share one design language.
   ========================================================================== */

.cpcg-dashboard--form {
    /* Inherits .cpcg-dashboard width/margin so all three blocks line up */
}

.cpcg-dashboard .cpcg-form {
    margin: 0;
}

.cpcg-dashboard .form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 18px;
    max-width: 720px;
}

.cpcg-dashboard .form-group label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #555;
    margin: 0;
}

.cpcg-dashboard .form-group input[type="text"],
.cpcg-dashboard .form-group input[type="number"],
.cpcg-dashboard .form-group input[type="date"],
.cpcg-dashboard .form-group input[type="email"],
.cpcg-dashboard .form-group textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    color: #1d1d1f;
    line-height: 1.4;
}

.cpcg-dashboard .form-group input:focus,
.cpcg-dashboard .form-group textarea:focus {
    outline: 2px solid #2271b1;
    outline-offset: 1px;
    border-color: #2271b1;
}

/* The participant-names textarea benefits from monospace —
   each pasted name aligns vertically. Keeping it on purpose. */
.cpcg-dashboard .form-group textarea {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    min-height: 180px;
    resize: vertical;
}

.cpcg-dashboard .helper-text {
    display: block;
    font-size: 12px;
    color: #777;
    margin-top: 2px;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
    font-style: italic;
}

.cpcg-dashboard .form-submit {
    margin-top: 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: flex-start; /* defeat themes that centre form buttons */
    max-width: 720px;            /* line up with .form-group above */
    text-align: left;
}

/* Submit button uses the same look as .cpcg-button so it matches the
   dashboard's Apply / Export CSV / Sign in buttons. */
.cpcg-dashboard .cpcg-submit-button {
    display: inline-block;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    color: #fff;
    background: #1d1d1f;
    border: 1px solid #1d1d1f;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.12s ease, color 0.12s ease;
}

.cpcg-dashboard .cpcg-submit-button:hover,
.cpcg-dashboard .cpcg-submit-button:focus {
    background: #000;
    color: #fff;
}

.cpcg-dashboard .cpcg-submit-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.cpcg-dashboard .cpcg-download-button {
    display: inline-block;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    color: #1d1d1f;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    text-decoration: none;
}

.cpcg-dashboard .cpcg-download-button:hover {
    background: #1d1d1f;
    color: #fff;
    border-color: #1d1d1f;
}

/* Form-level success/error messages (single form) */
.cpcg-dashboard .cpcg-message {
    margin-top: 14px;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
    border: 1px solid transparent;
}

.cpcg-dashboard .cpcg-message.cpcg-success {
    background: #f0f9f4;
    border-color: #c7e6d4;
    color: #166534;
}

.cpcg-dashboard .cpcg-message.cpcg-error {
    background: #fdf2f2;
    border-color: #f7c8c8;
    color: #991b1b;
}

/* Bulk form — progress + results panels reskinned */
.cpcg-dashboard .cpcg-bulk-progress {
    margin-top: 20px;
    padding: 14px;
    background: #fafafa;
    border: 1px solid #ececec;
    border-radius: 8px;
}

.cpcg-dashboard .cpcg-progress-bar {
    height: 10px;
    background: #e5e5e7;
    border-radius: 999px;
    overflow: hidden;
}

.cpcg-dashboard .cpcg-progress-fill {
    height: 100%;
    background: #1d1d1f;
    transition: width 0.3s ease;
}

.cpcg-dashboard .cpcg-progress-text {
    margin: 10px 0 0;
    text-align: center;
    color: #555;
    font-size: 13px;
}

.cpcg-dashboard .cpcg-bulk-results {
    margin-top: 20px;
    padding: 16px;
    background: #f0f9f4;
    border: 1px solid #c7e6d4;
    border-radius: 8px;
}

.cpcg-dashboard .cpcg-bulk-results h3 {
    margin: 0 0 10px;
    color: #166534;
    font-size: 16px;
    font-weight: 600;
}

.cpcg-dashboard .cpcg-download-links {
    margin: 12px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cpcg-dashboard .cpcg-download-links a {
    display: inline-block;
    padding: 6px 12px;
    background: #fff;
    color: #1d1d1f;
    text-decoration: none;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 13px;
}

.cpcg-dashboard .cpcg-download-links a:hover {
    background: #1d1d1f;
    color: #fff;
    border-color: #1d1d1f;
}

.cpcg-dashboard .cpcg-download-links a.cpcg-zip-download {
    background: #1d1d1f;
    color: #fff;
    border-color: #1d1d1f;
    font-weight: 500;
}

.cpcg-dashboard .cpcg-download-links a.cpcg-zip-download:hover {
    background: #000;
}

.cpcg-dashboard .cpcg-errors {
    margin-top: 14px;
    color: #991b1b;
    font-size: 14px;
}

.cpcg-dashboard .cpcg-errors ul {
    margin: 6px 0 0 18px;
}
