/* ============================================================
   8D Problem Solving — Styles
   Phase 27
   ============================================================ */

/* Container */
.ed-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px;
}

/* Header row */
.ed-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.ed-header h2 {
    font-size: 22px;
    color: #1d1d1f;
    margin: 0;
    font-weight: 700;
}

.ed-header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Buttons */
.ed-btn {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.ed-btn-primary {
    background: #0071e3;
    color: white;
}
.ed-btn-primary:hover { background: #005bb5; }

.ed-btn-secondary {
    background: #f3f4f6;
    color: #374151;
}
.ed-btn-secondary:hover { background: #e5e7eb; }

.ed-btn-danger {
    background: #fee2e2;
    color: #dc2626;
}
.ed-btn-danger:hover { background: #fca5a5; }

.ed-btn-ai {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    color: white;
}
.ed-btn-ai:hover { opacity: 0.88; }

.ed-btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.ed-btn-success {
    background: #16a34a;
    color: white;
}
.ed-btn-success:hover { background: #15803d; }

/* ===================== LIST VIEW ===================== */
.ed-list {
    display: grid;
    gap: 12px;
}

.ed-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 16px 20px;
    cursor: pointer;
    transition: box-shadow 0.2s, border-color 0.2s;
    display: flex;
    align-items: center;
    gap: 14px;
}

.ed-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    border-color: #0071e3;
}

.ed-card-number {
    font-size: 12px;
    font-weight: 700;
    color: #6e6e73;
    min-width: 54px;
    text-align: center;
    background: #f3f4f6;
    border-radius: 6px;
    padding: 4px 8px;
    white-space: nowrap;
}

.ed-card-info {
    flex: 1;
    min-width: 0;
}

.ed-card-title {
    font-size: 15px;
    font-weight: 600;
    color: #1d1d1f;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.ed-card-meta {
    font-size: 12px;
    color: #6e6e73;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ===================== STATUS BADGES ===================== */
.ed-status {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.ed-status-draft        { background: #f3f4f6; color: #6b7280; }
.ed-status-d1_team      { background: #dbeafe; color: #1d4ed8; }
.ed-status-d2_problem   { background: #e0e7ff; color: #4338ca; }
.ed-status-d3_containment { background: #fef3c7; color: #b45309; }
.ed-status-d4_analysis  { background: #ffedd5; color: #c2410c; }
.ed-status-d5_actions   { background: #fce7f3; color: #be185d; }
.ed-status-d6_validated { background: #dcfce7; color: #16a34a; }
.ed-status-d7_prevention { background: #d1fae5; color: #065f46; }
.ed-status-completed    { background: #bbf7d0; color: #14532d; }
.ed-status-archived     { background: #e5e7eb; color: #4b5563; }

/* ===================== EMPTY STATE ===================== */
.ed-empty {
    text-align: center;
    padding: 48px 20px;
    color: #6e6e73;
}
.ed-empty-icon { font-size: 52px; margin-bottom: 14px; }
.ed-empty-title { font-size: 17px; font-weight: 600; margin-bottom: 8px; color: #1d1d1f; }
.ed-empty-desc { font-size: 13px; line-height: 1.5; }

/* ===================== DETAIL VIEW ===================== */
.ed-detail {
    background: white;
    border-radius: 16px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

.ed-detail-head {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    color: white;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}

.ed-detail-number {
    font-size: 12px;
    opacity: 0.65;
    margin-bottom: 4px;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.ed-detail-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

.ed-detail-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 13px;
    opacity: 0.8;
}

.ed-detail-meta span { display: flex; align-items: center; gap: 4px; }

/* Progress bar for disciplines */
.ed-progress-bar {
    background: rgba(255,255,255,0.15);
    border-radius: 4px;
    height: 6px;
    margin-top: 12px;
    overflow: hidden;
}
.ed-progress-fill {
    height: 100%;
    background: #4ade80;
    border-radius: 4px;
    transition: width 0.4s ease;
}

/* ===================== DISCIPLINE ACCORDION ===================== */
.ed-disciplines {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ed-discipline {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.ed-discipline.ed-discipline-open {
    border-color: #93c5fd;
    box-shadow: 0 2px 8px rgba(0, 113, 227, 0.1);
}

.ed-discipline-header {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    cursor: pointer;
    background: #fafafa;
    user-select: none;
    gap: 12px;
    transition: background 0.15s;
}

.ed-discipline-header:hover { background: #f0f4ff; }
.ed-discipline-open .ed-discipline-header { background: #eff6ff; }

.ed-discipline-badge {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    flex-shrink: 0;
    color: white;
    letter-spacing: -0.02em;
}

/* Distinct colors for D1–D8 */
.ed-badge-d1 { background: #2563eb; }
.ed-badge-d2 { background: #7c3aed; }
.ed-badge-d3 { background: #d97706; }
.ed-badge-d4 { background: #dc2626; }
.ed-badge-d5 { background: #db2777; }
.ed-badge-d6 { background: #16a34a; }
.ed-badge-d7 { background: #0d9488; }
.ed-badge-d8 { background: #92400e; }

.ed-discipline-title {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: #1d1d1f;
}

.ed-discipline-subtitle {
    font-size: 11px;
    color: #6e6e73;
    font-weight: 400;
    margin-top: 1px;
}

.ed-discipline-status {
    font-size: 11px;
    color: #16a34a;
    font-weight: 600;
}

.ed-discipline-chevron {
    font-size: 12px;
    color: #9ca3af;
    transition: transform 0.25s;
    flex-shrink: 0;
}
.ed-discipline-open .ed-discipline-chevron { transform: rotate(90deg); }

/* Discipline body */
.ed-discipline-body {
    display: none;
    padding: 16px;
    border-top: 1px solid #e5e7eb;
    background: white;
}
.ed-discipline-open .ed-discipline-body { display: block; }

/* Form elements inside discipline */
.ed-form-group {
    margin-bottom: 14px;
}

.ed-form-label {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 5px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ed-form-input,
.ed-form-textarea {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 13px;
    color: #1d1d1f;
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
    background: white;
}

.ed-form-input:focus,
.ed-form-textarea:focus {
    outline: none;
    border-color: #0071e3;
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}

.ed-form-textarea { resize: vertical; min-height: 80px; }

.ed-5w2h-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

@media (max-width: 600px) {
    .ed-5w2h-grid { grid-template-columns: 1fr; }
}

/* Actions list (D3, D5, D6, D7) */
.ed-actions-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.ed-action-item {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 12px;
}

.ed-action-item-content { flex: 1; min-width: 0; }

.ed-action-item-title {
    font-size: 13px;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 3px;
}

.ed-action-item-meta {
    font-size: 11px;
    color: #6e6e73;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.ed-action-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    font-size: 16px;
    padding: 0 2px;
    line-height: 1;
    flex-shrink: 0;
}
.ed-action-remove:hover { color: #dc2626; }

.ed-add-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #0071e3;
    background: none;
    border: 1.5px dashed #93c5fd;
    border-radius: 8px;
    padding: 8px 14px;
    cursor: pointer;
    width: 100%;
    justify-content: center;
    transition: background 0.15s;
}
.ed-add-action-btn:hover { background: #eff6ff; }

/* Inline add-action form */
.ed-add-action-form {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 10px;
    padding: 12px;
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ed-add-action-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
@media (max-width: 480px) {
    .ed-add-action-row { grid-template-columns: 1fr; }
}

/* 5 Whys chain */
.ed-why-chain {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.ed-why-item {
    display: flex;
    gap: 10px;
    align-items: center;
}

.ed-why-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fee2e2;
    color: #dc2626;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ed-why-item input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    font-family: inherit;
    background: white;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.ed-why-item input:focus {
    outline: none;
    border-color: #dc2626;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.1);
}

/* Team member list */
.ed-team-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.ed-team-member {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 8px 12px;
}

.ed-team-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #dbeafe;
    color: #1d4ed8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.ed-team-name { flex: 1; font-size: 13px; font-weight: 600; color: #1d1d1f; }
.ed-team-role { font-size: 11px; color: #6e6e73; }

/* Discipline actions row */
.ed-discipline-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    flex-wrap: wrap;
}

/* AI suggestion box */
.ed-ai-box {
    background: linear-gradient(135deg, #fdf4ff, #fce7f3);
    border: 1px solid #f0abfc;
    border-radius: 10px;
    padding: 12px 14px;
    margin-top: 12px;
}

.ed-ai-box-label {
    font-size: 11px;
    font-weight: 700;
    color: #a21caf;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.ed-ai-box-text {
    font-size: 13px;
    color: #374151;
    line-height: 1.6;
    white-space: pre-wrap;
}

/* Status selector */
.ed-status-select {
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    font-size: 13px;
    font-family: inherit;
    background: white;
    cursor: pointer;
}
.ed-status-select:focus { outline: none; border-color: #0071e3; }

/* Info row */
.ed-info-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}
@media (max-width: 480px) {
    .ed-info-row { grid-template-columns: 1fr; }
}

/* Footer actions */
.ed-detail-footer {
    padding: 16px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    background: #fafafa;
}

.ed-footer-meta {
    font-size: 12px;
    color: #9ca3af;
}

/* Completed indicator */
.ed-completed-mark {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #16a34a;
    font-weight: 600;
}

/* Modal overlay */
.ed-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.ed-modal {
    background: white;
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.ed-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #1d1d1f;
    margin-bottom: 18px;
}

.ed-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Toast notification */
.ed-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #1d1d1f;
    color: white;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    z-index: 9999;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    animation: ed-toast-in 0.25s ease;
}

@keyframes ed-toast-in {
    from { transform: translateY(16px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* Divider */
.ed-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 14px 0;
}

/* Ishikawa placeholder */
.ed-ishikawa-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
@media (max-width: 560px) {
    .ed-ishikawa-grid { grid-template-columns: 1fr; }
}

.ed-ishikawa-category {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 10px 12px;
    background: #fafafa;
}

.ed-ishikawa-cat-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6e6e73;
    margin-bottom: 6px;
}

/* Responsive */
@media (max-width: 640px) {
    .ed-detail-head { padding: 16px; }
    .ed-detail-title { font-size: 16px; }
    .ed-disciplines { padding: 10px; }
    .ed-discipline-header { padding: 12px; }
}
