/*** Variáveis CSS ***/
:root {
    --primary: #8B5CF6;
    --primary-hover: #7C4DFF;
    --secondary: #6D28D9;
    --background: linear-gradient(135deg, #1A1B27 0%, #0D0F1A 100%);
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-primary: rgba(255, 255, 255, 0.95);
    --text-secondary: #A0A0C0;
    --online: #10B981;
    --offline: #EF4444;
    --degraded: #F59E0B;
    --online-rgb: 16, 185, 129;
    --offline-rgb: 239, 68, 68;
    --degraded-rgb: 245, 158, 11;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --radius: 12px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

/*** Reset e Estilos Base ***/
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/*** Header ***/
.main-header {
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    padding: 1rem;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.header-container {
    max-width: 1440px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.branding {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    font-size: 2.5rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.titles {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.main-title {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.subtitle {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.9);
    font-weight: 300;
}

.status-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.update-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.9);
}

/*** Seção Principal ***/
.dashboard-container {
    flex: 1;
    padding: 2rem 1rem;
    max-width: 1440px;
    margin: 0 auto;
    width: 100%;
}

.service-section {
    margin-bottom: 3rem;
    animation: fadeIn 0.5s ease-out;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 0 0.5rem;
}

.section-header h2 {
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-icon {
    font-size: 1.2em;
}

.service-count {
    font-size: 0.9em;
    font-weight: 400;
    color: var(--text-secondary);
}

/*** Grid de Serviços ***/
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 0 0.5rem;
}

.service-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: var(--transition);
    backdrop-filter: blur(8px);
    position: relative;
    overflow: hidden;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
}

.service-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.service-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        120deg,
        rgba(255,255,255,0.03) 0%,
        rgba(255,255,255,0.01) 100%
    );
    pointer-events: none;
}

.service-card:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.service-card:active {
    transform: scale(0.98) translateY(2px);
}

/*** Elementos do Card ***/
.service-name {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.service-url {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
    word-break: break-all;
    opacity: 0.9;
}

.status-indicator {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    box-shadow: 0 0 12px currentColor;
    transition: background-color 0.3s ease;
}

.status-indicator::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    animation: pulse-online 2s infinite;
}

.online { 
    background: var(--online); 
    color: var(--online);
    &::after {
        animation-name: pulse-online;
    }
}

.offline { 
    background: var(--offline); 
    color: var(--offline);
    &::after {
        animation-name: pulse-offline;
    }
}

.degraded { 
    background: var(--degraded); 
    color: var(--degraded);
    &::after {
        animation-name: pulse-degraded;
    }
}

/*** Filtros e Legenda ***/
.status-filter {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    background: var(--card-bg);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: transparent;
    animation: buttonActive 0.3s ease;
}

.status-legend {
    display: flex;
    gap: 1.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/*** Footer ***/
.main-footer {
    background: rgba(0, 0, 0, 0.4);
    padding: 2rem 1rem;
    margin-top: auto;
}

.footer-container {
    max-width: 1440px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.footer-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.footer-title {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.footer-links, .footer-contacts {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.footer-links a, .footer-contacts a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-contacts i {
    width: 20px;
    margin-right: 0.5rem;
    opacity: 0.7;
}

.footer-bottom {
    grid-column: 1 / -1;
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--card-border);
}

.copyright {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.system-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    background: var(--card-bg);
}

/*** Animações ***/
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-online {
    0% { box-shadow: 0 0 0 0 rgba(var(--online-rgb), 0.4); }
    70% { box-shadow: 0 0 0 12px rgba(var(--online-rgb), 0); }
    100% { box-shadow: 0 0 0 0 rgba(var(--online-rgb), 0); }
}

@keyframes pulse-offline {
    0% { box-shadow: 0 0 0 0 rgba(var(--offline-rgb), 0.4); }
    70% { box-shadow: 0 0 0 12px rgba(var(--offline-rgb), 0); }
    100% { box-shadow: 0 0 0 0 rgba(var(--offline-rgb), 0); }
}

@keyframes pulse-degraded {
    0% { box-shadow: 0 0 0 0 rgba(var(--degraded-rgb), 0.4); }
    70% { box-shadow: 0 0 0 12px rgba(var(--degraded-rgb), 0); }
    100% { box-shadow: 0 0 0 0 rgba(var(--degraded-rgb), 0); }
}

@keyframes elegant-shimmer {
    0% {
        transform: translateX(-150%) skewX(-30deg) scaleX(0.5);
        opacity: 0.3;
    }
    50% {
        opacity: 0.8;
        filter: blur(2px);
    }
    100% {
        transform: translateX(150%) skewX(-30deg) scaleX(1.2);
        opacity: 0.1;
    }
}

@keyframes highlight {
    0% { background: rgba(255,255,255,0.05); }
    50% { background: rgba(255,255,255,0.15); }
    100% { background: rgba(255,255,255,0.05); }
}

@keyframes buttonActive {
    0% { transform: scale(0.98); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.error-message {
    color: #EF4444;
    padding: 1rem;
    text-align: center;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius);
    margin: 1rem;
}

.service-card.skeleton {
    animation: shimmer 1.5s infinite;
    position: relative;
    overflow: hidden;
}

/*** Skeletons Loading ***/
.service-card.skeleton {
    position: relative;
    overflow: hidden;
}

.service-card.skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        rgba(255,255,255,0) 0%,
        rgba(255,255,255,0.1) 30%,
        rgba(255,255,255,0.2) 50%,
        rgba(255,255,255,0.1) 70%,
        rgba(255,255,255,0) 100%
    );
    animation: elegant-shimmer 2s infinite;
    mix-blend-mode: soft-light;
    backdrop-filter: blur(1px);
}

#global-status-container {
    display: flex;
    gap: 1.5rem;
}

.global-status {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.global-status .status-dot {
    margin-right: 0.25rem;
}

/*** Responsividade ***/
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        align-items: flex-start;
    }

    .services-grid {
        grid-template-columns: 1fr;
    }

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

    .status-filter {
        width: 100%;
        flex-wrap: wrap;
    }

    .filter-btn {
        flex: 1;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .main-title {
        font-size: 1.2rem;
    }

    .subtitle {
        font-size: 0.8rem;
    }

    .service-card {
        padding: 1rem;
    }
}