/* ===========================================
   CPD MANAGEMENT STYLES — ADDITIONS TO record-edit.css
   Append to END of record-edit.css (or load as separate file)
   =========================================== */


/* --- Page-level accent: blue for CPD --- */
.page-cpd {
    --re-accent: #5e35b1;
    --re-accent-light: #ede7f6;
    --re-accent-dark: #4527a0;
}


/* ========================================
   CPD HEADER (title + action buttons)
   ======================================== */

.re-cpd-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

.re-btn-export {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.7rem 1.25rem;
    background: var(--re-card-bg);
    color: var(--re-success);
    border: 2px solid var(--re-success);
    border-radius: var(--re-radius);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.re-btn-export:hover:not(:disabled) {
    background: #e8f5e9;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.re-btn-export:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}


/* ========================================
   CPD MAIN LAYOUT (card grid + detail)
   ======================================== */

.re-cpd-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 16px;
    min-height: 500px;
    margin-bottom: 1.25rem;
}

@media (max-width: 1024px) {
    .re-cpd-layout {
        grid-template-columns: 320px 1fr;
    }
}

@media (max-width: 768px) {
    .re-cpd-layout {
        grid-template-columns: 1fr;
    }
}


/* ========================================
   CPD EVENT CARD GRID (left panel)
   ======================================== */

.re-cpd-card-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    max-height: calc(100vh - 320px);
    padding: 4px;
}

/* Scrollbar — matches re-school-grid */
.re-cpd-card-grid::-webkit-scrollbar {
    width: 6px;
}
.re-cpd-card-grid::-webkit-scrollbar-track {
    background: #f1f3f5;
    border-radius: 3px;
}
.re-cpd-card-grid::-webkit-scrollbar-thumb {
    background: #ced4da;
    border-radius: 3px;
}
.re-cpd-card-grid::-webkit-scrollbar-thumb:hover {
    background: #adb5bd;
}

@media (max-width: 768px) {
    .re-cpd-card-grid {
        max-height: 300px;
    }
}

/* Individual event card — follows re-school-list-card pattern */
.re-event-card {
    background: var(--re-card-bg);
    border: 1px solid var(--re-border);
    border-left: 4px solid var(--re-border);
    border-radius: 8px;
    padding: 12px 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.re-event-card:hover {
    border-left-color: var(--re-accent);
    background: var(--re-accent-light);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.re-event-card.re-event-selected {
    border-left-color: var(--re-accent);
    background: var(--re-accent-light);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.re-event-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.re-event-type-badge {
    display: inline-block;
    padding: 2px 10px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--re-accent);
    background: var(--re-accent-light);
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.re-event-status-badge {
    display: inline-block;
    padding: 2px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.re-event-status-upcoming {
    background: var(--re-accent-light);
    color: var(--re-accent);
}

.re-event-status-active {
    background: #e8f5e9;
    color: #2e7d32;
}

.re-event-status-completed {
    background: var(--re-bg);
    color: var(--re-text-muted);
}

.re-event-card-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--re-text);
    margin: 0 0 6px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.re-event-card-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 8px;
    font-size: 0.78rem;
    color: var(--re-text-muted);
}

.re-event-card-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.re-event-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 8px;
    border-top: 1px solid var(--re-border);
    font-size: 0.78rem;
    color: var(--re-text-muted);
}

.re-event-participant-split {
    font-size: 0.72rem;
    color: #adb5bd;
}


/* ========================================
   CPD DETAIL PANEL (right)
   ======================================== */

.re-cpd-detail {
    background: var(--re-card-bg);
    border-radius: var(--re-radius);
    box-shadow: var(--re-shadow);
    border-top: 5px solid var(--re-accent);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 320px);
}

@media (max-width: 768px) {
    .re-cpd-detail {
        max-height: none;
    }
}

.re-cpd-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1.25rem 1.5rem;
    border-bottom: 2px solid var(--re-border);
    gap: 12px;
}

.re-cpd-detail-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--re-text);
    margin: 0 0 4px;
    line-height: 1.3;
}

.re-cpd-detail-type {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--re-accent);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.re-cpd-detail-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.re-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--re-border);
    border-radius: 8px;
    background: var(--re-card-bg);
    color: var(--re-text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.88rem;
}

.re-btn-icon:hover {
    background: var(--re-accent-light);
    color: var(--re-accent);
    border-color: var(--re-accent);
}

