/**
 * NEXUS Design System — componentes compartilhados
 * Complementa as variáveis e layout em base.html
 */

:root {
    --accent-success: #2ecc71;
    --accent-success-hover: #27ae60;
    --accent-info: #3498db;
    --accent-info-hover: #2980b9;
    --accent-warning: #f1c40f;
    --accent-danger: #e74c3c;
    --surface-card: #2b2d31;
    --surface-elevated: #25272b;
    --surface-input: #1e1f22;
    --surface-table-wrap: #18191c;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-panel: 0 8px 24px rgba(0, 0, 0, 0.45);
}

/* --- Layout de página --- */
.nx-page {
    padding: var(--content-padding) 0;
    flex: 1 1 auto;
    overflow-x: auto;
    overflow-y: auto;
    min-height: 0;
    min-width: 0;
    max-width: 100%;
}

.nx-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.nx-page-title {
    color: #fff;
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.nx-page-title i {
    color: var(--primary);
    margin-right: 8px;
}

.nx-page-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

.nx-search-wrap {
    position: relative;
    flex: 1;
    max-width: 500px;
    min-width: 200px;
}

.nx-search {
    width: 100%;
    background: var(--surface-input);
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 8px 14px 8px 36px;
    border-radius: var(--radius-sm);
    font-size: 0.85em;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.nx-search:focus {
    border-color: var(--primary);
}

.nx-search-wrap > i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85em;
    pointer-events: none;
}

/* --- Botões --- */
.btn-nexus,
.btn-add,
.btn-new {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.85em;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    font-family: inherit;
    text-decoration: none;
    line-height: 1.2;
}

.btn-nexus-success,
.btn-add,
.btn-new {
    background: var(--accent-success);
    color: #111;
    padding: 8px 16px;
}

.btn-nexus-success:hover,
.btn-add:hover,
.btn-new:hover {
    background: var(--accent-success-hover);
}

.btn-nexus-primary {
    background: var(--primary);
    color: #fff;
    padding: 8px 16px;
}

.btn-nexus-primary:hover {
    background: #4752c4;
}

.btn-nexus-secondary,
.btn-visual {
    background: #3f4147;
    color: #fff;
    padding: 8px 14px;
}

.btn-nexus-secondary:hover,
.btn-visual:hover {
    background: #4e5058;
}

.btn-nexus-ghost {
    background: #2f3136;
    border: 1px solid #40444b;
    color: #ccc;
    padding: 6px 12px;
}

.btn-nexus-ghost:hover {
    border-color: var(--primary);
    color: #fff;
}

.btn-nexus-danger {
    background: var(--accent-danger);
    color: #fff;
    padding: 8px 14px;
}

.btn-discrete {
    background: #3f4147;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.btn-discrete:hover {
    background: #4e5058;
}

.btn-discrete-danger {
    background: var(--accent-danger);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
}

.btn-discrete-danger:hover {
    background: #c0392b;
}

/* Painéis laterais (iframe) */
.btn {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-weight: 700;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: #4752c4;
}

.btn-secondary {
    background: #444;
    color: #fff;
}

.btn-action {
    background: #3f4147;
    color: #fff;
}

/* --- Cards e módulos --- */
.nx-filter-card {
    margin-top: 20px;
    background: var(--bg-panel);
    padding: 24px;
    border-radius: var(--radius-lg);
    border: 1px solid #333;
    box-shadow: var(--shadow-panel);
}

.nx-module-card {
    background: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow-x: auto;
    overflow-y: visible;
    max-width: 100%;
    min-width: 0;
    margin-bottom: 24px;
}

.nx-group-header {
    background: var(--bg-sidebar);
    padding: 12px 16px;
    font-size: 0.78em;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-muted);
}

.nx-table-wrap {
    background: var(--surface-table-wrap);
    border: 1px solid #25262b;
    border-radius: var(--radius-sm);
    overflow-x: auto;
}

