/* ═══════════════════════════════════════════════════════════════════════════
   🍎 LAN FRUITSHARE - CYBERPUNK ANGULAR CORE
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;600;800;900&family=JetBrains+Mono:wght@300;500&display=swap');

:root {
    --primary: #ef4444;
    /* Cyber Red */
    --primary-dim: rgba(239, 68, 68, 0.2);
    --bg-dark: #050505;
    --surface: #0f0f11;
    --border-color: rgba(239, 68, 68, 0.4);
    --grid-line: rgba(239, 68, 68, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: #fff;
    font-family: 'JetBrains Mono', monospace;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* ─────────────────────────────────────────────────────────────────────────
   BACKGROUND FX
   ───────────────────────────────────────────────────────────────────────── */
/* 1. Tech Grid */
.cyber-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 50px 50px;
    opacity: 0.3;
    z-index: 0;
    perspective: 1000px;
    transform-style: preserve-3d;
}

/* 2. Radar Scan (Chỉ hiện khi chưa có peers hoặc làm nền) */
.radar-scan {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150vmax;
    height: 150vmax;
    border-radius: 50%;
    background: conic-gradient(from 0deg, transparent 0%, transparent 340deg, var(--primary-dim) 360deg);
    animation: radarSpin 5s linear infinite;
    z-index: 1;
    pointer-events: none;
    opacity: 0.3;
}

@keyframes radarSpin {
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* 3. Vignette & Scanlines */
.screen-fx {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle, transparent 60%, rgba(0, 0, 0, 0.8) 100%);
    z-index: 2;
    pointer-events: none;
}

.screen-fx::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    background-size: 100% 2px, 3px 100%;
}

/* ─────────────────────────────────────────────────────────────────────────
   LAYOUT
   ───────────────────────────────────────────────────────────────────────── */
.app-layout {
    position: relative;
    z-index: 10;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* HEADER */
.cyber-header {
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    border-bottom: 2px solid var(--border-color);
    background: rgba(5, 5, 5, 0.8);
    backdrop-filter: blur(10px);
}

.brand {
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 4px;
    color: #fff;
    text-shadow: 0 0 10px var(--primary);
    display: flex;
    flex-direction: column;
}

.brand small {
    font-size: 0.6rem;
    color: var(--primary);
    letter-spacing: 2px;
    font-family: 'JetBrains Mono', monospace;
}

/* MY IDENTITY BOX */
.my-id-box {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 24px;
    border: 1px solid var(--primary);
    background: rgba(239, 68, 68, 0.05);
    /* Clip Path: Vát góc */
    clip-path: polygon(15px 0, 100% 0, 100% calc(100% - 15px), calc(100% - 15px) 100%, 0 100%, 0 15px);
}

.my-avatar {
    font-size: 2rem;
}

.my-info div:first-child {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
}

.my-info div:last-child {
    font-size: 0.75rem;
    color: #888;
}

/* REFRESH BUTTON */
.btn-refresh {
    background: transparent;
    border: 1px solid #555;
    color: #555;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    clip-path: polygon(10px 0, 100% 0, 100% 100%, 0 100%, 0 10px);
}

.btn-refresh:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-dim);
}

/* ─────────────────────────────────────────────────────────────────────────
   MAIN CONTENT - GRID
   ───────────────────────────────────────────────────────────────────────── */
.main-grid-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 40px;
    overflow-y: auto;
}

.status-bar {
    margin-bottom: 20px;
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-bar::before {
    content: '';
    width: 10px;
    height: 10px;
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary);
    animation: blink 1s infinite;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

/* PEER GRID */
.peer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}

/* PEER CARD (ANGULAR DESIGN) */
.peer-card {
    position: relative;
    background: linear-gradient(135deg, rgba(20, 20, 25, 0.9), rgba(10, 10, 12, 0.9));
    border: 1px solid var(--border-color);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: all 0.3s ease;

    /* Vát góc mạnh mẽ */
    clip-path: polygon(20px 0, 100% 0,
            100% calc(100% - 20px), calc(100% - 20px) 100%,
            0 100%, 0 20px);
}

.peer-card::before {
    /* Corner Accent */
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    border-top: 2px solid var(--primary);
    border-left: 2px solid var(--primary);
}

.peer-card::after {
    /* Corner Accent */
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    border-bottom: 2px solid var(--primary);
    border-right: 2px solid var(--primary);
}

.peer-card:hover {
    background: rgba(239, 68, 68, 0.1);
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.2);
}