.re-btn-icon-danger:hover {
    background: #fbe9e7;
    color: var(--re-danger);
    border-color: var(--re-danger);
}


/* ========================================
   CPD TABS (native, matching re-tabs style)
   ======================================== */

.re-cpd-tabs {
    display: flex;
    border-bottom: 2px solid var(--re-border);
    padding: 0 1.5rem;
    background: var(--re-bg);
}

.re-cpd-tab {
    font-weight: 500;
    font-size: 0.95rem;
    padding: 10px 20px;
    color: var(--re-text-muted);
    border: none;
    background: transparent;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.re-cpd-tab:hover {
    color: var(--re-accent);
    background-color: var(--re-accent-light);
    border-radius: 8px 8px 0 0;
}

.re-cpd-tab.re-cpd-tab-active {
    color: var(--re-accent);
    font-weight: 600;
    border-bottom-color: var(--re-accent);
}

.re-cpd-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: var(--re-bg);
    border-radius: 11px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--re-text-muted);
}

.re-cpd-tab.re-cpd-tab-active .re-cpd-tab-count {
    background: var(--re-accent-light);
    color: var(--re-accent);
}


/* ========================================
   CPD DETAIL CONTENT AREA
   ======================================== */

.re-cpd-detail-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 1.5rem;
}

/* Scrollbar */
.re-cpd-detail-content::-webkit-scrollbar {
    width: 6px;
}
.re-cpd-detail-content::-webkit-scrollbar-track {
    background: #f1f3f5;
    border-radius: 3px;
}
.re-cpd-detail-content::-webkit-scrollbar-thumb {
    background: #ced4da;
    border-radius: 3px;
}

/* General tab — field pairs */
.re-cpd-field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 24px;
}

.re-cpd-field label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--re-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 3px;
}

.re-cpd-field span {
    font-size: 0.95rem;
    color: var(--re-text);
}

.re-cpd-block {
    padding-top: 12px;
    margin-top: 12px;
    border-top: 1px solid var(--re-border);
}

.re-cpd-block label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--re-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 6px;
}

.re-cpd-block p {
    font-size: 0.95rem;
    color: var(--re-text);
    line-height: 1.6;
    margin: 0;
    white-space: pre-wrap;
}

@media (max-width: 768px) {
    .re-cpd-field-grid {
        grid-template-columns: 1fr;
    }
}


/* ========================================
   CPD PARTICIPANT TABLE
   ======================================== */

.re-cpd-participant-bar {
    margin-bottom: 16px;
}

.re-cpd-participant-empty {
    text-align: center;
    color: var(--re-text-muted);
    padding: 2rem;
    font-size: 0.9rem;
    font-style: italic;
}

.re-cpd-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.re-cpd-table th {
    text-align: left;
    padding: 8px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--re-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 2px solid var(--re-border);
}

.re-cpd-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f3f5;
    color: var(--re-text);
    vertical-align: middle;
}

.re-cpd-table tbody tr:hover {
    background: var(--re-bg);
}

.re-cpd-table .re-col-name {
    font-weight: 600;
}

.re-cpd-table .re-col-actions {
    width: 72px;
    text-align: right;
    white-space: nowrap;
}

.re-cpd-status-chip {
    display: inline-block;
    padding: 2px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--re-bg);
    color: var(--re-text-muted);
    border-radius: 12px;
    border: 1px solid var(--re-border);
}

.re-btn-table-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #adb5bd;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.82rem;
}

.re-btn-table-action:hover {
    background: var(--re-accent-light);
    color: var(--re-accent);
}

.re-btn-table-danger:hover {
    background: #fbe9e7;
    color: var(--re-danger);
}


/* ========================================
   CPD STAFF AUTOCOMPLETE
   ======================================== */

.re-autocomplete-wrapper {
    position: relative;
    max-width: 420px;
}

.re-autocomplete-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #adb5bd;
    font-size: 0.88rem;
    pointer-events: none;
    z-index: 1;
}

.re-autocomplete-input {
    width: 100%;
    padding: 0.7rem 2.5rem 0.7rem 2.5rem;
    border: 2px solid var(--re-border);
    border-radius: var(--re-radius);
    font-size: 0.95rem;
    color: var(--re-text);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background-color: var(--re-card-bg);
}

    .re-autocomplete-input:focus {
        border-color: var(--re-accent);
        box-shadow: 0 0 0 3px rgba(94, 53, 177, 0.12);
    }