.nx-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    color: var(--text-muted);
    text-align: center;
}

.nx-empty-state i {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* --- Tags operacionais --- */
.badge-pill,
.micro-tag {
    display: inline-block;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.65em;
    font-weight: 900;
    text-transform: uppercase;
    line-height: 1.3;
}

[class*="bg-tag-"] {
    background: #4f545c;
    color: #fff;
}

.bg-tag-rede,
.bg-tag-rede\. {
    background: #3498db;
}

.bg-tag-cor,
.bg-tag-corretiva,
.bg-tag-corr {
    background: #e67e22;
}

.bg-tag-prev,
.bg-tag-preventiva {
    background: #9b59b6;
}

.bg-tag-urg,
.bg-tag-urgente,
.bg-tag-crit,
.bg-tag-critica {
    background: #e74c3c;
}

.bg-tag-mat,
.bg-tag-materiais,
.bg-tag-log,
.bg-tag-logistica {
    background: #f1c40f;
    color: #111;
}

.bg-tag-fibra,
.bg-tag-radio,
.bg-tag-mw,
.bg-tag-swa {
    background: #1abc9c;
}

.bg-tag-os,
.bg-tag-backlog {
    background: #5865f2;
}

.bg-tag-atividade-de-rede,
.bg-tag-expansão-de-rede,
.bg-tag-expansao-de-rede,
.bg-tag-informativo {
    background: #5865f2;
}

.bg-tag-corretiva,
.bg-tag-preventiva {
    background: #9b59b6;
}

.btn-add-pill {
    width: 18px;
    height: 18px;
    background: #333;
    color: #888;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: pointer;
}

.btn-add-pill:hover {
    background: var(--primary);
    color: #fff;
}

/* --- Lista: tabela densa (escopo local) --- */
.nx-lista-table table {
    width: 100%;
    border-collapse: collapse !important;
    color: var(--text-main);
    font-size: 0.88em;
    min-width: 0;
    max-width: 100%;
    table-layout: fixed;
}

.nx-lista-table th {
    padding: 10px 12px;
    background: var(--bg-header) !important;
    color: #fff !important;
    text-transform: uppercase;
    font-size: 0.72em;
    letter-spacing: 0.6px;
    border-bottom: 2px solid var(--primary);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    font-weight: 800;
}

.nx-lista-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    vertical-align: middle;
}

.nx-lista-table tr.activity-row.selected-row {
    background: rgba(88, 101, 242, 0.2) !important;
    border-left: 5px solid var(--primary) !important;
}

/* --- Flow Control --- */
.monitor-container {
    background: var(--surface-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    overflow-x: auto;
    overflow-y: visible;
    max-width: 100%;
    min-width: 0;
    margin-bottom: 30px;
}

.search-box-fc {
    background: var(--surface-input);
    border: 1px solid #444;
    color: #fff;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    height: 32px;
    font-size: 0.85em;
    width: 250px;
    outline: none;
    font-family: inherit;
}

.search-box-fc:focus {
    border-color: var(--primary);
}

/* --- Materiais --- */
.materials-wrapper {
    font-family: 'Inter', sans-serif;
}

.materials-header-bar {
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border-color);
}

.btn-filter {
    background: transparent;
    border: 1px solid #444;
    color: #aaa;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8em;
    font-family: inherit;
}

.btn-filter.active,
.btn-filter:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.btn-action.pdf {
    background: var(--accent-danger);
    color: #fff;
}

.btn-action.excel {
    background: var(--accent-success);
    color: #111;
}

/* --- Informativo / Quadro cards --- */
.info-grid:not(.nx-inf-grid),
.quadro-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--grid-gap);
    align-items: flex-start;
}

.info-card,
.quadro-card {
    background: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.info-card:hover,
.quadro-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

/* --- Auth (login / recuperar senha) --- */
.nx-auth-page {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    color: #fff;
}

.nx-auth-card {
    background: var(--bg-panel);
    padding: 40px;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow-panel);
    text-align: center;
    border: 1px solid var(--border-color);
}

