/* ==========================================================================
   GURUINFO TI — CENTRAL DE AUTOMAÇÕES & SCRIPTS 1-CLIQUE (MSP TOOLBOX)
   CSS Corporativo Executivo — Alto Contraste & Modo Escuro / Claro
   ========================================================================== */

/* Container Principal */
.automacoes-dashboard {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    box-sizing: border-box;
}

/* Header & Banner Superior */
.automacoes-header-card {
    background: linear-gradient(135deg, rgba(2, 132, 199, 0.12) 0%, rgba(99, 102, 241, 0.08) 100%);
    border: 1.5px solid rgba(2, 132, 199, 0.35);
    border-radius: 16px;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 18px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

body.theme-light .automacoes-header-card,
body[data-theme="clean-executive"] .automacoes-header-card,
body:not(.dark-mode) .automacoes-header-card {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-color: #bae6fd;
    box-shadow: 0 2px 10px rgba(2, 132, 199, 0.08);
}

.automacoes-header-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.automacoes-header-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, #0284c7 0%, #6366f1 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.45);
    flex-shrink: 0;
}

.automacoes-header-titles h2 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-main, #ffffff);
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.01em;
}

.automacoes-header-titles p {
    margin: 4px 0 0 0;
    font-size: 0.85rem;
    color: var(--text-sub, #94a3b8);
    line-height: 1.4;
}

/* Painel de Seleção de Host Alvo */
.automacoes-target-panel {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 8px 14px;
    backdrop-filter: blur(8px);
}

body.theme-light .automacoes-target-panel,
body[data-theme="clean-executive"] .automacoes-target-panel,
body:not(.dark-mode) .automacoes-target-panel {
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.target-select-label {
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #38bdf8;
    white-space: nowrap;
}

body.theme-light .target-select-label,
body:not(.dark-mode) .target-select-label {
    color: #0284c7;
}

.target-host-select {
    background: transparent;
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 8px;
    color: var(--text-main, #ffffff);
    padding: 6px 10px;
    font-size: 0.84rem;
    font-weight: 700;
    outline: none;
    cursor: pointer;
    min-width: 200px;
}

body.theme-light .target-host-select,
body:not(.dark-mode) .target-host-select {
    border-color: #94a3b8;
    color: #0f172a;
    background: #f8fafc;
}

/* Barra de Filtros e Busca de Scripts */
.automacoes-filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    background: var(--surface, #12141a);
    border: 1.5px solid var(--border-color, #232732);
    border-radius: 14px;
    padding: 12px 18px;
}

.automacoes-categories-pills {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
}

.automacoes-categories-pills::-webkit-scrollbar {
    display: none;
}

.category-pill {
    padding: 7px 14px;
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-sub, #94a3b8);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.category-pill:hover {
    background: rgba(2, 132, 199, 0.15);
    color: #38bdf8;
    border-color: rgba(2, 132, 199, 0.4);
}

.category-pill.active {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    border-color: #0284c7;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
}

body.theme-light .category-pill,
body:not(.dark-mode) .category-pill {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #475569;
}

body.theme-light .category-pill.active,
body:not(.dark-mode) .category-pill.active {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    border-color: #0284c7;
}

.automacoes-search-wrapper {
    position: relative;
    min-width: 240px;
    flex: 1;
    max-width: 360px;
}

.automacoes-search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px 8px 34px;
    border-radius: 9px;
    background: var(--surface-sub, #1e293b);
    border: 1px solid var(--border-color, #334155);
    color: var(--text-main, #ffffff);
    font-size: 0.82rem;
    outline: none;
    transition: all 0.2s ease;
}

.automacoes-search-input:focus {
    border-color: #0284c7;
    box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
}

.automacoes-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    font-size: 0.85rem;
    pointer-events: none;
}

/* Grid de Cards de Automação */
.automacoes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 16px;
    width: 100%;
    box-sizing: border-box;
}

/* Card Individual de Tarefa */
.automacao-card {
    background: var(--surface, #12141a);
    border: 1.5px solid var(--border-color, #232732);
    border-radius: 14px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}

.automacao-card:hover {
    transform: translateY(-3px);
    border-color: rgba(2, 132, 199, 0.55);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2), 0 0 14px rgba(2, 132, 199, 0.15);
}

body.theme-light .automacao-card,
body[data-theme="clean-executive"] .automacao-card,
body:not(.dark-mode) .automacao-card {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

body.theme-light .automacao-card:hover,
body:not(.dark-mode) .automacao-card:hover {
    border-color: #0284c7;
    box-shadow: 0 8px 22px rgba(2, 132, 199, 0.12);
}

.automacao-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.automacao-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* Cores de Badges de Categoria */
.icon-clean {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.35);
}
.icon-repair {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.35);
}
.icon-network {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.35);
}
.icon-software {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.35);
}
.icon-security {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.35);
}

.automacao-card-tags {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.automacao-badge-os {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 6px;
    letter-spacing: 0.05em;
    background: rgba(56, 189, 248, 0.12);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.automacao-badge-category {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.theme-light .automacao-badge-category,
body:not(.dark-mode) .automacao-badge-category {
    background: #f1f5f9;
    color: #64748b;
    border-color: #cbd5e1;
}

.automacao-card-body h3 {
    margin: 0 0 6px 0;
    font-size: 1.02rem;
    font-weight: 800;
    color: var(--text-main, #ffffff);
    line-height: 1.3;
}

.automacao-card-body p {
    margin: 0 0 16px 0;
    font-size: 0.81rem;
    color: var(--text-sub, #94a3b8);
    line-height: 1.45;
    min-height: 38px;
}

.automacao-card-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.06));
}

.btn-auto-exec {
    flex: 1;
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    border: none;
    border-radius: 9px;
    padding: 8px 12px;
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
}

.btn-auto-exec:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.5);
    filter: brightness(1.1);
}

.btn-auto-exec:active {
    transform: translateY(0);
}

.btn-auto-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
    color: var(--text-sub, #94a3b8);
    border-radius: 9px;
    padding: 8px 10px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-auto-secondary:hover {
    background: rgba(2, 132, 199, 0.15);
    color: #38bdf8;
    border-color: rgba(2, 132, 199, 0.4);
}

body.theme-light .btn-auto-secondary,
body:not(.dark-mode) .btn-auto-secondary {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #475569;
}

/* ==========================================================================
   MODAL TERMINAL DE EXECUÇÃO EM TEMPO REAL (ESTILO NOC CONSOLE)
   ========================================================================== */
.terminal-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(8px);
}

.terminal-modal-window {
    background: #0d1117;
    border: 2px solid rgba(56, 189, 248, 0.35);
    border-radius: 18px;
    width: 100%;
    max-width: 960px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(56, 189, 248, 0.25);
    overflow: hidden;
}

.terminal-header {
    background: #161b22;
    border-bottom: 1px solid #30363d;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.terminal-traffic-lights {
    display: flex;
    gap: 8px;
    align-items: center;
}

.terminal-light {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    cursor: pointer;
}

.terminal-light.red { background: #ff5f56; }
.terminal-light.yellow { background: #ffbd2e; }
.terminal-light.green { background: #27c93f; }

.terminal-title-box {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono, monospace);
    font-size: 0.82rem;
    font-weight: 700;
    color: #e6edf3;
}

.terminal-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    animation: statusPulse 1.8s infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

.terminal-header-actions {
    display: flex;
    gap: 6px;
}

.terminal-body {
    padding: 18px 20px;
    background: #090d13;
    flex: 1;
    overflow-y: auto;
    font-family: 'JetBrains Mono', Consolas, Monaco, monospace;
    font-size: 0.82rem;
    line-height: 1.55;
    color: #38bdf8;
    min-height: 280px;
    max-height: 55vh;
    scrollbar-width: thin;
    scrollbar-color: #30363d transparent;
}

.terminal-body pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
    font-family: inherit;
}

.terminal-footer {
    background: #161b22;
    border-top: 1px solid #30363d;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.terminal-meta-info {
    font-size: 0.74rem;
    color: #8b949e;
    display: flex;
    align-items: center;
    gap: 14px;
}

.terminal-footer-btns {
    display: flex;
    gap: 8px;
}