.re-autocomplete-input::placeholder {
    color: #adb5bd;
}

.re-autocomplete-spinner {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
}

.re-spinner-sm {
    width: 18px;
    height: 18px;
    border: 2px solid var(--re-border);
    border-top-color: var(--re-accent);
    border-radius: 50%;
    animation: re-spin 0.7s linear infinite;
}

@keyframes re-spin {
    to { transform: rotate(360deg); }
}

.re-autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    margin-top: 4px;
    background: var(--re-card-bg);
    border: 1px solid #dee2e6;
    border-radius: var(--re-radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    max-height: 280px;
    overflow-y: auto;
}

.re-autocomplete-item {
    padding: 10px 14px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-bottom: 1px solid #f1f3f5;
}

.re-autocomplete-item:last-child {
    border-bottom: none;
}

.re-autocomplete-item:hover {
    background-color: var(--re-accent-light);
}

.re-autocomplete-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--re-text);
}

.re-autocomplete-detail {
    font-size: 0.78rem;
    color: var(--re-text-muted);
}


/* ========================================
   CPD MODALS (matches re-confirm-overlay)
   ======================================== */

.re-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: re-overlay-fade-in 0.2s ease;
}

.re-modal-panel {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: re-dialog-scale-in 0.2s ease;
}

.re-modal-large {
    max-width: 720px;
}

.re-modal-small {
    max-width: 440px;
}

.re-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 2px solid var(--re-border);
}

.re-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--re-text);
}

.re-modal-header-danger h3 {
    color: var(--re-danger);
}

.re-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--re-text-muted);
    cursor: pointer;
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.15s ease;
}

.re-modal-close:hover {
    background: var(--re-bg);
    color: var(--re-text);
}

.re-modal-body {
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
    flex: 1;
    max-height: calc(85vh - 140px);
}

.re-modal-body p {
    margin: 0 0 8px;
    font-size: 0.9rem;
    color: var(--re-text);
    line-height: 1.5;
}

.re-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 1rem 1.5rem;
    border-top: 2px solid var(--re-border);
    background: var(--re-bg);
    flex-shrink: 0;
}


/* ========================================
   CPD FORM INPUTS (native — no DevExpress)
   ======================================== */

.re-cpd-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 24px;
}

.re-cpd-form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.re-cpd-form-group.re-form-full-width {
    grid-column: 1 / -1;
}

.re-cpd-form-group label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--re-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.re-cpd-input,
input.re-cpd-input,
select.re-cpd-input,
textarea.re-cpd-input {
    padding: 0.55rem 0.85rem;
    border: 2px solid var(--re-border);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--re-text);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: var(--re-card-bg);
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
}

    .re-cpd-input:focus {
        border-color: var(--re-accent);
        box-shadow: 0 0 0 3px rgba(94, 53, 177, 0.12);
    }

.re-cpd-textarea {
    resize: vertical;
    min-height: 60px;
}

/* Blazor validation messages */
.re-cpd-form-group .validation-message {
    color: var(--re-danger);
    font-size: 0.78rem;
    margin-top: 2px;
}

@media (max-width: 768px) {
    .re-cpd-form-grid {
        grid-template-columns: 1fr;
    }
}


/* ========================================
   CPD TOAST NOTIFICATIONS
   ======================================== */

.re-toast-stack {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.re-toast-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.85rem 1.25rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    min-width: 300px;
    max-width: 420px;
    pointer-events: all;
    animation: re-toast-in 0.3s ease;
    background: #2c3e50;
    color: #fff;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

@keyframes re-toast-in {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.re-toast-success {
    background: #2c3e50;
    border-left: 4px solid var(--re-success);
}

.re-toast-error {
    background: #2c3e50;
    border-left: 4px solid var(--re-danger);
}

.re-toast-warning {
    background: #2c3e50;
    border-left: 4px solid #f39c12;
}

.re-toast-info {
    background: #2c3e50;
    border-left: 4px solid var(--re-accent);
}

.re-toast-item span:first-child {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.re-toast-item span:nth-child(2) {
    flex: 1;
}

.re-toast-dismiss {
    background: none;
    border: none;
    color: #95a5a6;
    cursor: pointer;
    padding: 4px;
    font-size: 0.88rem;
    flex-shrink: 0;
    transition: color 0.15s ease;
}

    .re-toast-dismiss:hover {
        color: #fff;
    }
