/* portal/css/style.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Cores Institucionais UERN */
    --primary-blue: #1f3669; 
    --secondary-blue: #122140;
    --accent-blue: #2a4b92;
    --uern-green: #63b447; 
    
    /* Paleta de Identificação de Ambientes (DEV / HML / SUS) */
    --env-dev-color: #0284c7;
    --env-dev-bg: rgba(2, 132, 199, 0.1);
    --env-dev-border: rgba(2, 132, 199, 0.28);

    --env-hml-color: #d97706;
    --env-hml-bg: rgba(217, 119, 6, 0.12);
    --env-hml-border: rgba(217, 119, 6, 0.3);

    --env-sus-color: #7c3aed;
    --env-sus-bg: rgba(124, 58, 237, 0.1);
    --env-sus-border: rgba(124, 58, 237, 0.28);

    --light-bg: #f4f7fb;
    --white: #ffffff;
    --text-main: #334155;
    --text-muted: #64748b;
    --danger: #ef4444;
    
    --shadow-sm: 0 2px 4px rgba(31, 54, 105, 0.05);
    --shadow-md: 0 8px 20px rgba(31, 54, 105, 0.08);
    --shadow-lg: 0 15px 30px rgba(31, 54, 105, 0.15);
    
    --radius-card: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background-color: var(--light-bg);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- Cabeçalho e Identidade Visual--- */
.header {
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
    color: var(--white);
    padding: 2.2rem 5%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    box-shadow: var(--shadow-md);
    position: relative;
    z-index: 10;
    border-bottom: 4px solid var(--env-hml-color);
}

.header-logo {
    height: 92px;
    width: auto;
    filter: brightness(0) invert(1);
    transition: var(--transition);
    flex-shrink: 0;
}

.header-logo:hover {
    transform: scale(1.03);
    filter: brightness(0) invert(1) drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35));
}

.header-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.header-text h1 {
    font-size: 2.1rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.header-text .subtitle {
    font-size: 1.25rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0.9rem;
}

.header-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
}

.env-badge {
    background: var(--uern-green);
    color: var(--white);
    padding: 0.45rem 1.1rem;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    box-shadow: 0 4px 10px rgba(99, 180, 71, 0.4);
    transition: var(--transition);
}

.env-badge.env-badge-nonprod {
    background: var(--env-hml-color);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.4);
}

.env-badge.badge-domain-dev {
    background: var(--env-dev-color);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.45);
}

.env-badge.badge-domain-hml {
    background: var(--env-hml-color);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.45);
}

.env-badge.badge-domain-sus {
    background: var(--env-sus-color);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.45);
}

/* --- Container e Hub Layout --- */
.container {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 2.5rem 2rem 5rem;
    flex: 1;
}

/* --- Barra de Controles (Busca + Abas de Ambiente) --- */
.controls-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 2.75rem;
}

.env-filter-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.65rem;
    background: var(--white);
    padding: 0.45rem;
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(31, 54, 105, 0.08);
}

.env-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.15rem;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.env-tab:hover {
    color: var(--primary-blue);
    background: rgba(31, 54, 105, 0.05);
}

.env-tab.active {
    background: var(--primary-blue);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(31, 54, 105, 0.22);
}

.env-tab.tab-dev.active {
    background: var(--env-dev-color);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.env-tab.tab-hml.active {
    background: var(--env-hml-color);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
}

.env-tab.tab-sus.active {
    background: var(--env-sus-color);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.tab-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.dot-all { background: var(--uern-green); }
.dot-dev { background: var(--env-dev-color); }
.dot-hml { background: var(--env-hml-color); }
.dot-sus { background: var(--env-sus-color); }

.env-tab.active .tab-dot {
    background: var(--white);
}

.tab-count {
    font-size: 0.72rem;
    font-weight: 800;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: rgba(100, 116, 139, 0.14);
    color: inherit;
}

.env-tab.active .tab-count {
    background: rgba(255, 255, 255, 0.22);
    color: var(--white);
}

/* --- Seções de Ambiente --- */
.env-section {
    margin-bottom: 3.5rem;
    padding: 1.75rem 1.75rem 2rem;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(31, 54, 105, 0.08);
    transition: var(--transition);
}

.env-section-dev {
    border-left: 6px solid var(--env-dev-color);
}

.env-section-hml {
    border-left: 6px solid var(--env-hml-color);
}

.env-section-sus {
    border-left: 6px solid var(--env-sus-color);
}

.env-section.current-host-section {
    background: var(--white);
    box-shadow: var(--shadow-md);
}

.env-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.75rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(31, 54, 105, 0.08);
}

.env-section-title-group {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.env-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.85rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 900;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--white);
}