.nx-auth-logo {
    font-size: 2.2rem;
    margin-bottom: 28px;
    font-weight: 800;
    letter-spacing: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.nx-auth-logo i {
    color: var(--primary);
    margin-right: 8px;
}

.nx-auth-card .input-group {
    margin-bottom: 18px;
    text-align: left;
}

.nx-auth-card label {
    display: block;
    font-size: 0.85em;
    margin-bottom: 6px;
    color: var(--text-muted);
}

.nx-auth-card input {
    width: 100%;
    padding: 10px 12px;
    background: var(--surface-input);
    border: 1px solid #444;
    border-radius: var(--radius-sm);
    color: #fff;
    box-sizing: border-box;
    font-family: inherit;
}

.nx-auth-card input:focus {
    border-color: var(--primary);
    outline: none;
}

.nx-auth-submit {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    font-size: 1em;
    font-family: inherit;
    transition: background 0.2s;
}

.nx-auth-submit:hover {
    background: #4752c4;
}

.nx-auth-links {
    margin-top: 16px;
    font-size: 0.85em;
}

.nx-auth-links a {
    color: var(--primary);
    text-decoration: none;
}

.nx-auth-links a:hover {
    text-decoration: underline;
}

.nx-flash-error {
    background: var(--accent-danger);
    color: #fff;
    padding: 10px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.9em;
}

.nx-flash-info {
    background: var(--primary);
    color: #fff;
    padding: 10px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.9em;
}

/* --- Painel de formulário (iframe) --- */
.nx-panel-body {
    margin: 0;
    padding: 20px;
    font-family: 'Inter', sans-serif;
    background: var(--bg-panel);
    color: var(--text-main);
}

.nx-panel-body h2 {
    margin-top: 0;
    color: #fff;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    font-size: 1.1rem;
}

.nx-panel-body .form-group {
    margin-bottom: 15px;
}

.nx-panel-body .form-group label {
    display: block;
    font-size: 0.85em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

/* --- Modal de confirmação (exclusão global) --- */
.nx-confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 10060;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.nx-confirm-modal[hidden] {
    display: none !important;
}

.nx-confirm-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
}

.nx-confirm-modal__card {
    position: relative;
    width: min(420px, 100%);
    padding: 22px 24px;
    border-radius: 14px;
    background: rgba(18, 20, 28, 0.96);
    border: 1px solid rgba(231, 76, 60, 0.35);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 0 40px rgba(231, 76, 60, 0.12);
}

.nx-confirm-modal__title {
    margin: 0 0 12px;
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nx-confirm-modal__title i {
    color: #e74c3c;
}

.nx-confirm-modal__text {
    margin: 0 0 20px;
    font-size: 0.88rem;
    line-height: 1.5;
    color: #b9bbbe;
}

.nx-confirm-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.nx-confirm-modal__danger {
    padding: 10px 18px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: #fff;
    font-weight: 800;
    font-size: 0.85rem;
    cursor: pointer;
}

.nx-confirm-modal__danger:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

.nx-confirm-modal__danger:disabled {
    opacity: 0.6;
    cursor: wait;
}

.nx-lista-table tr.activity-row.selected-row,
.nx-fc-table tbody tr.selected-row {
    background: rgba(88, 101, 242, 0.22) !important;
    box-shadow: inset 4px 0 0 var(--primary, #5865f2);
}

.nx-panel-body .form-control {
    width: 100%;
    padding: 10px;
    background: var(--surface-input);
    border: 1px solid #444;
    color: #fff;
    border-radius: var(--radius-sm);
    box-sizing: border-box;
    font-family: inherit;
}

.nx-panel-body .form-control:focus {
    border-color: var(--primary);
    outline: none;
}

.nx-panel-body .actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}