/* AVATAR SIMPLE (No Border/Background) */
.card-avatar-simple {
    font-size: 5rem;
    line-height: 1;
    margin-bottom: 10px;
    filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.5));
    transition: transform 0.3s;
}

.peer-card:hover .card-avatar-simple {
    transform: scale(1.1) rotate(5deg);
}

.peer-name {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 1.2rem;
    color: #fff;
    text-align: center;
}

.peer-detail {
    font-size: 0.75rem;
    color: #888;
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 8px;
    border-left: 2px solid var(--primary);
}

/* ─────────────────────────────────────────────────────────────────────────
   TOAST & UTILS
   ───────────────────────────────────────────────────────────────────────── */
.cyber-toast {
    background: rgba(0, 0, 0, 0.9);
    color: var(--primary);
    border: 1px solid var(--primary);
    padding: 15px 25px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
    clip-path: polygon(10px 0, 100% 0, 100% 100%, 0 100%, 0 10px);
    margin-top: 10px;
}

.hidden {
    display: none !important;
}

/* Upload Overlay inside Card */
.card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(239, 68, 68, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 20;
    flex-direction: column;
}

.peer-card:hover .card-overlay {
    opacity: 1;
}

.card-overlay span {
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    font-size: 1.5rem;
    color: #000;
    text-transform: uppercase;
}

/* ─────────────────────────────────────────────────────────────────────────
   MODALS (Selection, Text, Drop)
   ───────────────────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-box {
    background: var(--surface);
    border: 1px solid var(--primary);
    padding: 30px;
    width: 90%;
    max-width: 600px;
    clip-path: polygon(20px 0, 100% 0, 100% calc(100% - 20px), calc(100% - 20px) 100%, 0 100%, 0 20px);
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.2);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-title {
    font-family: 'Orbitron', sans-serif;
    color: var(--primary);
    font-size: 1.5rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.modal-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.opt-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #333;
    color: #fff;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Orbitron', sans-serif;
}

.opt-btn:hover {
    background: var(--primary-dim);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.opt-btn span:first-child {
    font-size: 2rem;
    color: var(--primary);
}

.modal-close,
.modal-btn {
    padding: 12px;
    font-weight: bold;
    cursor: pointer;
    font-family: 'Orbitron', sans-serif;
    text-transform: uppercase;
}

.modal-close {
    background: transparent;
    border: 1px solid #555;
    color: #888;
    margin-top: 10px;
}

.modal-close:hover {
    border-color: #fff;
    color: #fff;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-btn.cancel {
    background: transparent;
    border: 1px solid #555;
    color: #888;
}

.modal-btn.confirm {
    background: var(--primary);
    border: none;
    color: #000;
}

.modal-btn:hover {
    filter: brightness(1.2);
}

#text-msg-input {
    background: #000;
    border: 1px solid #333;
    color: #fff;
    padding: 15px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    width: 100%;
    resize: vertical;
}

#text-msg-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* GLOBAL DROP OVERLAY */
#global-drop-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drop-content {
    text-align: center;
    color: var(--primary);
    border: 2px dashed var(--primary);
    padding: 50px;
}

.drop-content span {
    font-size: 5rem;
    margin-bottom: 20px;
}

.drop-content h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
}

.drop-content h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
}

/* PROGRESS BAR */
.cyber-progress-bar {
    width: 100%;
    height: 20px;
    background: #111;
    border: 1px solid #333;
    position: relative;
    overflow: hidden;
    clip-path: polygon(5px 0, 100% 0, 100% 100%, 0 100%, 0 5px);
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.1s linear;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.2) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.2) 75%, transparent 75%, transparent);
    background-size: 20px 20px;
    animation: stripeMove 1s linear infinite;
}

@keyframes stripeMove {
    100% {
        background-position: 20px 0;
    }
}

/* ─────────────────────────────────────────────────────────────────────────
   RESPONSIVE (Mobile & Tablet)
   ───────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .cyber-header {
        height: auto;
        padding: 20px;
        flex-direction: column;
        gap: 15px;
    }

    .brand {
        align-items: center;
        text-align: center;
    }

    .my-id-box {
        width: 100%;
        justify-content: center;
    }

    .main-grid-container {
        padding: 20px;
    }

    .peer-grid {
        gap: 15px;
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .peer-card {
        padding: 20px 10px;
        clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
    }

    .card-avatar-simple {
        font-size: 3.5rem;
    }

    .peer-name {
        font-size: 0.9rem;
    }

    .card-overlay span {
        font-size: 1rem;
    }
}