/* ==========================================================================
   Plugin Change — Timeline + Tabs + Styles
   Rebuilt 2025-07 — Clean, legible, modern horizontal stepper
   ========================================================================== */

/* --------------------------------------------------------------------------
   Timeline — Wrapper
   -------------------------------------------------------------------------- */

#plugin-change-timeline-wrapper {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

/* --------------------------------------------------------------------------
   Timeline — Horizontal stepper container
   -------------------------------------------------------------------------- */

.plugin-change-carousel-viewport {
    flex: 1 1 auto;
    min-width: 0;
    position: relative;
    overflow: hidden;
}

.plugin-change-timeline {
    display: flex;
    align-items: flex-start;
    gap: 0;
    width: max-content;
    transition: transform 0.4s ease;
    transform: translateX(0);
    padding: 16px 8px 12px;
}

.plugin-change-nav-btn {
    z-index: 5;
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity 0.2s ease, transform 0.2s ease;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.plugin-change-nav-btn:hover {
    opacity: 1;
    transform: scale(1.1);
    background: var(--tblr-bg-surface-secondary, #f1f5f9);
}

/* --------------------------------------------------------------------------
   Timeline — Each stage (column)
   -------------------------------------------------------------------------- */

.plugin-change-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 0 0 130px !important;
    min-width: 130px !important;
    max-width: 130px !important;
    padding: 0 6px;
    cursor: default;
    transition: opacity 0.3s ease, filter 0.3s ease;
}

/* Future / pending stages — subdued */
.plugin-change-stage.pending .stage-circle,
.plugin-change-stage.pending .stage-label {
    opacity: 0.5;
}
.plugin-change-stage.pending.is-next .stage-circle,
.plugin-change-stage.pending.is-next .stage-label {
    opacity: 0.85;
}
.plugin-change-stage.done .stage-circle,
.plugin-change-stage.done .stage-label,
.plugin-change-stage.current .stage-circle,
.plugin-change-stage.current .stage-label {
    opacity: 1;
}

/* Non-clickable stages */
.plugin-change-stage:not(.is-next) {
    pointer-events: none;
}

/* Next stage — clickable */
.plugin-change-stage.is-next {
    cursor: pointer !important;
    pointer-events: auto !important;
}
.plugin-change-stage.is-next * {
    pointer-events: auto !important;
}

/* --------------------------------------------------------------------------
   Timeline — Connector line between circles
   -------------------------------------------------------------------------- */

.stage-connector {
    position: absolute;
    top: 20px;
    left: calc(-50% + 20px);
    right: calc(50% + 20px);
    height: 3px;
    border-radius: 2px;
    background: var(--tblr-border-color, #dee2e6);
    z-index: 0;
    transition: background 0.3s ease;
}

.stage-connector.active {
    background: linear-gradient(to right, var(--degrade1), var(--degrade2));
}

/* --------------------------------------------------------------------------
   Timeline — Circle (node)
   -------------------------------------------------------------------------- */

.stage-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    position: relative;
    z-index: 1;
    transition: all 0.25s ease;
    /* Default: pending */
    border: 2px solid var(--tblr-border-color, #dee2e6);
    background: var(--tblr-bg-surface, #fff);
    color: var(--tblr-body-color, #1e293b);
}

/* Done */
.plugin-change-stage.done .stage-circle {
    background: var(--main-primary-color);
    border-color: var(--main-primary-color);
    color: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

/* Current — gradient ring */
.plugin-change-stage.current .stage-circle {
    background: linear-gradient(135deg, var(--degrade1), var(--degrade2));
    border-color: transparent;
    color: #fff;
    box-shadow: 0 0 0 3px var(--main-counter-color, var(--degrade1)),
                0 3px 10px rgba(0,0,0,0.15);
    animation: currentPulse 2s ease-in-out infinite;
}

/* Next — hover ring */
.plugin-change-stage.is-next:hover .stage-circle {
    transform: scale(1.1);
    border-color: var(--degrade1);
    box-shadow: 0 0 0 3px var(--main-counter-color, var(--degrade1)),
                0 4px 12px rgba(0,0,0,0.15);
}

/* --------------------------------------------------------------------------
   Timeline — Labels
   -------------------------------------------------------------------------- */

.stage-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 10px;
    text-align: center;
    gap: 3px;
}

.stage-name {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--tblr-body-color, #1e293b);
    max-width: 110px;
    word-wrap: break-word;
}

.plugin-change-stage.pending .stage-name {
    color: var(--tblr-muted, #6c757d);
}

.stage-desc {
    font-size: 10px;
    line-height: 1.3;
    max-width: 110px;
    display: block;
    color: var(--tblr-muted, #6c757d);
}

/* --------------------------------------------------------------------------
   Timeline — Status badge below label
   -------------------------------------------------------------------------- */

.stage-status-badge {
    font-size: 10px;
    font-weight: 500;
    border-radius: 12px;
    padding: 2px 10px;
    margin-top: 6px;
    min-width: 80px;
    text-align: center;
    /* Default: pending */
    background: var(--tblr-bg-surface-secondary, #f1f5f9);
    border: 1px solid var(--tblr-border-color, #dee2e6);
    color: var(--tblr-muted, #6c757d);
}

.plugin-change-stage.current .stage-status-badge {
    background: rgba(var(--degrade1-rgb, 99,102,241), 0.12);
    border-color: var(--degrade1);
    color: var(--degrade1);
    font-weight: 600;
}

.plugin-change-stage.done .stage-status-badge {
    background: var(--main-primary-color);
    border-color: var(--main-primary-color);
    color: #fff;
}

/* --------------------------------------------------------------------------
   Timeline — Animations
   -------------------------------------------------------------------------- */

.plugin-change-stage.transitioning .stage-circle {
    animation: pulse 0.5s ease;
}

@keyframes pulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes currentPulse {
    0%, 100% { box-shadow: 0 0 0 3px var(--main-counter-color, var(--degrade1)), 0 3px 10px rgba(0,0,0,0.15); }
    50%      { box-shadow: 0 0 0 5px var(--main-counter-color, var(--degrade1)), 0 3px 14px rgba(0,0,0,0.20); }
}

/* --------------------------------------------------------------------------
   Abas (tabs) Impacto e Lista de Controle
   -------------------------------------------------------------------------- */
.plugin-change-tab-content {
    min-height: 300px;
}

.plugin-change-richtext-view {
    min-height: 200px;
    background: var(--main-secondary-color);
    color: var(--main-secondary-color-text);
    font-size: 14px;
    line-height: 1.6;
}


/* --------------------------------------------------------------------------
   Checklist widget (abaixo do TinyMCE nas abas do plugin)
   -------------------------------------------------------------------------- */

.pcc-widget {
    border: 1px solid var(--main-secondary-color-hover);
    border-top: none;
    border-radius: 0 0 6px 6px;
    background: var(--main-secondary-color);
    color: var(--main-secondary-color-text);
    margin-bottom: 16px;
    font-size: 13px;
}

.pcc-widget-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    background: linear-gradient(to right, var(--degrade1), var(--degrade2));
    border-radius: 0 0 6px 6px;
    font-weight: 600;
    color: var(--main-primary-color-text);
    cursor: default;
}

.pcc-widget-header .pcc-toggle-btn {
    padding: 0 4px;
    color: var(--main-primary-color-text);
    line-height: 1;
}

.pcc-widget-body {
    padding: 10px 12px 12px;
    background: var(--main-secondary-color);
}

.pcc-input-row {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.pcc-input-row .pcc-text-input {
    flex: 1;
    background: var(--main-secondary-color);
    color: var(--main-secondary-color-text);
    border-color: var(--main-secondary-color-hover);
}

.pcc-items-list {
    margin-bottom: 6px !important;
}

.pcc-item-row {
    padding: 3px 0;
    font-size: 13px;
    border-bottom: 1px solid var(--main-secondary-color-hover);
    color: var(--main-secondary-color-text);
}

.pcc-item-row:last-child {
    border-bottom: none;
}

.pcc-insert-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--main-secondary-color-hover);
}

/* Configuração do Plugin */
.plugin-change-config p {
    color: var(--main-secondary-color-text);
}

/* Oculta as seções "Análise" e "Planos" nativas do GLPI */
.change-plugin-hide-analysis #analysis,
.change-plugin-hide-analysis #analysis-heading,
.change-plugin-hide-analysis #plans,
.change-plugin-hide-analysis #plans-heading {
    display: none !important;
}

/* --------------------------------------------------------------------------
   Bloqueio estrito do campo Status nativo do GLPI em /front/change.form.php
   -------------------------------------------------------------------------- */
body.change-plugin-hide-analysis select[name="status"],
body.change-plugin-hide-analysis [id^="dropdown_status"],
body.change-plugin-hide-analysis select[name="status"] + .select2,
body.change-plugin-hide-analysis select[name="status"] + .select2-container,
body.change-plugin-hide-analysis .select2-container:has(select[name="status"]),
body.change-plugin-hide-analysis .select2-container:has([id^="dropdown_status"]),
body.change-plugin-hide-analysis [data-select2-id^="select2-dropdown_status"],
body.change-plugin-hide-analysis [id^="select2-dropdown_status"] {
    pointer-events: none !important;
    opacity: 0.7 !important;
    cursor: not-allowed !important;
    user-select: none !important;
}

body.change-plugin-hide-analysis select[name="status"] + .select2 *,
body.change-plugin-hide-analysis select[name="status"] + .select2-container *,
body.change-plugin-hide-analysis .select2-container:has(select[name="status"]) *,
body.change-plugin-hide-analysis [id^="select2-dropdown_status"] * {
    pointer-events: none !important;
    cursor: not-allowed !important;
}

body.change-plugin-hide-analysis label[for^="dropdown_status"],
body.change-plugin-hide-analysis label[for="status"] {
    pointer-events: none !important;
    cursor: default !important;
}

.card-tabs .nav-tabs .nav-link.active {
    border-bottom-color: #ededed !important;
}

/* Cor padrão de títulos nas abas do plugin */
.tab-content .tab-pane h3,
.plugin-change-tab-content h3 {
    color: var(--tblr-heading-color, var(--tblr-body-color, inherit)) !important;
}

/* Badge pulsante para os contadores de pendências das abas */
@keyframes badgePulse {
    0% {
        box-shadow: 0 0 0 0 rgba(245, 159, 0, 0.7);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(245, 159, 0, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(245, 159, 0, 0);
    }
}

.plugin-change-pending-badge {
    font-size: 0.8rem !important;
    padding: 0.25em 0.50em !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    animation: badgePulse 2s infinite !important;
}


