/*
 * Plugin Problem — CSS principal
 * Oculta accordion nativo de Análise + estilos PDCA
 */

/* ─── Ocultar accordion "Análise" nativo do GLPI para Problem ─── */
body.problem #analysis,
body.problem #analysis-heading,
body.problem [id="analysis-heading"],
body.problem [aria-controls="analysis"] {
    display: none !important;
}

/* fallback: se o body não tiver a classe, seleciona pelo contexto */
.itil-left-side #analysis,
.itil-left-side #analysis-heading {
    display: none !important;
}

/* ─── Estilos gerais das abas do plugin ─── */
.pp-root { padding: 1.5rem; }
.pp-root .p-2, .pp-root .p-3 { padding: 0 !important; }
.pp-root ~ h3, .pp-root .tab-content h3:first-of-type { display: none !important; }

.pp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--main-detach-color);
}
.pp-header-left { display: flex; align-items: center; gap: 10px; }
.pp-header-left h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0;
}

.pp-card {
    background: var(--sp-light-color);
    border: 0.5px solid var(--main-detach-color);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
}

.pp-section-label {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--main-counter-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pp-textarea {
    width: 100%;
    padding: 0.75rem 0.9rem;
    border: 0.5px solid var(--main-detach-color);
    border-radius: 7px;
    background: #fff;
    color: inherit;
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    min-height: 110px;
    outline: none;
    transition: border-color 0.2s;
}
.pp-textarea:focus { border-color: var(--main-primary-color); }

.pp-btn-save {
    background: var(--main-primary-color);
    color: var(--main-primary-color-text);
    border: none;
    border-radius: 7px;
    padding: 0.65rem 2rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}
.pp-btn-save:hover { background: var(--main-primary-color-hover); }
.pp-btn-save:disabled {
    background: var(--main-detach-color);
    color: var(--main-counter-color);
    cursor: not-allowed;
}

.pp-loader {
    position: fixed;
    top: 0; left: 0;
    height: 2px;
    width: 100%;
    background: var(--main-primary-color);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
    z-index: 9999;
}

/* ─── PDCA Timeline ─── */
.pdca-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
    padding-left: 24px;
}

.pdca-timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 16px;
    bottom: 16px;
    width: 2px;
    background: var(--main-detach-color);
}

.pdca-step {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.75rem 0;
    position: relative;
}

.pdca-step-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
    z-index: 1;
    transition: all 0.3s;
}

.pdca-step-icon.done {
    background: #10b981;
    color: #fff;
}
.pdca-step-icon.active {
    background: var(--main-primary-color);
    color: var(--main-primary-color-text);
    box-shadow: 0 0 0 4px rgba(var(--main-primary-color-rgb, 59, 130, 246), 0.2);
}
.pdca-step-icon.pending {
    background: var(--main-detach-color);
    color: var(--main-counter-color);
}

.pdca-step-body { flex: 1; }
.pdca-step-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 2px;
}
.pdca-step-desc {
    font-size: 0.8rem;
    color: var(--main-counter-color);
}

.pdca-step-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 8px;
}
.pdca-step-badge.done { background: #d1fae5; color: #065f46; }
.pdca-step-badge.active { background: #dbeafe; color: #1e40af; }
.pdca-step-badge.pending { background: #f3f4f6; color: #6b7280; }

/* ─── PDCA Phase Headers ─── */
.pdca-phase-header {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.5rem 0 0.25rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 6px;
}
.pdca-phase-plan { color: #2563eb; }
.pdca-phase-do { color: #16a34a; }
.pdca-phase-check { color: #eab308; }
.pdca-phase-act { color: #dc2626; }

/* ─── Progress Bar ─── */
.pdca-progress-wrap {
    height: 6px;
    background: var(--main-detach-color);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}
.pdca-progress-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, #2563eb, #10b981);
    transition: width 0.5s ease;
}

/* ─── Accept Button ─── */
.pp-btn-accept {
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 7px;
    padding: 0.6rem 1.5rem;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}
.pp-btn-accept:hover { background: #1d4ed8; }

/* ─── Change Integration ─── */
.pp-btn-change {
    background: #16a34a;
    color: #fff;
    border: none;
    border-radius: 7px;
    padding: 0.6rem 1.5rem;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    transition: background 0.2s;
}
.pp-btn-change:hover { background: #15803d; color: #fff; }

.pp-change-list {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0 0;
}
.pp-change-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.5rem 0;
    border-bottom: 0.5px solid var(--main-detach-color);
    font-size: 0.88rem;
}
.pp-change-item:last-child { border-bottom: none; }
.pp-change-link {
    font-weight: 700;
    color: var(--main-primary-color);
    text-decoration: none;
}
.pp-change-link:hover { text-decoration: underline; }

/* ─── Accepted info ─── */
.pp-accepted-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.5rem 0.75rem;
    background: #d1fae5;
    border-radius: 7px;
    color: #065f46;
    font-size: 0.85rem;
    font-weight: 600;
}
