:root {
    --bg-dark: #020617;
    --accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.3);
    --secondary: #a855f7;
    --secondary-glow: rgba(168, 85, 247, 0.3);
    --tertiary: #06b6d4;
    --tertiary-glow: rgba(6, 182, 212, 0.3);
    --glass: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-dim: #94a3b8;
    --success: #10b981;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Background Animado Aurora */
.mesh-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background:
        radial-gradient(circle at 0% 0%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, rgba(168, 85, 247, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 50% 0%, rgba(6, 182, 212, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, #020617 0%, #000 100%);
    animation: aurora-move 20s ease-in-out infinite alternate;
}

@keyframes aurora-move {
    0% {
        background:
            radial-gradient(circle at 10% 10%, rgba(99, 102, 241, 0.2) 0%, transparent 45%),
            radial-gradient(circle at 90% 90%, rgba(168, 85, 247, 0.15) 0%, transparent 45%),
            radial-gradient(circle at 50% 10%, rgba(6, 182, 212, 0.08) 0%, transparent 45%),
            radial-gradient(circle at 50% 50%, #020617 0%, #000 100%);
    }

    100% {
        background:
            radial-gradient(circle at 80% 20%, rgba(99, 102, 241, 0.25) 0%, transparent 55%),
            radial-gradient(circle at 20% 80%, rgba(168, 85, 247, 0.2) 0%, transparent 55%),
            radial-gradient(circle at 90% 50%, rgba(6, 182, 212, 0.12) 0%, transparent 55%),
            radial-gradient(circle at 50% 50%, #020617 0%, #000 100%);
    }
}

/* Elementos Flutuantes (Orbs) */
.bg-elements {
    position: fixed;
    inset: 0;
    overflow: hidden;
    z-index: -1;
    pointer-events: none;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.15;
    animation: float-around 30s infinite alternate linear;
}

.orb:nth-child(1) {
    width: 40vw;
    height: 40vw;
    top: -10vw;
    left: -10vw;
    background: var(--accent);
    animation-duration: 35s;
}

.orb:nth-child(2) {
    width: 30vw;
    height: 30vw;
    bottom: -5vw;
    right: -5vw;
    background: var(--secondary);
    animation-duration: 28s;
    animation-delay: -7s;
}

.orb:nth-child(3) {
    width: 25vw;
    height: 25vw;
    top: 40%;
    left: 65%;
    background: var(--tertiary);
    animation-duration: 40s;
    animation-delay: -15s;
}

.orb:nth-child(4) {
    width: 20vw;
    height: 20vw;
    bottom: 20%;
    left: 15%;
    background: #ffffff;
    opacity: 0.04;
    animation-duration: 22s;
}

@keyframes float-around {
    0% {
        transform: translate(0, 0) scale(1) rotate(0deg);
    }

    33% {
        transform: translate(8vw, 6vh) scale(1.1) rotate(120deg);
    }

    66% {
        transform: translate(-4vw, 12vh) scale(0.9) rotate(240deg);
    }

    100% {
        transform: translate(4vw, -4vh) scale(1) rotate(360deg);
    }
}


#app {
    display: flex;
    flex-direction: column;
    height: 100%;
    z-index: 1;
}

header {
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(15px);
    background: rgba(5, 7, 10, 0.4);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-container {
    display: flex;
    align-items: center;
}

.logo-container img {
    height: 42px;
    width: auto;
    filter: drop-shadow(0 0 12px var(--accent-glow)) drop-shadow(0 0 20px var(--secondary-glow));
}

.user-badge {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    padding: 0.4rem 1rem;
    border-radius: 99px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    backdrop-filter: blur(5px);
}

.help-link {
    background: transparent;
    border: none;
    color: var(--tertiary);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.4rem;
    transition: all 0.3s;
    text-shadow: 0 0 10px var(--tertiary-glow);
}

.help-link:hover {
    opacity: 0.8;
}

.user-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-left: 1px solid var(--glass-border);
    padding-left: 0.75rem;
    font-size: 0.9rem;
}

#my-name {
    background: linear-gradient(135deg, var(--accent), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 12px var(--success);
}

/* Main Content */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 2rem;
    padding-bottom: 8rem;
    /* Move content slightly up */
}

.discovery-view {
    text-align: center;
    width: 100%;
    max-width: 900px;
}

.peers-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 1000px;
    margin-bottom: 3rem;
}

.peer-card {
    width: 180px;
    /* Largura fixa para não esticar no PC */
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    padding: 2rem 1.5rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.peer-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--accent), var(--secondary), var(--tertiary));
    opacity: 0;
    transition: opacity 0.3s;
}