.pill-dev { background: var(--env-dev-color); }
.pill-hml { background: var(--env-hml-color); }
.pill-sus { background: var(--env-sus-color); }

.section-title {
    margin: 0;
    color: var(--primary-blue);
    font-size: 1.35rem;
    font-weight: 800;
    text-align: left;
}

.env-domain-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    background: var(--light-bg);
    color: var(--primary-blue);
    border: 1px solid rgba(31, 54, 105, 0.12);
}

/* --- Layout Grids --- */
.systems-grid-main {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    justify-content: center;
}

.systems-grid-secondary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
    justify-content: center;
}

/* --- Componentes dos Cards Base--- */
.system-card {
    background: var(--white);
    border-radius: var(--radius-card);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    color: var(--text-main);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(31, 54, 105, 0.08);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.system-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: var(--primary-blue);
    transform: scaleX(0.35);
    transform-origin: center;
    transition: var(--transition);
}

.system-card.card-env-dev::before { background: var(--env-dev-color); }
.system-card.card-env-hml::before { background: var(--env-hml-color); }
.system-card.card-env-sus::before { background: var(--env-sus-color); }

.system-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
}

.system-card.card-env-dev:hover { border-color: var(--env-dev-border); }
.system-card.card-env-hml:hover { border-color: var(--env-hml-border); }
.system-card.card-env-sus:hover { border-color: var(--env-sus-border); }

.system-card:hover::before {
    transform: scaleX(1);
}

/* --- Topo do Card (Tag de Ambiente + Status) --- */
.card-top-bar {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 1.1rem;
}

.card-env-tag {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
}

.tag-dev {
    background: var(--env-dev-bg);
    color: var(--env-dev-color);
    border: 1px solid var(--env-dev-border);
}

.tag-hml {
    background: var(--env-hml-bg);
    color: var(--env-hml-color);
    border: 1px solid var(--env-hml-border);
}

.tag-sus {
    background: var(--env-sus-bg);
    color: var(--env-sus-color);
    border: 1px solid var(--env-sus-border);
}

/* --- Cards dos SIGs Principais --- */
.system-card.main-card {
    padding: 1.5rem 1.4rem 1.6rem;
}

.main-card .system-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    transition: var(--transition);
}

.main-card:hover .system-icon {
    transform: scale(1.12) rotate(4deg);
}

.main-card .system-name {
    font-size: 1.2rem;
    color: var(--primary-blue);
    font-weight: 900;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 0.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
}

.system-env-suffix {
    font-size: 0.72rem;
    font-weight: 800;
    padding: 0.15rem 0.45rem;
    border-radius: 6px;
    letter-spacing: 0.8px;
    vertical-align: middle;
}

.card-env-dev .system-env-suffix {
    background: var(--env-dev-bg);
    color: var(--env-dev-color);
}

.card-env-hml .system-env-suffix {
    background: var(--env-hml-bg);
    color: var(--env-hml-color);
}

.card-env-sus .system-env-suffix {
    background: var(--env-sus-bg);
    color: var(--env-sus-color);
}

.main-card h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.main-card .system-description {
    font-size: 0.86rem;
    color: var(--text-muted);
    line-height: 1.45;
    margin-bottom: 1rem;
    flex: 1;
}

.card-endpoint {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.76rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--light-bg);
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border: 1px dashed rgba(31, 54, 105, 0.15);
}

/* --- Funcionalidade de Botões --- */
.access-button {
    background: var(--light-bg);
    color: var(--primary-blue);
    border-radius: 12px;
    font-weight: 800;
    text-transform: uppercase;
    transition: var(--transition);
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.main-card .access-button {
    padding: 0.75rem 1.2rem;
    font-size: 0.82rem;
    letter-spacing: 0.5px;
}

.card-env-dev:hover .access-button {
    background: var(--env-dev-color);
    color: var(--white);
}

.card-env-hml:hover .access-button {
    background: var(--env-hml-color);
    color: var(--white);
}

.card-env-sus:hover .access-button {
    background: var(--env-sus-color);
    color: var(--white);
}

/* --- Exibição de Status --- */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 700;
    border-radius: 20px;
    transition: var(--transition);
}

