/**
 * tecnopost.css - Estilos Canonicos do Modulo TecnoPost
 * Martin Tools - Divisao de Manufatura e Fabrica
 * Design System: Dark Navy / Cyan / Slate, Responsivo, Glassmorphism, Zero-Clutter
 */

:root {
    --tp-bg: #0f172a;
    --tp-card-bg: #ffffff;
    --tp-card-border: #e2e8f0;
    --tp-accent: #0284c7;
    --tp-accent-hover: #0369a1;
    --tp-accent-light: #e0f2fe;
    --tp-text: #1e293b;
    --tp-text-muted: #64748b;
    --tp-code-bg: #090d16;
    --tp-code-text: #e2e8f0;
    --tp-code-border: #1e293b;
    --tp-success: #10b981;
    --tp-warning: #f59e0b;
    --tp-danger: #ef4444;
}

.tp-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 24px 20px 60px 20px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--tp-text);
}

.tp-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--tp-accent);
    padding-bottom: 12px;
}

.tp-header h1 {
    font-family: 'Oswald', sans-serif;
    font-size: 26px;
    margin: 0;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tp-header-badges {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tp-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 9999px;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.tp-badge.primary {
    background: #e0f2fe;
    color: #0369a1;
    border-color: #bae6fd;
}

.tp-badge.success {
    background: #d1fae5;
    color: #065f46;
    border-color: #a7f3d0;
}

/* Layout Principal em 2 Colunas */
.tp-layout-grid {
    display: grid;
    grid-template-columns: 460px 1fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 1024px) {
    .tp-layout-grid {
        grid-template-columns: 1fr;
    }
}

/* Painel Esquerdo: Cards de Configuracao */
.tp-card {
    background: var(--tp-card-bg);
    border: 1px solid var(--tp-card-border);
    border-radius: 8px;
    padding: 16px 18px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.tp-card-title {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 8px;
}

.tp-form-group {
    margin-bottom: 12px;
}

.tp-form-group:last-child {
    margin-bottom: 0;
}

.tp-form-group label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 4px;
}

.tp-input, .tp-select, .tp-textarea {
    width: 100%;
    padding: 8px 10px;
    font-size: 12px;
    color: #0f172a;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.tp-input:focus, .tp-select:focus, .tp-textarea:focus {
    outline: none;
    border-color: var(--tp-accent);
    box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}

.tp-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.tp-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

/* Painel Direito: Tabs & Code Viewer */
.tp-viewer-panel {
    background: #ffffff;
    border: 1px solid var(--tp-card-border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.tp-tabs-nav {
    display: flex;
    background: #0f172a;
    padding: 4px 8px 0 8px;
    border-bottom: 1px solid #1e293b;
    gap: 4px;
}

.tp-tab-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.tp-tab-btn:hover {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.05);
}

.tp-tab-btn.active {
    color: #38bdf8;
    background: var(--tp-code-bg);
    border-bottom: 2px solid #38bdf8;
}

.tp-cam-notice-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: rgba(245, 158, 11, 0.08);
    border-bottom: 1px solid rgba(245, 158, 11, 0.25);
    padding: 10px 16px;
    transition: all 0.2s ease;
}

.tp-cam-notice-icon {
    padding-top: 2px;
    flex-shrink: 0;
}

.tp-cam-notice-body strong {
    color: #f59e0b;
    font-size: 12px;
    display: block;
}

.tp-cam-notice-body code {
    background: rgba(0, 0, 0, 0.3);
    color: #38bdf8;
    padding: 1px 5px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
}

.tp-viewer-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #111827;
    padding: 10px 16px;
    border-bottom: 1px solid #1f2937;
    flex-wrap: wrap;
    gap: 10px;
}

.tp-file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: #94a3b8;
}

.tp-file-name {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    color: #38bdf8;
}

.tp-action-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tp-btn {
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s, transform 0.1s;
}

.tp-btn:active {
    transform: scale(0.98);
}

.tp-btn-orange {
    background: #f97316;
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(249, 115, 22, 0.35);
}

.tp-btn-orange:hover {
    background: #ea580c;
    box-shadow: 0 2px 6px rgba(234, 88, 12, 0.45);
}

.tp-btn-primary {
    background: #0284c7;
    color: #ffffff;
}

.tp-btn-primary:hover {
    background: #0369a1;
}

.tp-btn-success {
    background: #10b981;
    color: #ffffff;
}

.tp-btn-success:hover {
    background: #059669;
}

.tp-btn-secondary {
    background: #374151;
    color: #f9fafb;
}

.tp-btn-secondary:hover {
    background: #4b5563;
}