.peer-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--secondary);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 20px var(--secondary-glow);
}

.peer-card:hover::before {
    opacity: 0.1;
}

.peer-avatar {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    display: block;
    filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.3));
}

.peer-name {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.peer-status {
    font-size: 0.8rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.5rem;
}

.radar {
    position: relative;
    width: 140px;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.radar-circle {
    position: absolute;
    inset: 0;
    border: 2px solid var(--tertiary);
    border-radius: 50%;
    opacity: 0;
    animation: radar-ping 3s infinite cubic-bezier(0, 0, 0.2, 1);
    box-shadow: 0 0 15px var(--tertiary-glow);
}

.radar-circle:nth-child(2) {
    animation-delay: 1s;
}

.radar-circle:nth-child(3) {
    animation-delay: 2s;
}

@keyframes radar-ping {
    0% {
        transform: scale(0.5);
        opacity: 0.8;
    }

    100% {
        transform: scale(2.5);
        opacity: 0;
    }
}

/* Sidebar / History & QR */
.side-tools {
    position: fixed;
    right: 2rem;
    bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    z-index: 50;
}

.tool-btn {
    width: 60px;
    height: 60px;
    border-radius: 20px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-btn:hover {
    background: linear-gradient(135deg, var(--accent), var(--secondary));
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 10px 25px var(--accent-glow), 0 0 15px var(--secondary-glow);
    border-color: transparent;
}

/* QR Code Section */
.qr-container {
    background: rgba(255, 255, 255, 0.95);
    padding: 1.5rem;
    border-radius: 24px;
    margin-bottom: 1.5rem;
    display: none;
    animation: slideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5), 0 0 20px var(--accent-glow);
    border: 1px solid var(--glass-border);
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Modals */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--glass-border);
    padding: 2.5rem;
    border-radius: 40px;
    width: 95%;
    max-width: 440px;
    text-align: center;
    transform: scale(0.9) translateY(20px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(25px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.overlay.active .modal {
    transform: scale(1) translateY(0);
}

.progress-track {
    background: rgba(255, 255, 255, 0.05);
    height: 12px;
    border-radius: 6px;
    margin: 2rem 0;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--secondary), var(--tertiary));
    width: 0%;
    transition: width 0.4s cubic-bezier(0.1, 0.7, 0.1, 1);
    box-shadow: 0 0 20px var(--accent-glow);
    position: relative;
    border-radius: 6px;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: progress-shine 2s infinite linear;
}

@keyframes progress-shine {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--glass-border);
    border-top: 4px solid var(--tertiary);
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    animation: spin 1s linear infinite;
    box-shadow: 0 0 15px var(--tertiary-glow);
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Toasts */
#toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 9999;
}

.toast {
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    padding: 1.25rem 1.75rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    animation: toastIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    min-width: 300px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6), 0 0 15px var(--accent-glow);
    font-weight: 500;
}

@keyframes toastIn {
    from {
        transform: translateX(100%) scale(0.8);
        opacity: 0;
    }

    to {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

/* Utilities & Effects */
.drag-over {
    background: rgba(99, 102, 241, 0.05);
    border: 2px dashed var(--accent) !important;
    border-radius: 40px;
}

.hidden {
    display: none !important;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--secondary));
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
    padding: 12px 30px;
    border-radius: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent-glow), 0 0 15px var(--secondary-glow);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--text-dim);
}

@media (max-width: 600px) {
    header {
        padding: 0.8rem 1rem;
        background: rgba(5, 7, 10, 0.8);
    }

    .logo-container img {
        height: 28px;
        /* Slightly smaller logo */
    }

    .user-badge {
        padding: 0.25rem 0.6rem;
        gap: 0.4rem;
    }

    .help-link {
        font-size: 0.7rem;
        padding: 0.2rem;
        white-space: nowrap;
    }

    /* Remove the 'Ajuda' overrides */
    #btn-help {
        font-size: 0.7rem !important;
    }

    #btn-help::after {
        display: none;
    }

    .user-status {
        padding-left: 0.4rem;
        font-size: 0.75rem;
        gap: 0.3rem;
    }

    .user-status span {
        display: inline;
        /* Restore 'Você:' */
    }

    .user-status strong {
        font-weight: 600;
    }

    .peers-grid {
        display: flex;
        justify-content: center;
        gap: 1.5rem;
        padding: 1rem;
    }

    .peer-card {
        width: 140px;
        /* Tamanho ajustado para mobile */
        padding: 1.5rem 1rem;
    }

    #btn-qr {
        display: none !important;
    }
}