/* ================================================================
   change_management.css — Phase 26 ADKAR module
   Prefix: cm-   Primary: #0071e3   Radius: 12px
   ================================================================ */

/* ── Keyframes ───────────────────────────────────────────────── */
@keyframes cmToastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(8px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes cmFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Container & Header ──────────────────────────────────────── */
.cm-container {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    animation: cmFadeIn 0.2s ease;
}

.cm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

.cm-title {
    font-size: 22px;
    font-weight: 700;
    color: #1c1c1e;
    margin: 0;
}

.cm-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Cards Grid ──────────────────────────────────────────────── */
.cm-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* ── Card ────────────────────────────────────────────────────── */
.cm-card {
    background: #ffffff;
    border: 1px solid #e5e5ea;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: box-shadow 0.2s ease, transform 0.15s ease;
    cursor: default;
}

.cm-card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.09);
    transform: translateY(-1px);
}

.cm-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.cm-card-title {
    font-size: 15px;
    font-weight: 600;
    color: #1c1c1e;
    margin: 0;
    line-height: 1.4;
}

.cm-card-desc {
    font-size: 13px;
    color: #6e6e73;
    margin: 0;
    line-height: 1.5;
}

.cm-card-date {
    font-size: 12px;
    color: #8e8e93;
    white-space: nowrap;
}

.cm-card-meta {
    font-size: 12px;
    color: #8e8e93;
}

.cm-card-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: auto;
    padding-top: 4px;
}

/* ── Status Badges ───────────────────────────────────────────── */
.cm-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.cm-badge-planning {
    background: #f2f2f7;
    color: #636366;
}

.cm-badge-active {
    background: #e8f4fd;
    color: #0071e3;
}

.cm-badge-paused {
    background: #fff8e6;
    color: #c47700;
}

.cm-badge-completed {
    background: #eafaf1;
    color: #28a745;
}

.cm-badge-cancelled {
    background: #fff0f0;
    color: #c0392b;
}

.cm-badge-resistance {
    background: #fff0f0;
    color: #c0392b;
    font-size: 11px;
}

/* ── ADKAR Mini (card preview) ───────────────────────────────── */
.cm-adkar-mini {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: 8px 0 4px;
}

.cm-adkar-mini-label {
    font-size: 11px;
    font-weight: 600;
    color: #8e8e93;
    letter-spacing: 0.5px;
    margin-right: 2px;
    align-self: center;
}

.cm-mini-bar-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.cm-mini-bar-track {
    width: 18px;
    height: 32px;
    background: #f2f2f7;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
}

.cm-mini-bar-fill {
    width: 100%;
    border-radius: 4px;
    transition: height 0.3s ease;
    min-height: 2px;
}

.cm-mini-bar-lbl {
    font-size: 10px;
    font-weight: 600;
    color: #8e8e93;
}

.cm-mini-bar-wrap.cm-adkar-barrier .cm-mini-bar-track {
    border: 2px solid #ff3b30;
    border-radius: 4px;
}

/* ── ADKAR Bar Chart (detail view) ──────────────────────────── */
.cm-adkar-bar-container {
    margin: 12px 0;
}

.cm-adkar-bars {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    height: 160px;
    padding: 0 8px;
}

.cm-adkar-bar-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.cm-adkar-bar-wrap.cm-adkar-barrier {
    position: relative;
}

.cm-adkar-bar-wrap.cm-adkar-barrier .cm-adkar-bar-track {
    border: 2px solid #ff3b30;
    border-radius: 8px;
}

.cm-adkar-bar-track {
    width: 100%;
    max-width: 60px;
    height: 120px;
    background: #f2f2f7;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
}

.cm-adkar-bar-fill {
    width: 100%;
    border-radius: 6px;
    transition: height 0.4s ease;
    min-height: 4px;
}

.cm-adkar-bar-score {
    font-size: 13px;
    font-weight: 700;
    color: #1c1c1e;
}

.cm-adkar-bar-label {
    font-size: 12px;
    font-weight: 700;
    color: #636366;
    letter-spacing: 0.5px;
}