.tp-code-display {
    background: var(--tp-code-bg);
    color: var(--tp-code-text);
    padding: 16px;
    margin: 0;
    font-family: 'JetBrains Mono', Consolas, Monaco, monospace;
    font-size: 12px;
    line-height: 1.6;
    height: 540px;
    overflow-y: auto;
    white-space: pre;
    tab-size: 4;
}

.tp-location-tip {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding: 12px 16px;
    font-size: 11px;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tp-location-tip code {
    background: #e2e8f0;
    color: #0f172a;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
}

/* Ficha Tecnica Imprimivel */
.tp-setup-sheet {
    display: none;
    padding: 24px;
    background: #ffffff;
    color: #0f172a;
    font-family: 'Inter', sans-serif;
}

.tp-sheet-header {
    border-bottom: 2px solid #0f172a;
    padding-bottom: 12px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
}

.tp-sheet-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}

.tp-sheet-table th, .tp-sheet-table td {
    border: 1px solid #cbd5e1;
    padding: 8px 10px;
    font-size: 11px;
    text-align: left;
}

.tp-sheet-table th {
    background: #f1f5f9;
    font-weight: 700;
}

@media print {
    body * {
        visibility: hidden;
    }
    #print-report, #print-report * {
        visibility: visible;
    }
    #print-report {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        display: block !important;
    }
}

/* ===== ESTILOS DE SIMULACAO & DRY-RUN CINEMATICO ===== */
.tp-simulation-container {
    padding: 16px 20px;
    background: #0b1120;
    color: #e2e8f0;
    border-radius: 0 0 8px 8px;
}

.tp-sim-header-card {
    background: #111827;
    border: 1px solid #1f2937;
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.tp-sim-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tp-sim-title {
    font-size: 13px;
    font-weight: 700;
    color: #38bdf8;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tp-sim-desc {
    font-size: 11px;
    color: #94a3b8;
    margin: 2px 0 0 0;
}

.tp-sim-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tp-sim-select {
    background: #1e293b;
    border-color: #334155;
    color: #f8fafc;
    font-size: 12px;
    max-width: 380px;
}

/* Banner de Seguranca */
.tp-safety-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 12px;
}

.tp-safety-ok {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34d399;
}

.tp-safety-warn {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fbbf24;
}

.tp-safety-danger {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
}

.tp-safety-icon {
    font-size: 18px;
    margin-top: 2px;
}

.tp-safety-body h4 {
    margin: 0 0 4px 0;
    font-size: 13px;
    font-weight: 700;
}

.tp-safety-item {
    font-size: 11px;
    margin-top: 4px;
    padding-left: 8px;
    border-left: 2px solid currentColor;
}

/* 4 Metric Cards de Simulacao */
.tp-sim-metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 16px;
}

@media (max-width: 1100px) {
    .tp-sim-metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .tp-sim-metrics-grid {
        grid-template-columns: 1fr;
    }
}

.tp-sim-card {
    background: #111827;
    border: 1px solid #1f2937;
    border-radius: 8px;
    padding: 14px 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

.tp-sim-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.tp-sim-card-label {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tp-sim-card-icon {
    font-size: 14px;
}

.tp-sim-card-value {
    font-size: 20px;
    font-weight: 800;
    color: #f8fafc;
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 8px;
}

.tp-sim-card-breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tp-sim-sub-badge {
    font-size: 10px;
    background: #1e293b;
    border: 1px solid #334155;
    color: #cbd5e1;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
}

.tp-sim-sub-badge strong {
    color: #38bdf8;
}

/* Tabela de Ferramentas */
.tp-sim-table-card {
    background: #111827;
    border: 1px solid #1f2937;
    border-radius: 8px;
    margin-bottom: 16px;
    overflow: hidden;
}

.tp-sim-table-responsive {
    overflow-x: auto;
}

.tp-sim-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
}

.tp-sim-table th {
    background: #1e293b;
    color: #94a3b8;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 1px solid #334155;
    text-transform: uppercase;
}

.tp-sim-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #1f2937;
    color: #e2e8f0;
}

.tp-sim-table tr:hover {
    background: #1e293b;
}

.tp-tool-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    background: #0284c7;
    color: #ffffff;
}

.tp-tool-progress-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tp-tool-progress-bar {
    height: 6px;
    border-radius: 3px;
    background: #0284c7;
    min-width: 4px;
}

/* Preview do Codigo na Simulacao */
.tp-sim-code-header {
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tp-sim-code-display {
    max-height: 280px;
    overflow-y: auto;
}

/* Painel Tecnico Poka-Yoke GibbsCAM & Formatos CAM */
.tp-cam-notice-panel {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.85));
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-left: 4px solid #38bdf8;
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 16px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(10px);
}

.tp-cam-notice-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 12px;
}

