/* ================= CONFIGURAÇÕES GERAIS ================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #020617;
}

::-webkit-scrollbar-track {
    background: #020617;
}

::-webkit-scrollbar-thumb {
    background: #1e293b;
    border-radius: 10px;
    border: 2px solid #020617;
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: #0f172a;
    background: radial-gradient(circle at top left, #1e293b 0%, #0f172a 40%),
        radial-gradient(circle at bottom right, #1e293b 0%, #0f172a 40%),
        radial-gradient(circle at center, #111827 0%, #020617 100%);
    background-attachment: fixed;
    color: #f8fafc;
    overflow-x: hidden;
}

/* ================= PARTÍCULAS ================= */
#tsparticles {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1;
}

/* ================= TELA DE LOGIN ================= */
#login-scr.overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(rgba(2, 6, 23, 0.5), rgba(2, 6, 23, 0.8)),
        url('https://images.unsplash.com/photo-1449824913935-59a10b8d2000?q=80&w=1920') no-repeat center center fixed;
    background-size: cover;
    z-index: 1000;
}

.login-box {
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 3rem;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.login-box h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 4px;
    margin-bottom: 0.5rem;
    color: #fff;
}

.login-box p {
    color: #94a3b8;
    margin-bottom: 2rem;
    font-size: 0.875rem;
}

.login-box input {
    width: 100%;
    padding: 14px 18px;
    margin-bottom: 12px;
    background: rgba(2, 6, 23, 0.6);
    border: 1px solid rgba(51, 65, 85, 0.5);
    border-radius: 12px;
    color: white;
    outline: none;
    transition: all 0.3s ease;
}

.login-box input:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.login-box button {
    width: 100%;
    padding: 14px;
    background: #10b981;
    border: none;
    border-radius: 12px;
    color: #020617;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: transform 0.2s, background 0.3s;
}

.login-box button:hover {
    background: #34d399;
    transform: translateY(-2px);
}

/* ================= DASHBOARD ================= */
.resumo {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 3rem;
}

.resumo-card {
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    padding: 1.5rem;
    border-radius: 18px;
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    border: 1px solid rgba(30, 41, 59, 0.5);
}

.resumo-card small {
    display: block;
    font-size: 0.75rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-top: 4px;
}

.online {
    color: #22c55e;
}

.warn {
    color: #facc15;
}

.offline {
    color: #ef4444;
}

/* ================= FORMULÁRIO DE ADIÇÃO ================= */
.add-form {
    display: flex;
    gap: 12px;
    padding: 20px;
    background: rgba(30, 41, 59, 0.4);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    margin-bottom: 30px;
    align-items: center;
    flex-wrap: wrap;
}

.input-group {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.input-porta {
    flex: 0 0 120px;
    min-width: 120px;
}

.icon-input {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    font-size: 0.9rem;
}

.input-group input {
    width: 100%;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 12px 12px 35px;
    border-radius: 10px;
    color: white;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.input-group input:focus {
    border-color: #00d2ff;
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.2);
    outline: none;
}

.btn-save {
    background: linear-gradient(90deg, #00d2ff, #ff9d00, #ff007a);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 10px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(255, 0, 122, 0.4);
    filter: brightness(1.1);
}

/* ================= GRID DE DISPOSITIVOS ================= */
.grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.card {
    background: rgba(30, 41, 59, 0.5);
    backdrop-filter: blur(12px) saturate(150%);
    -webkit-backdrop-filter: blur(12px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    padding: 1.5rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease-in-out;
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(16, 185, 129, 0.4);
}

.card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.card.online::before {
    background: #22c55e;
}

.card.warn::before {
    background: #facc15;
}

.card.offline::before {
    background: #ef4444;
}

.card-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
}

.card:hover .card-actions {
    opacity: 1;
}

.btn-mini {
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    color: #94a3b8;
    font-size: 12px;
}

.btn-mini:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.1);
    color: white;
}

.btn-delete:hover {
    color: #f87171;
    background: rgba(239, 68, 68, 0.2);
}

.portas-resumo-card {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    min-height: 30px;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.status-indicator.online {
    background: #10b981;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.6);
}

.status-indicator.offline {
    background: #ef4444;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.6);
}

/* ================= MODAL ================= */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-box {
    background: #0f172a;
    border: 1px solid rgba(51, 65, 85, 0.5);
    padding: 2.5rem;
    border-radius: 28px;
    width: 100%;
    max-width: 480px;
    position: relative;
    animation: modalShow 0.3s ease-out;
}

@keyframes modalShow {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-tabs {
    display: flex;
    background: rgba(15, 23, 42, 0.8);
    padding: 4px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.tab-btn {
    flex: 1;
    padding: 8px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    color: #94a3b8;
    border-radius: 8px;
    transition: all 0.3s;
    cursor: pointer;
    border: none;
    background: transparent;
}

.tab-btn.active {
    background: #10b981;
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* ================= SEÇÕES ================= */
h3.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ================= UTILITÁRIOS ================= */
.hidden {
    display: none !important;
}

/* ================= RESPONSIVIDADE ================= */
@media (max-width: 768px) {
    .add-form {
        flex-direction: column;
        align-items: stretch;
    }

    .input-group,
    .input-porta {
        width: 100%;
        min-width: 100%;
    }
}