/* Admin — modal comunicar problema */
.ep-admin-modal {
    position: fixed;
    inset: 0;
    z-index: 100050;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    backdrop-filter: blur(4px);
}

.ep-admin-modal.ep-admin-open {
    opacity: 1;
    visibility: visible;
}

.ep-admin-box {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 2px solid rgba(239, 68, 68, 0.4);
    border-radius: 16px;
    padding: 28px 24px 24px;
    max-width: 520px;
    width: 100%;
    position: relative;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.ep-admin-box h3 {
    color: #fef2f2;
    margin: 0 0 8px;
    font-size: 1.25rem;
}

.ep-admin-ext-name {
    color: #94a3b8;
    margin: 0 0 16px;
    font-size: 0.9rem;
}

.ep-admin-label {
    display: block;
    color: #e2e8f0;
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.ep-admin-textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #475569;
    background: #0f172a;
    color: #f1f5f9;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    margin-bottom: 14px;
    box-sizing: border-box;
}

.ep-admin-textarea:focus {
    outline: none;
    border-color: #ef4444;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.25);
}

.ep-admin-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: #cbd5e1;
    font-size: 0.9rem;
    margin-bottom: 20px;
    cursor: pointer;
}

.ep-admin-check input {
    margin-top: 3px;
    accent-color: #ef4444;
}

.ep-admin-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.ep-admin-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.85);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.ep-admin-close:hover {
    background: #ef4444;
}

.btn-admin.btn-small.btn-problem {
    background: linear-gradient(135deg, #b45309, #d97706);
    color: #fff;
    border: 1px solid rgba(251, 191, 36, 0.35);
}

.btn-admin.btn-small.btn-problem:hover {
    filter: brightness(1.1);
}

.btn-admin.btn-small.btn-problem-active {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: #fff;
    border: 1px solid rgba(252, 165, 165, 0.5);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.45);
}

.extension-item.extension-has-problem {
    border-left: 3px solid #ef4444 !important;
}

.extension-item.extension-has-problem .extension-name::after {
    content: ' ⚠ com problema';
    color: #f87171;
    font-size: 0.85em;
    font-weight: normal;
}

/* Cards flip — faixa diagonal pulsante (conteúdo do card permanece visível) */
.tc-front,
.tc-back {
    position: relative;
}

.tc-problem-overlay {
    grid-area: 1 / 1;
    position: absolute;
    inset: 0;
    z-index: 40;
    pointer-events: none;
    overflow: hidden;
    border-radius: var(--tc-radius);
    /* Sem backface-visibility — no contexto 3D do card isso pode ficar atrás do conteúdo e bloquear cliques */
    transform: translateZ(8px);
    transform-style: flat;
}

/* Faixa diagonal central — pulsa devagar para ler o card entre ciclos */
.tc-problem-stripe-wrap {
    position: absolute;
    left: 50%;
    top: 46%;
    width: 175%;
    height: 52px;
    transform: translate(-50%, -50%) rotate(-34deg);
    transform-origin: center center;
    pointer-events: none;
    animation: tc-problem-stripe-pulse 3.8s ease-in-out infinite;
}

.tc-problem-stripe {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #dc2626;
    border-top: 2px solid rgba(255, 255, 255, 0.9);
    border-bottom: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 24px rgba(185, 28, 28, 0.5);
}

.tc-problem-stripe-text {
    font-size: clamp(0.62rem, 2.4vw, 0.78rem);
    font-weight: 900;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #000;
    text-shadow:
        -1px -1px 0 #fff,
        1px -1px 0 #fff,
        -1px 1px 0 #fff,
        1px 1px 0 #fff,
        0 -1px 0 #fff,
        0 1px 0 #fff,
        -1px 0 0 #fff,
        1px 0 0 #fff,
        -2px 0 0 #fff,
        2px 0 0 #fff,
        0 -2px 0 #fff,
        0 2px 0 #fff;
    white-space: nowrap;
    padding: 0 8px;
}

@keyframes tc-problem-stripe-pulse {
    0%, 100% {
        opacity: 0.38;
        filter: brightness(0.85) saturate(0.85);
    }
    45%, 55% {
        opacity: 1;
        filter: brightness(1.15) saturate(1.2);
    }
}

/* Área clicável ampla — evita flip acidental */
.tc-problem-actions {
    position: absolute;
    bottom: 4px;
    left: 50%;
    z-index: 50;
    transform: translateX(-50%) translateZ(12px);
    padding: 10px 12px;
    pointer-events: auto;
    touch-action: manipulation;
    isolation: isolate;
}

.tc-btn-problem-detail {
    display: block;
    margin: 0;
    padding: 10px 16px;
    min-height: 40px;
    min-width: 200px;
    border: 2px solid #fff;
    border-radius: 8px;
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    color: #fff;
    font-weight: 800;
    font-size: 11px;
    line-height: 1.25;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    pointer-events: auto;
    touch-action: manipulation;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
    animation: tc-problem-btn-pulse 3.8s ease-in-out infinite;
    max-width: calc(100vw - 40px);
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.tc-problem-actions:hover .tc-btn-problem-detail,
.tc-btn-problem-detail:hover {
    animation-play-state: paused;
    filter: brightness(1.12);
}

@keyframes tc-problem-btn-pulse {
    0%, 100% {
        opacity: 0.5;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    }
    50% {
        opacity: 1;
        box-shadow:
            0 0 0 2px rgba(254, 202, 202, 0.5),
            0 6px 22px rgba(239, 68, 68, 0.65);
    }
}

.tc-card.tc-has-problem {
    --tc-glow: #ef4444;
}

/* Frente: mais perto da base para não cobrir Comentários */
.tc-front .tc-problem-actions {
    bottom: 10px;
}

/* Verso: acima do botão Observações */
.tc-back .tc-problem-actions {
    bottom: 48px;
}

/* Conteúdo não intercepta cliques — só botões/links interativos */
.tc-has-problem .tc-face-content {
    pointer-events: none;
}

.tc-has-problem .tc-face-content .tc-btn-comments,
.tc-has-problem .tc-face-content .tc-btn-info,
.tc-has-problem .tc-face-content a {
    pointer-events: auto;
}

/* Modal mensagem do problema (mesmo estilo observações) */
.tc-problem-msg-modal .tc-obs-box h3 {
    color: #fecaca;
}

.tc-problem-msg-body {
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid #ef4444;
    border-radius: 6px;
    padding: 14px 16px;
    font-size: 14px;
    color: #e2e8f0;
    line-height: 1.75;
    white-space: pre-wrap;
    word-wrap: break-word;
}