.tp-cam-notice-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tp-cam-notice-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.tp-cam-notice-tag {
    font-size: 10px;
    font-weight: 700;
    color: #94a3b8;
    background: rgba(148, 163, 184, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.tp-cam-notice-title {
    font-size: 13px;
    font-weight: 700;
    color: #f8fafc;
    margin: 0;
}

.tp-cam-notice-lead {
    font-size: 11.5px;
    color: #cbd5e1;
    line-height: 1.45;
    margin: 0 0 12px 0;
}

.tp-cam-notice-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

@media (max-width: 900px) {
    .tp-cam-notice-grid {
        grid-template-columns: 1fr;
    }
}

.tp-cam-notice-col {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(51, 65, 85, 0.7);
    border-radius: 6px;
    padding: 10px 12px;
    transition: border-color 0.2s;
}

.tp-cam-notice-col:hover {
    border-color: rgba(56, 189, 248, 0.4);
}

.tp-cam-notice-col.is-recommended {
    border-color: rgba(34, 197, 94, 0.4);
    background: rgba(34, 197, 94, 0.05);
}

.tp-cam-notice-col.is-plugin {
    border-color: rgba(56, 189, 248, 0.35);
    background: rgba(56, 189, 248, 0.04);
}

.tp-cam-notice-col.is-locked {
    border-color: rgba(245, 158, 11, 0.35);
    background: rgba(245, 158, 11, 0.04);
}

.tp-cam-col-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.tp-cam-col-head strong {
    font-size: 11px;
    color: #f1f5f9;
}

.tp-cam-notice-col p {
    font-size: 10.5px;
    color: #94a3b8;
    line-height: 1.35;
    margin: 0;
}

.tp-fmt-pill {
    display: inline-block;
    font-size: 10px;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 3px;
    letter-spacing: 0.3px;
}

.tp-fmt-pill.pst {
    background: #15803d;
    color: #f0fdf4;
}

.tp-fmt-pill.pm3 {
    background: #0369a1;
    color: #f0f9ff;
}

.tp-fmt-pill.post {
    background: #b45309;
    color: #fffbeb;
}

/* ===== v4.0 UX: WIZARD 4 PASSOS, BRAND PILLS, MAGAZINE & PAINEL RICO ===== */
.tp-wizard-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 18px;
}

@media (max-width: 900px) {
    .tp-wizard-bar {
        grid-template-columns: 1fr 1fr;
    }
}

.tp-wizard-step {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 10px 12px;
    transition: all 0.2s;
}

.tp-wizard-step.active {
    border-color: var(--tp-accent);
    background: #f0f9ff;
    box-shadow: 0 1px 4px rgba(2, 132, 199, 0.12);
}

.tp-step-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #0284c7;
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tp-step-text strong {
    display: block;
    font-size: 12px;
    color: #0f172a;
}

.tp-step-text span {
    display: block;
    font-size: 10.5px;
    color: #64748b;
}

/* Gaveta de Ajuda & Dialetos G/M */
.tp-help-drawer {
    background: #ffffff;
    border: 2px solid #0284c7;
    border-radius: 8px;
    margin-bottom: 18px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

.tp-help-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f0f9ff;
    border-bottom: 1px solid #bae6fd;
}

.tp-help-drawer-body {
    padding: 14px 16px;
    font-size: 12px;
}

/* Pills de Filtro Rapido por Marca */
.tp-brand-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 10px;
}

.tp-brand-pill {
    font-size: 10.5px;
    font-weight: 600;
    padding: 4px 9px;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #334155;
    cursor: pointer;
    transition: all 0.15s;
}

.tp-brand-pill:hover {
    border-color: #0284c7;
    color: #0284c7;
    background: #f0f9ff;
}

.tp-brand-pill.active {
    background: #0284c7;
    color: #ffffff;
    border-color: #0284c7;
}

/* Box de Resumo da Maquina Selecionada */
.tp-machine-summary-box {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    font-size: 11.5px;
}

/* Magazine / Torre de Ferramentas */
.tp-magazine-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.tp-mag-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 11px;
}

.tp-mag-code {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    color: #0369a1;
    background: #e0f2fe;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10.5px;
}

.tp-mag-params {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.tp-mag-input {
    width: 62px;
    padding: 3px 5px;
    font-size: 11px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    text-align: right;
    font-family: 'JetBrains Mono', monospace;
}

.tp-add-tool-bar {
    display: flex;
    gap: 8px;
    align-items: center;
}

.tp-help-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #e0f2fe;
    color: #0284c7;
    font-size: 10px;
    font-weight: 800;
    cursor: help;
    margin-left: 4px;
}

/* Painel Rico Escaneavel para Abas Sheet, Audit e War-Room */
.tp-rich-tab-view {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 16px;
    color: #1e293b;
}

.tp-rich-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.tp-rich-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 10px 12px;
}
