/* ============================================================
   WisersOne — Painel de Produção — CSS Global
   Tema escuro, chão de fábrica, alta legibilidade
   ============================================================ */

/* ── Reset base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    overflow: hidden;
    font-family: 'Roboto', 'Segoe UI', sans-serif;
    background-color: #111318;
    color: #E8EAED;
}

/* ── Estrutura raiz do painel ─────────────────────────────── */
.painel-root {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* ── HEADER ──────────────────────────────────────────────── */
.painel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #0D47A1;
    padding: 0 1.5rem;
    height: 60px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    gap: 1rem;
}

.painel-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.painel-title-block {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.painel-title-main {
    font-size: 1.1rem;
    font-weight: 700;
    color: #FFFFFF;
    letter-spacing: 0.3px;
}

.painel-title-sub {
    font-size: 0.7rem;
    color: #90CAF9;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.painel-header-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}

.painel-relogio {
    font-size: 1.6rem;
    font-weight: 300;
    color: #FFFFFF;
    letter-spacing: 2px;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.painel-data {
    font-size: 0.7rem;
    color: #90CAF9;
    text-transform: capitalize;
    letter-spacing: 0.5px;
}

.painel-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    justify-content: flex-end;
}

.painel-status-txt {
    font-size: 0.75rem;
    color: #90CAF9;
}

/* ── CONTEÚDO PRINCIPAL ──────────────────────────────────── */
.painel-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ── LISTA DE OPs ────────────────────────────────────────── */
.painel-lista {
    width: 42%;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem;
    gap: 0.75rem;
    border-right: 1px solid #2A2D35;
    scrollbar-width: thin;
    scrollbar-color: #3A3D46 transparent;
}

.painel-lista::-webkit-scrollbar { width: 6px; }
.painel-lista::-webkit-scrollbar-track { background: transparent; }
.painel-lista::-webkit-scrollbar-thumb { background: #3A3D46; border-radius: 3px; }

.painel-lista-header {
    padding: 0 0.25rem;
    letter-spacing: 1px;
}

/* ── OP CARD ─────────────────────────────────────────────── */
.op-card {
    background: #1C1F26;
    border-radius: 10px;
    padding: 1rem 1rem 0.75rem;
    cursor: pointer;
    border: 2px solid transparent;
    border-left-width: 5px;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
    user-select: none;
}

.op-card:hover {
    background: #22262F;
    transform: translateX(3px);
}

.op-card--selecionada {
    border-color: #1976D2 !important;
    background: #1A2A3E !important;
}

/* Urgência — borda esquerda colorida */
.op-atrasada { border-left-color: #EF5350; }
.op-atencao  { border-left-color: #FFA726; }
.op-no-prazo { border-left-color: #66BB6A; }

.op-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.4rem;
}

.op-numero {
    font-size: 1.1rem;
    font-weight: 700;
    color: #E8EAED;
    letter-spacing: 0.5px;
}

.op-badges {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.op-item-info {
    display: flex;
    flex-direction: column;
    margin-bottom: 0.6rem;
}

.op-codigo {
    font-size: 0.8rem;
    color: #9AA0A6;
    font-weight: 500;
}

.op-descricao {
    font-size: 0.95rem;
    color: #C8CAD0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.op-progress-area {
    margin-bottom: 0.5rem;
}

.op-progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: #9AA0A6;
    margin-bottom: 3px;
}

.op-refugo-mini {
    color: #FFA726;
    font-weight: 500;
}

.op-card-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: #9AA0A6;
    margin-top: 0.4rem;
}

/* ── STEPS DE ETAPA no card ─────────────────────────────── */
.op-etapas-steps {
    display: flex;
    align-items: center;
    margin: 0.45rem 0 0.2rem;
}

.step-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.45rem;
    height: 1.45rem;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
    user-select: none;
}

.step-dot-done    { background: #2E7D32; color: #fff; }
.step-dot-atual   { background: #1565C0; color: #fff;
                    box-shadow: 0 0 0 3px rgba(21,101,192,0.40); }
.step-dot-pending { background: #22252E; color: #5A5D66;
                    border: 1px solid #3A3D46; }

.step-connector {
    flex: 1;
    height: 2px;
    background: #2A2D36;
    margin: 0 3px;
}

.step-connector-done { background: #2E7D32; }

.op-etapa-atual-label {
    font-size: 0.7rem;
    color: #9AA0A6;
    margin-bottom: 0.35rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── ENTREGA INFO no card ────────────────────────────────── */
.op-entrega-info {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 4px;
    margin: 0.35rem 0 0.3rem;
    padding: 0.45rem 0.2rem;
    border-top: 1px solid rgba(255,255,255,0.07);
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.op-entrega-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.op-entrega-label {
    font-size: 0.6rem;
    color: #9AA0A6;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    margin-bottom: 2px;
}

.op-entrega-valor {
    font-size: 0.82rem;
    color: #E8EAED;
    font-weight: 600;
    line-height: 1.2;
}

.dias-atrasado { color: #EF5350; font-weight: 700; }
.dias-critico  { color: #FF7043; font-weight: 700; }
.dias-atencao  { color: #FFA726; }
.dias-ok       { color: #66BB6A; }

/* ── BADGES ──────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    white-space: nowrap;
}

.badge-lg {
    font-size: 0.8rem;
    padding: 4px 12px;
}

.badge-liberada    { background: #0D47A1; color: #90CAF9; }
.badge-em-producao { background: #E65100; color: #FFE0B2; }
.badge-atrasada    { background: #B71C1C; color: #FFCDD2; }
.badge-atencao     { background: #E65100; color: #FFE0B2; }
.badge-no-prazo    { background: #1B5E20; color: #C8E6C9; }

/* ── PAINEL DE AÇÕES ─────────────────────────────────────── */
.painel-acoes {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 2rem;
    display: flex;
    flex-direction: column;
}

.painel-vazio {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.5rem;
    opacity: 0.7;
    padding: 2rem;
}

.acoes-detalhe {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.acoes-op-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.acoes-op-numero {
    font-size: 2rem;
    font-weight: 700;
    color: #FFFFFF;
    letter-spacing: 1px;
}

.acoes-badges {
    display: flex;
    gap: 0.5rem;
}

/* Métricas de quantidade */
.acoes-metricas {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: #1C1F26;
    border-radius: 10px;
    flex-wrap: wrap;
}

.metrica {
    display: flex;
    flex-direction: column;
    min-width: 100px;
}

.metrica-label {
    font-size: 0.72rem;
    color: #9AA0A6;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 2px;
}

.metrica-valor {
    font-size: 1.5rem;
    font-weight: 600;
    color: #E8EAED;
    font-variant-numeric: tabular-nums;
}

.metrica-valor.ok     { color: #66BB6A; }
.metrica-valor.refugo { color: #FFA726; }
.metrica-valor.zero   { color: #555; }

.acoes-progress {
    margin-bottom: 4px;
}

/* ── BLOCOS DE ETAPA ─────────────────────────────────────── */
.acoes-etapas {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-bottom: 1rem;
}

.etapa-bloco {
    background: #1C1F26;
    border-radius: 10px;
    padding: 0.8rem 1rem;
    border-left: 4px solid transparent;
}

.etapa-completa  { border-left-color: #2E7D32; opacity: 0.65; }
.etapa-ativa     { border-left-color: #1565C0; }
.etapa-bloqueada { border-left-color: #37474F; opacity: 0.5; }

.etapa-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.4rem;
}

.etapa-titulo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.etapa-numero {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.55rem;
    height: 1.55rem;
    border-radius: 50%;
    font-size: 0.76rem;
    font-weight: 700;
    flex-shrink: 0;
    background: #2A2D36;
    color: #9AA0A6;
}

.etapa-ativa    .etapa-numero { background: #1565C0; color: #fff; }
.etapa-completa .etapa-numero { background: #2E7D32; color: #fff; }

.etapa-nome {
    font-size: 0.93rem;
    font-weight: 600;
    color: #E8EAED;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.etapa-progresso-txt {
    font-size: 0.9rem;
    font-weight: 700;
    color: #9AA0A6;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    margin-left: 0.5rem;
}

.etapa-completa .etapa-progresso-txt { color: #66BB6A; }

.badge-final {
    background: #4A148C;
    color: #E1BEE7;
    font-size: 0.6rem;
    padding: 2px 7px;
    border-radius: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.etapa-acoes {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.5rem;
}

/* ── BOTÕES DE AÇÃO ──────────────────────────────────────── */
.acoes-botoes {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: auto;
    padding-top: 1.5rem;
}

.btn-acao {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.1rem 2rem;
    font-size: 1.2rem;
    font-weight: 700;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s, box-shadow 0.15s;
    letter-spacing: 0.5px;
}

.btn-acao:hover:not(:disabled) {
    opacity: 0.9;
    transform: scale(1.01);
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.btn-acao:active:not(:disabled) {
    transform: scale(0.99);
}

.btn-acao:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.btn-iniciar  { background: #1565C0; color: #FFFFFF; }
.btn-apontar  { background: #2E7D32; color: #FFFFFF; }
.btn-concluir { background: #E65100; color: #FFFFFF; }

.acoes-processando {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    justify-content: center;
    color: #9AA0A6;
    font-size: 0.9rem;
    padding: 0.5rem;
}

/* ── Blazor error UI (mantido do template) ───────────────── */
#blazor-error-ui {
    background: #B71C1C;
    bottom: 0;
    box-shadow: 0 -1px 0 rgba(0,0,0,0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: white;
    font-size: 0.9rem;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
    font-size: 1.25rem;
}

/* ── Scrollbar global ────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #3A3D46; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #5A5D66; }
