@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-main: #090d16;
    --bg-card: rgba(17, 24, 39, 0.65);
    --border-card: rgba(255, 255, 255, 0.06);
    
    --color-primary: #6366f1; /* Indigo */
    --color-secondary: #00f2fe; /* Neon Cyan */
    --color-success: #10b981; /* Emerald Neon */
    --color-danger: #f43f5e; /* Rose Neon */
    --color-warning: #f59e0b; /* Amber */
    --color-text-main: #f8fafc;
    --color-text-muted: #94a3b8;
    
    --shadow-neon: 0 0 20px rgba(0, 242, 254, 0.25);
    --shadow-success: 0 0 20px rgba(16, 185, 129, 0.3);
    --shadow-danger: 0 0 20px rgba(244, 63, 94, 0.3);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--color-text-main);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(0, 242, 254, 0.08) 0%, transparent 45%);
    background-attachment: fixed;
}

/* Layout Geral */
.app-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-card);
}

.logo-section h1 {
    font-size: 2.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fff 0%, var(--color-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.logo-section p {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    margin-top: 0.3rem;
}

.nav-actions {
    display: flex;
    gap: 1rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, #4f46e5 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-text-main);
    border: 1px solid var(--border-card);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.btn-danger {
    background: rgba(244, 63, 94, 0.1);
    color: var(--color-danger);
    border: 1px solid rgba(244, 63, 94, 0.2);
}

.btn-danger:hover {
    background: rgba(244, 63, 94, 0.2);
    transform: translateY(-2px);
}

/* Cards Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.5rem;
}

/* Card Bomba */
.bomba-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 24px;
    padding: 1.5rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.bomba-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Cabeçalho do Card */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.card-title-group h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text-main);
    margin-bottom: 0.2rem;
}

.card-title-group span {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    font-family: monospace;
}

/* Badge de Status */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Status: Ligado */
.status-ligado {
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-ligado .dot {
    background-color: var(--color-success);
    box-shadow: 0 0 8px var(--color-success);
    animation: pulse 1.5s infinite;
}

/* Status: Desligado */
.status-desligado {
    background: rgba(148, 163, 184, 0.1);
    color: var(--color-text-muted);
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.status-desligado .dot {
    background-color: var(--color-text-muted);
}

/* Status: Falha */
.status-falha {
    background: rgba(244, 63, 94, 0.1);
    color: var(--color-danger);
    border: 1px solid rgba(244, 63, 94, 0.2);
    animation: borderPulse 2s infinite;
}

.status-falha .dot {
    background-color: var(--color-danger);
    box-shadow: 0 0 8px var(--color-danger);
    animation: pulse 1s infinite;
}

/* Status: Subtensão / Meia Fase */
.status-subtensao {
    background: rgba(245, 158, 11, 0.1);
    color: var(--color-warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
    animation: borderPulseWarning 2s infinite;
}

.status-subtensao .dot {
    background-color: var(--color-warning);
    box-shadow: 0 0 8px var(--color-warning);
    animation: pulse 1.2s infinite;
}

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

/* Indicadores de Medição */
.metrics-section {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    padding: 0.75rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.metric-box {
    text-align: center;
}

.metric-label {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.metric-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-text-main);
}

.metric-value span {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-left: 1px;
}

/* Cronometro e Infos adicionais */
.footer-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
}

.time-active {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--color-text-main);
    font-weight: 500;
}

.time-active svg {
    color: var(--color-secondary);
}

.last-signal {
    color: var(--color-text-muted);
    font-size: 0.8rem;
}

/* Painel de Ações do Card */
.card-actions {
    display: flex;
    gap: 0.75rem;
}

.btn-toggle {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem;
    border-radius: 14px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: var(--transition-smooth);
}

.btn-toggle-on {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.btn-toggle-on:hover {
    background: var(--color-success);
    color: #000;
    box-shadow: var(--shadow-success);
}

.btn-toggle-off {
    background: rgba(244, 63, 94, 0.15);
    color: var(--color-danger);
    border: 1px solid rgba(244, 63, 94, 0.3);
}

.btn-toggle-off:hover {
    background: var(--color-danger);
    color: #fff;
    box-shadow: var(--shadow-danger);
}

/* Modais / Telas Administrativas */
.admin-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 24px;
    padding: 2rem;
    backdrop-filter: blur(12px);
    margin-bottom: 2rem;
}

.admin-card h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, var(--color-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

.form-control {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-card);
    border-radius: 12px;
    padding: 0.8rem;
    color: #fff;
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-secondary);
    background: rgba(255, 255, 255, 0.08);
}

.table-container {
    overflow-x: auto;
    margin-top: 1.5rem;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.admin-table th, .admin-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-card);
}

.admin-table th {
    font-weight: 700;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-table tr:hover td {
    background: rgba(255, 255, 255, 0.01);
}

/* Alertas Globais (Toast) */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #1e293b;
    border-left: 4px solid var(--color-secondary);
    color: #fff;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transform: translateY(150%);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
    transform: translateY(0);
}

/* Animações */
@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.4; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes borderPulse {
    0% { border-color: rgba(244, 63, 94, 0.2); }
    50% { border-color: rgba(244, 63, 94, 0.6); }
    100% { border-color: rgba(244, 63, 94, 0.2); }
}

@keyframes borderPulseWarning {
    0% { border-color: rgba(245, 158, 11, 0.2); }
    50% { border-color: rgba(245, 158, 11, 0.6); }
    100% { border-color: rgba(245, 158, 11, 0.2); }
}

/* Caixas de Mensagens Didáticas */
.status-msg {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    padding: 0.8rem 1rem;
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--color-text-muted);
    margin-bottom: 1.5rem;
    transition: var(--transition-smooth);
    border-left: 3px solid rgba(255, 255, 255, 0.2);
}

.status-msg-success {
    background: rgba(16, 185, 129, 0.04);
    border-color: rgba(16, 185, 129, 0.1);
    border-left-color: var(--color-success);
    color: var(--color-text-main);
}

.status-msg-warning {
    background: rgba(245, 158, 11, 0.04);
    border-color: rgba(245, 158, 11, 0.1);
    border-left-color: var(--color-warning);
    color: #ffd080;
}

.status-msg-danger {
    background: rgba(244, 63, 94, 0.04);
    border-color: rgba(244, 63, 94, 0.1);
    border-left-color: var(--color-danger);
    color: #ff99aa;
}

/* Indicadores de Conectividade (Online / Offline) */
.connectivity-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    vertical-align: middle;
    margin-left: 0.4rem;
}

.connectivity-online {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.connectivity-online .dot-pulse {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #10b981;
    box-shadow: 0 0 6px #10b981;
    animation: pulse 1.5s infinite;
}

.connectivity-offline {
    background: rgba(244, 63, 94, 0.12);
    color: #f43f5e;
    border: 1px solid rgba(244, 63, 94, 0.25);
}

.connectivity-offline .dot-pulse {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #f43f5e;
    box-shadow: 0 0 6px #f43f5e;
    animation: pulse 1s infinite;
}