/* ── Score Colors ────────────────────────────────────────────── */
.cm-score-red    { background: #ff3b30; }
.cm-score-orange { background: #ff9500; }
.cm-score-blue   { background: #0071e3; }
.cm-score-green  { background: #34c759; }
.cm-score-empty  { background: #d1d1d6; }

/* ── Barrier notice ──────────────────────────────────────────── */
.cm-barrier-notice {
    font-size: 13px;
    color: #c0392b;
    background: #fff0f0;
    border: 1px solid #ffcdd2;
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 12px;
}

.cm-adkar-meta,
.cm-adkar-meta-empty {
    font-size: 12px;
    color: #8e8e93;
    margin: 8px 0 0;
}

/* ── Detail View ─────────────────────────────────────────────── */
.cm-detail-card {
    background: #ffffff;
    border: 1px solid #e5e5ea;
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.cm-detail-top {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cm-detail-heading {
    font-size: 20px;
    font-weight: 700;
    color: #1c1c1e;
    margin: 0;
    line-height: 1.3;
}

.cm-detail-section {
    padding-top: 16px;
    border-top: 1px solid #f2f2f7;
}

.cm-detail-title {
    font-size: 15px;
    font-weight: 700;
    color: #1c1c1e;
    margin-bottom: 12px;
}

.cm-fields-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.cm-field-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cm-field-label {
    font-size: 11px;
    font-weight: 600;
    color: #8e8e93;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cm-field-value {
    font-size: 14px;
    color: #1c1c1e;
    line-height: 1.5;
}

/* ── Communication Plan ──────────────────────────────────────── */
.cm-comm-plan {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cm-comm-item {
    display: grid;
    grid-template-columns: 90px 120px 1fr auto;
    gap: 8px;
    align-items: start;
    padding: 10px 12px;
    background: #f9f9fb;
    border-radius: 8px;
    font-size: 13px;
}

.cm-comm-date {
    color: #8e8e93;
    font-size: 12px;
}

.cm-comm-channel {
    font-weight: 500;
    color: #0071e3;
}

.cm-comm-msg {
    color: #1c1c1e;
    line-height: 1.4;
}

.cm-comm-audience {
    color: #636366;
    font-size: 12px;
    white-space: nowrap;
}

/* ── Resistance Log ──────────────────────────────────────────── */
.cm-resistance-log {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cm-resistance-item {
    padding: 10px 12px;
    background: #fff8f8;
    border: 1px solid #ffe0e0;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cm-resistance-date {
    font-size: 12px;
    color: #8e8e93;
}

.cm-resistance-desc {
    font-size: 13px;
    color: #1c1c1e;
    line-height: 1.4;
}

.cm-resistance-action {
    font-size: 12px;
    color: #28a745;
    font-style: italic;
}

/* ── AI Box ──────────────────────────────────────────────────── */
.cm-ai-box {
    background: #f0f7ff;
    border: 1px solid #bee3fc;
    border-radius: 12px;
    padding: 16px;
}

.cm-ai-box-title {
    font-size: 14px;
    font-weight: 700;
    color: #0071e3;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cm-ai-box-title::before {
    content: '✦';
    font-size: 12px;
}

.cm-ai-content {
    font-size: 14px;
    color: #1c1c1e;
    line-height: 1.6;
}

.cm-ai-content h2,
.cm-ai-content h3,
.cm-ai-content h4 {
    font-size: 14px;
    font-weight: 700;
    margin: 10px 0 4px;
    color: #1c1c1e;
}

.cm-ai-content ul {
    padding-left: 18px;
    margin: 4px 0;
}

.cm-ai-content li {
    margin-bottom: 4px;
}

.cm-ai-content p {
    margin: 4px 0;
}

/* ── Modal ───────────────────────────────────────────────────── */
.cm-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
    animation: cmFadeIn 0.15s ease;
}

.cm-modal {
    background: #ffffff;
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
    overflow: hidden;
}

.cm-modal-wide {
    max-width: 600px;
}

.cm-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid #f2f2f7;
    flex-shrink: 0;
}

.cm-modal-title {
    font-size: 17px;
    font-weight: 700;
    color: #1c1c1e;
}

.cm-modal-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #8e8e93;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s;
    line-height: 1;
}

.cm-modal-close:hover {
    background: #f2f2f7;
    color: #1c1c1e;
}

.cm-modal-body {
    padding: 18px 20px;
    overflow-y: auto;
    flex: 1;
}

.cm-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px 18px;
    border-top: 1px solid #f2f2f7;
    flex-shrink: 0;
}

/* ── Forms ───────────────────────────────────────────────────── */
.cm-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.cm-form-group:last-child {
    margin-bottom: 0;
}

.cm-form-row {
    display: flex;
    gap: 12px;
}

.cm-form-half {
    flex: 1;
    min-width: 0;
}

.cm-label {
    font-size: 13px;
    font-weight: 600;
    color: #1c1c1e;
}

.cm-input,
.cm-textarea,
.cm-select {
    width: 100%;
    border: 1px solid #d1d1d6;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    color: #1c1c1e;
    background: #ffffff;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
    font-family: inherit;
}

.cm-input:focus,
.cm-textarea:focus,
.cm-select:focus {
    outline: none;
    border-color: #0071e3;
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

.cm-textarea {
    resize: vertical;
    min-height: 72px;
}

.cm-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238e8e93' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

/* ── ADKAR Survey Form ───────────────────────────────────────── */
.cm-adkar-survey-intro {
    font-size: 13px;
    color: #636366;
    margin: 0 0 16px;
    line-height: 1.5;
}

.cm-adkar-survey {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.cm-adkar-question {
    border: 1px solid #e5e5ea;
    border-radius: 12px;
    padding: 14px;
}

.cm-adkar-q-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.cm-adkar-q-letter {
    width: 32px;
    height: 32px;
    background: #0071e3;
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}

.cm-adkar-q-info {
    flex: 1;
    min-width: 0;
}

.cm-adkar-q-title {
    font-size: 14px;
    font-weight: 600;
    color: #1c1c1e;
    margin-bottom: 3px;
}

.cm-adkar-q-desc {
    font-size: 12px;
    color: #6e6e73;
    line-height: 1.4;
}

.cm-adkar-q-scale {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 6px;
}

.cm-scale-option {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.cm-scale-option input[type="radio"] {
    display: none;
}

.cm-scale-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #d1d1d6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: #636366;
    transition: all 0.15s ease;
    user-select: none;
    background: #ffffff;
}

.cm-scale-option:hover .cm-scale-btn {
    border-color: #0071e3;
    color: #0071e3;
    background: #f0f7ff;
}

.cm-scale-option input[type="radio"]:checked + .cm-scale-btn {
    background: #0071e3;
    border-color: #0071e3;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 113, 227, 0.35);
}

.cm-adkar-q-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #8e8e93;
    padding: 0 4px;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.cm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.15s ease, opacity 0.15s ease, transform 0.1s ease;
    white-space: nowrap;
    font-family: inherit;
    line-height: 1;
    text-decoration: none;
}

.cm-btn:active {
    transform: scale(0.97);
}

.cm-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.cm-btn-primary {
    background: #0071e3;
    color: #ffffff;
}

.cm-btn-primary:hover:not(:disabled) {
    background: #005ec2;
}

.cm-btn-secondary {
    background: #f2f2f7;
    color: #1c1c1e;
}

.cm-btn-secondary:hover:not(:disabled) {
    background: #e5e5ea;
}

.cm-btn-danger {
    background: #fff0f0;
    color: #c0392b;
}

.cm-btn-danger:hover:not(:disabled) {
    background: #ffd5d5;
}

/* ── Empty State ─────────────────────────────────────────────── */
.cm-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    text-align: center;
    color: #8e8e93;
}

.cm-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.cm-empty p {
    font-size: 16px;
    font-weight: 600;
    color: #636366;
    margin: 0 0 8px;
}

.cm-empty-sub {
    font-size: 13px;
    color: #8e8e93;
    margin: 0;
    max-width: 320px;
    line-height: 1.5;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 640px) {
    .cm-container {
        padding: 12px;
    }

    .cm-header {
        flex-direction: column;
        align-items: stretch;
    }

    .cm-header-actions {
        flex-direction: column;
    }

    .cm-btn {
        width: 100%;
        justify-content: center;
    }

    .cm-cards-grid {
        grid-template-columns: 1fr;
    }

    .cm-form-row {
        flex-direction: column;
    }

    .cm-comm-item {
        grid-template-columns: 1fr;
    }

    .cm-adkar-bars {
        gap: 8px;
        height: 120px;
    }

    .cm-adkar-bar-track {
        height: 80px;
    }

    .cm-adkar-q-scale {
        gap: 4px;
    }

    .cm-scale-btn {
        width: 36px;
        height: 36px;
        font-size: 13px;
    }

    .cm-fields-row {
        grid-template-columns: 1fr;
    }

    .cm-detail-card {
        padding: 16px;
    }

    .cm-modal {
        max-height: 95vh;
    }
}

@media (max-width: 400px) {
    .cm-adkar-bars {
        gap: 4px;
    }

    .cm-adkar-bar-label {
        font-size: 11px;
    }

    .cm-scale-btn {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }
}