.main-card .status-indicator {
    font-size: 0.72rem;
    padding: 0.3rem 0.65rem;
}

.status-indicator.checking { background: rgba(100, 116, 139, 0.1); color: var(--text-muted); }
.status-indicator.online { background: rgba(99, 180, 71, 0.15); color: #4d9435; }
.status-indicator.offline { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8);
}

.status-indicator.checking .status-dot { animation: pulse-checking 1.5s infinite; }
.status-indicator.online .status-dot { animation: pulse-online 2s infinite; }

@keyframes pulse-checking { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }
@keyframes pulse-online {
    0% { box-shadow: 0 0 0 0 rgba(99, 180, 71, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(99, 180, 71, 0); }
    100% { box-shadow: 0 0 0 0 rgba(99, 180, 71, 0); }
}

/* --- Configuração do Rodapé Institucional --- */
.footer {
    background: var(--secondary-blue);
    padding: 2rem;
    border-top: 4px solid var(--accent-blue);
    margin-top: auto;
}

.footer-logos {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 3rem;
    flex-wrap: wrap;
}

.footer-logo-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 2rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    text-decoration: none;
    transition: var(--transition);
    backdrop-filter: blur(10px);
    height: 70px;
}

.footer-logo-link:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.3);
}

.footer-logo-link img {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.uern-img { filter: brightness(0) invert(1); }
.sti-img { filter: invert(1) grayscale(1) brightness(200%); mix-blend-mode: screen; }

/* --- Barra de Pesquisa --- */
.search-wrapper {
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
}

.search-container {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--white);
    border-radius: 50px;
    box-shadow: 0 4px 24px rgba(31, 54, 105, 0.1), 0 1px 4px rgba(31, 54, 105, 0.06);
    border: 2px solid transparent;
    transition: var(--transition);
}

.search-container:focus-within {
    border-color: var(--accent-blue);
    box-shadow: 0 4px 32px rgba(42, 75, 146, 0.18), 0 0 0 4px rgba(42, 75, 146, 0.08);
}

.search-icon {
    position: absolute;
    left: 1.25rem;
    font-size: 1.1rem;
    color: var(--text-muted);
    pointer-events: none;
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.search-container:focus-within .search-icon {
    color: var(--accent-blue);
}

#searchInput {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    padding: 0.95rem 3rem 0.95rem 3.2rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--text-main);
    border-radius: 50px;
}

#searchInput::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

#searchInput::-webkit-search-decoration,
#searchInput::-webkit-search-cancel-button,
#searchInput::-webkit-search-results-button,
#searchInput::-webkit-search-results-decoration {
    -webkit-appearance: none;
    appearance: none;
    display: none;
}

#searchInput::-ms-clear {
    display: none;
}

#searchInput {
    -webkit-appearance: none;
    appearance: none;
}

.search-clear {
    position: absolute;
    right: 1rem;
    background: rgba(100, 116, 139, 0.12);
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.3rem;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
    transition: var(--transition);
}

.search-clear:hover {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
}

.search-clear.visible {
    display: flex;
}

.search-no-results {
    display: none;
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    font-size: 1rem;
    grid-column: 1 / -1;
}

.search-no-results span {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.75rem;
}

.card-hidden,
.section-hidden {
    display: none !important;
}

/* --- Suporte à Responsividade Mobile--- */
@media (max-width: 900px) {
    .header { flex-direction: column; text-align: center; padding: 2rem 1rem; gap: 1.25rem; }
    .header-text { align-items: center; }
    .header-badges { justify-content: center; }
    .header-logo { height: 60px; }
    .env-section { padding: 1.25rem 1rem 1.5rem; }
    .env-section-header { flex-direction: column; align-items: flex-start; }
    .env-filter-tabs { border-radius: 16px; width: 100%; }
    .env-tab { flex: 1 1 calc(50% - 0.5rem); justify-content: center; }
    .footer-logos { flex-direction: column; gap: 1.5rem; }
}
