/* =========================================
   AetherLink Web — Responsive Edition
   ========================================= */

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

html, body {
    height: 100%;
    overflow: hidden;
    font-family: 'Tajawal', sans-serif;
    background: #020a18;
    color: #dde4f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Canvas Particle Background ─────────── */
#bg-canvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

/* خلفية متحركة إضافية تظهر خلف البطاقة */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 40% 50%, rgba(58,123,213,0.25) 0%, rgba(2,10,24,0) 60%),
                radial-gradient(circle at 70% 30%, rgba(155,89,182,0.18) 0%, rgba(2,10,24,0) 50%);
    animation: bgRotate 25s linear infinite;
    z-index: 1;
    pointer-events: none;
}

@keyframes bgRotate {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ── Main Glass Container — Responsive ── */
.glass-container {
    z-index: 10;
    display: flex;
    width: 100%;
    height: 100vh;
    max-height: 100%;
    margin: auto;
    background: rgba(100, 100, 100, 0.18);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 0;
    flex-direction: column;
    transition: all 0.3s ease;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255,255,255,0.05);
}

/* ── Responsive Breakpoints ────────────── */

/* الهاتف الصغير (أقل من 480px) */
@media (max-width: 479px) {
    .glass-container {
        width: 100%;
        height: 100vh;
        border-radius: 0;
        max-width: 100%;
    }
    
    .messages-section-full {
        max-height: calc(100vh - 140px);
    }
    
    .file-msg-box {
        max-width: 240px;
    }
    
    .file-preview {
        height: 140px;
    }
    
    .app-title {
        font-size: 1.3rem !important;
    }
    
    .header-sub {
        font-size: 0.65rem !important;
    }
    
    .device-chip-name {
        font-size: 0.7rem !important;
    }
    
    .qr-box {
        width: 160px !important;
        height: 160px !important;
    }
    
    .share-btn {
        padding: 8px 12px !important;
        font-size: 0.75rem !important;
    }
    
    .home-content {
        padding: 16px 14px !important;
        gap: 20px !important;
    }
    
    .app-header {
        padding: 12px 14px !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 10px !important;
    }
    
    .header-left {
        gap: 4px !important;
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        width: 100% !important;
    }
    
    .app-title {
        text-align: center !important;
    }
    
    .header-sub {
        text-align: center !important;
    }
    
    .header-right {
        gap: 8px !important;
        justify-content: center !important;
        width: 100% !important;
    }
}

/* الهاتف المتوسط (480px - 767px) */
@media (min-width: 480px) and (max-width: 767px) {
    .glass-container {
        width: 95%;
        height: calc(100vh - 20px);
        border-radius: 20px;
        max-width: 500px;
    }
    
    .app-title {
        font-size: 1.4rem !important;
        text-align: center !important;
    }
    
    .app-header {
        flex-direction: column !important;
        align-items: center !important;
        gap: 10px !important;
    }
    
    .header-left {
        flex-direction: column !important;
        align-items: center !important;
        gap: 2px !important;
        width: 100% !important;
        text-align: center !important;
    }
    
    .header-right {
        justify-content: center !important;
        width: 100% !important;
    }
    
    .header-sub {
        display: block !important;
        font-size: 0.7rem !important;
        text-align: center !important;
    }
}

/* التابلت (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .glass-container {
        width: 94%;
        height: calc(100vh - 30px);
        border-radius: 24px;
        max-width: 980px;
    }
    
    .header-left {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 2px !important;
    }
    
    .header-sub {
        display: block !important;
    }
}

/* الحاسوب الصغير (1024px - 1439px) */
@media (min-width: 1024px) and (max-width: 1439px) {
    .glass-container {
        width: 92%;
        height: calc(100vh - 40px);
        border-radius: 28px;
        max-width: 1280px;
    }
    
    .header-left {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 2px !important;
    }
    
    .header-sub {
        display: block !important;
    }
}

/* الحاسوب الكبير (1440px+) */
@media (min-width: 1440px) {
    .glass-container {
        width: 88%;
        height: calc(100vh - 50px);
        border-radius: 32px;
        max-width: 1600px;
    }
    
    .header-left {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 4px !important;
    }
    
    .header-sub {
        display: block !important;
        font-size: 0.85rem !important;
    }
    
    .app-title {
        font-size: 1.8rem !important;
    }
    
    .qr-box {
        width: 220px !important;
        height: 220px !important;
    }
    
    .home-content {
        padding: 32px 28px !important;
        gap: 36px !important;
    }
}

/* الشاشات العملاقة (1920px+) */
@media (min-width: 1920px) {
    .glass-container {
        width: 82%;
        height: calc(100vh - 60px);
        border-radius: 36px;
        max-width: 1800px;
    }
    
    .app-title {
        font-size: 2rem !important;
    }
    
    .qr-box {
        width: 260px !important;
        height: 260px !important;
    }
}

.glass-container.hidden { 
    display: none; 
}

/* ── App Layout (fills card) ─────────── */
.app-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    margin: 0 auto;
}

/* ── Header ─────────────────────────────── */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 22px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
    gap: 12px;
}

.header-left  { 
    display: flex; 
    align-items: flex-start; 
    gap: 4px; 
    flex: 1; 
    min-width: 0;
    flex-direction: column;
}

.header-right { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    flex-shrink: 0;
}

.app-title {
    font-size: 1.55rem;
    font-weight: 950;
    background: linear-gradient(120deg, #00d2ff 0%, #3a7bd5 60%, #9b59b6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
    white-space: nowrap;
    line-height: 1.2;
}

.header-sub {
    font-size: 0.75rem;
    color: #8899aa;
    white-space: nowrap;
    display: block;
    margin-top: 2px;
}

.conn-badge {
    font-size: 0.72rem;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 700;
    white-space: nowrap;
}
.conn-badge.success { color: #43e97b; background: rgba(67,233,123,0.12); border: 1px solid rgba(67,233,123,0.25); }
.conn-badge.error   { color: #ff6b6b; background: rgba(255,107,107,0.12); border: 1px solid rgba(255,107,107,0.25); }
.conn-badge.warn    { color: #ffc107; background: rgba(255,193,7,0.12); border: 1px solid rgba(255,193,7,0.25); }

/* Device Name Chip */
.device-chip {
    display: flex;
    align-items: center;
    gap: 0px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 5px 5px;
    font-size: 0.78rem;
    max-width: 140px;
    overflow: hidden;
}

.device-chip-name {
    font-weight: 700;
    color: #00d2ff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.icon-btn {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    cursor: pointer;
    color: #8899aa;
    font-size: 0.6rem;
    padding: 5px 8px;
    transition: color 0.2s, background 0.2s;
    line-height: 1;
}
.icon-btn:hover { color: #fff; background: rgba(255,255,255,0.12); }

/* ── Home Content ───────────────────────── */
.home-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
}

/* QR Section */
.qr-section { text-align: center; width: 100%; max-width: 360px; }

.qr-box {
    width: 190px;
    height: 190px;
    background: #fff;
    border-radius: 18px;
    margin: 0 auto 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.1);
    overflow: hidden;
}

.qr-box img { width: 100%; height: 100%; display: block; border-radius: 14px; }

.scan-hint  { font-size: 0.85rem; color: #8899aa; margin-bottom: 6px; }
.wait-status {
    font-size: 0.82rem;
    color: #00d2ff;
    margin-bottom: 18px;
    min-height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.wait-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: #00d2ff;
    animation: blink 1.4s ease-in-out infinite;
}
@keyframes blink { 0%,100% { opacity:1; } 50% { opacity:0.2; } }

/* Share Buttons */
.share-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 24px;
    border: none;
    cursor: pointer;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    transition: transform 0.15s, box-shadow 0.15s;
}
.share-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.4); }

.btn-copy     { background: rgba(255,255,255,0.08); color: #dde; border: 1px solid rgba(255,255,255,0.14); }
.btn-whatsapp { background: #25D366; color: #fff; }
.btn-share    { background: linear-gradient(135deg, #00d2ff, #3a7bd5); color: #fff; }

/* Previous Devices */
.prev-section { width: 100%; max-width: 420px; }

.section-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: #667;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.prev-list { display: flex; flex-direction: column; gap: 7px; }

.prev-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 12px;
    padding: 10px 14px;
    transition: background 0.2s;
}
.prev-item:hover { background: rgba(255,255,255,0.07); }

.prev-icon { font-size: 1.3rem; flex-shrink: 0; }
.prev-name { flex: 1; font-weight: 700; font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prev-time { font-size: 0.72rem; color: #667; white-space: nowrap; }

/* ── Peers Panel ─────────────────────────── */
.peers-panel {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 22px;
    background: rgba(0,0,0,0.25);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
    flex-wrap: wrap;
    min-height: 44px;
}

.peers-count {
    font-size: 0.76rem;
    padding: 3px 11px;
    border-radius: 14px;
    background: rgba(0,210,255,0.1);
    color: #00d2ff;
    font-weight: 700;
    border: 1px solid rgba(0,210,255,0.2);
    white-space: nowrap;
    flex-shrink: 0;
}

.peer-chips { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }

.peer-chip {
    font-size: 0.73rem;
    padding: 3px 10px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    white-space: nowrap;
}

.broadcast-btn {
    display: none;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: #fff;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    transition: transform 0.15s, opacity 0.15s;
    flex-shrink: 0;
}
.broadcast-btn.visible { display: inline-flex; }
.broadcast-btn:hover { transform: scale(1.05); }

/* ── Messages Section Full (no transfer) ── */
.messages-section-full {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.messages-list {
    flex: 1;
    overflow-y: auto;
    padding: 14px 22px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.msg {
    display: flex;
    flex-direction: column;
    max-width: 78%;
    gap: 3px;
    animation: msgSlideIn 0.25s ease;
}
@keyframes msgSlideIn { 
    from { opacity:0; transform:translateY(10px); } 
    to { opacity:1; transform:none; } 
}

.msg.sent     { align-self: flex-end; }
.msg.received { align-self: flex-start; }

.msg-sender { 
    font-size: 0.7rem; 
    color: #667; 
    padding: 0 6px; 
}

.msg-time {
    font-size: 0.65rem;
    color: #556;
    padding: 0 6px;
    margin-top: 2px;
}

.msg-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 0.9rem;
    line-height: 1.5;
    word-break: break-word;
}
.msg.sent .msg-bubble {
    background: linear-gradient(135deg, #1565c0, #1976d2);
    color: #fff;
    border-radius: 18px 4px 18px 18px;
}
.msg.received .msg-bubble {
    background: rgba(255,255,255,0.09);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 4px 18px 18px 18px;
    color: #dde4f0;
}

/* ── File Message Box ───────────────────── */
.file-msg-box {
    display: flex;
    flex-direction: column;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 16px;
    overflow: hidden;
    max-width: 280px;
    transition: transform 0.2s, box-shadow 0.2s;
}
.file-msg-box:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
}
.file-msg-box.sending,
.file-msg-box.receiving {
    border-color: rgba(0,210,255,0.3);
}

.file-preview {
    width: 100%;
    height: 160px;
    background: rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.file-preview img,
.file-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-preview .file-icon {
    font-size: 3.5rem;
    opacity: 0.8;
}

.file-preview-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}
.file-msg-box:not(.sending):not(.receiving):hover .file-preview-overlay {
    opacity: 1;
}

.file-preview-overlay span {
    font-size: 2rem;
}

.file-info {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.file-name {
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #dde4f0;
}

.file-meta {
    font-size: 0.72rem;
    color: #8899aa;
}

.file-progress {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 4px;
}

.file-progress-bar {
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    overflow: hidden;
}

.file-progress-inner {
    height: 100%;
    background: linear-gradient(90deg, #00d2ff, #3a7bd5);
    border-radius: 2px;
    transition: width 0.2s linear;
}

.file-progress-inner.done {
    background: linear-gradient(90deg, #43e97b, #38f9d7);
}

.file-progress-inner.error {
    background: #ff6b6b;
}

.file-pct {
    font-size: 0.72rem;
    color: #00d2ff;
    font-weight: 700;
    text-align: left;
}

.tr-status.done {
    color: #43e97b !important;
}
.tr-status.error {
    color: #ff6b6b !important;
}

.file-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.file-action-btn {
    flex: 1;
    padding: 7px 12px;
    border: none;
    border-radius: 10px;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.file-action-btn.download {
    background: linear-gradient(135deg, #00d2ff, #3a7bd5);
    color: #fff;
}
.file-action-btn.download:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,210,255,0.35);
}

.file-action-btn.delete {
    background: rgba(255,107,107,0.15);
    border: 1px solid rgba(255,107,107,0.35);
    color: #ff9999;
}
.file-action-btn.delete:hover {
    background: rgba(255,107,107,0.28);
}

/* ── Full Screen Viewer ─────────────────── */
.fullscreen-viewer {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.95);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.fullscreen-viewer img,
.fullscreen-viewer video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 12px;
}

.fullscreen-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.fullscreen-close:hover {
    background: rgba(255,107,107,0.5);
    border-color: #ff6b6b;
}

/* ── Connected Users Modal ──────────────── */
.users-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.users-modal {
    background: rgba(6, 18, 38, 0.98);
    backdrop-filter: blur(24px);
    border: 1px solid rgba(255,255,255,0.13);
    border-radius: 22px;
    padding: 24px;
    width: 90%;
    max-width: 360px;
}

.users-modal h3 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    text-align: center;
    color: #00d2ff;
}

.users-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
    max-height: 200px;
    overflow-y: auto;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
}

.user-item .user-icon {
    font-size: 1.3rem;
}

.user-item .user-name {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 700;
}

.users-modal-close {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 12px;
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}
.users-modal-close:hover {
    background: rgba(255,255,255,0.15);
}

/* ── Header Action Buttons ──────────────── */
.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.header-action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 12px;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.header-action-btn.end-session {
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    color: #fff;
}
.header-action-btn.end-session:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(255,107,107,0.4);
}

.header-action-btn.show-users {
    background: linear-gradient(135deg, #00d2ff, #3a7bd5);
    color: #fff;
}
.header-action-btn.show-users:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0,210,255,0.35);
}

.header-action-btn.group-link {
    background: linear-gradient(135deg, #43e97b, #38f9d7);
    color: #020a18;
}
.header-action-btn.group-link:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(67,233,123,0.4);
}

/* ── File Input Button ──────────────────── */
.file-input-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    color: #dde4f0;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}
.file-input-btn:hover {
    background: rgba(0,210,255,0.2);
    border-color: rgba(0,210,255,0.4);
    transform: scale(1.1);
}

/* Message Input Bar — Always Visible */
.msg-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-top: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
    background: rgba(0,0,0,0.2);
}

.msg-field {
    flex: 1;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.11);
    border-radius: 24px;
    padding: 10px 18px;
    color: #dde;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
    direction: rtl;
    text-align: right;
}
.msg-field:focus { border-color: rgba(0,210,255,0.45); }
.msg-field::placeholder { color: #667; }

.send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, #00d2ff, #3a7bd5);
    color: #fff;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.15s, box-shadow 0.15s;
}
.send-btn:hover { transform: scale(1.1); box-shadow: 0 4px 16px rgba(0,210,255,0.35); }

/* ── Loader / Center Content ─────────────── */
.center-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 30px;
}

.instructions { font-size: 0.95rem; color: #8899aa; text-align: center; }

.loader {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.08);
    border-top-color: #00d2ff;
    animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Action Buttons ──────────────────────── */
.action-button {
    background: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 100%);
    color: #fff;
    border: none;
    padding: 11px 22px;
    border-radius: 24px;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    white-space: nowrap;
}
.action-button:hover { transform: scale(1.04); box-shadow: 0 5px 18px rgba(0,210,255,0.3); }

.action-button.secondary {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: #bbc;
}
.action-button.secondary:hover { background: rgba(255,255,255,0.13); box-shadow: none; }

.action-button.small { padding: 7px 14px; font-size: 0.78rem; }

/* ── Mini Floating Widget ────────────────── */
#mini-widget {
    position: fixed;
    bottom: 22px;
    left: 22px;
    z-index: 100;
    background: rgba(4, 14, 30, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.13);
    border-radius: 40px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 9px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.6);
    cursor: grab;
    user-select: none;
    touch-action: none;
    transition: box-shadow 0.2s;
}
#mini-widget:active { cursor: grabbing; box-shadow: 0 12px 40px rgba(0,0,0,0.8); }
#mini-widget.hidden { display: none; }

.mini-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #445;
    flex-shrink: 0;
    transition: background 0.3s;
}
.mini-dot.on {
    background: #43e97b;
    box-shadow: 0 0 7px rgba(67,233,123,0.7);
    animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{ opacity:1; } 50%{ opacity:0.5; } }

#mini-label       { font-size: 0.82rem; font-weight: 700; color: #00d2ff; }
#mini-peer-count  { font-size: 0.72rem; color: #667; }

#mini-expand-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.07);
    cursor: pointer;
    color: #aab;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}
#mini-expand-btn:hover { background: rgba(255,255,255,0.18); color: #fff; }

/* ── Picture-in-Picture Container ───────── */
#pip-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    width: 320px;
    height: 240px;
    background: rgba(4, 14, 30, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 2px solid rgba(0,210,255,0.3);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.8);
    overflow: hidden;
    cursor: grab;
    user-select: none;
    touch-action: none;
    transition: transform 0.2s, box-shadow 0.2s;
}

#pip-container.hidden { display: none !important; }

#pip-container:active { cursor: grabbing; }

#pip-container:hover {
    box-shadow: 0 16px 50px rgba(0,210,255,0.2);
    border-color: rgba(0,210,255,0.5);
}

#pip-video-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(0,210,255,0.1), rgba(58,123,213,0.1));
}

#pip-video-container::before {
    content: 'AetherLink';
    font-size: 1.5rem;
    font-weight: 900;
    background: linear-gradient(120deg, #00d2ff 0%, #3a7bd5 60%, #9b59b6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#pip-video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 14px;
}

/* Pip Controls */
.pip-controls {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    gap: 6px;
}

.pip-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(0,0,0,0.5);
    color: #fff;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.pip-btn:hover {
    background: rgba(0,210,255,0.3);
    border-color: rgba(0,210,255,0.5);
}

/* Pip Status */
.pip-status {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.7rem;
    color: #00d2ff;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pip-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #43e97b;
    animation: pulse 2s ease-in-out infinite;
}

/* Pip Responsive */
@media (max-width: 479px) {
    #pip-container {
        width: 200px;
        height: 150px;
        top: 10px;
        right: 10px;
        border-radius: 12px;
    }
}

@media (min-width: 1440px) {
    #pip-container {
        width: 400px;
        height: 300px;
    }
}

/* ── Notifications ───────────────────────── */
.toast {
    position: fixed;
    top: 18px;
    left: 50%;
    transform: translateX(-50%) translateY(-80px);
    padding: 11px 22px;
    border-radius: 14px;
    font-size: 0.85rem;
    font-weight: 700;
    z-index: 999;
    transition: transform 0.3s cubic-bezier(.34,1.56,.64,1);
    white-space: nowrap;
    box-shadow: 0 8px 30px rgba(0,0,0,0.5);
    pointer-events: none;
    max-width: 90vw;
    text-align: center;
    font-family: 'Tajawal', sans-serif;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { background: rgba(43,150,80,0.95); color: #fff; }
.toast.error   { background: rgba(200,50,50,0.95); color: #fff; }
.toast.warning { background: rgba(180,130,20,0.95); color: #fff; }
.toast.info    { background: rgba(0,100,200,0.9); color: #fff; }

/* ── Reconnect Modal ─────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.72);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

.modal-box {
    background: rgba(6, 18, 38, 0.97);
    backdrop-filter: blur(24px);
    border: 1px solid rgba(255,255,255,0.13);
    border-radius: 22px;
    padding: 32px 28px;
    text-align: center;
    max-width: 360px;
    width: 90%;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.7);
}

.modal-box h3 { font-size: 1.05rem; color: #00d2ff; }
.modal-box p  { font-size: 0.85rem; color: #8899aa; }
.modal-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ── Device Name Edit Inline ─────────────── */
.name-edit-field {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(0,210,255,0.4);
    border-radius: 8px;
    color: #00d2ff;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 3px 8px;
    outline: none;
    width: 130px;
}

/* ── Scrollbars ──────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* ── Landscape Mode for Mobile ──────────── */
@media (max-height: 500px) and (orientation: landscape) {
    .glass-container {
        height: 100vh;
        border-radius: 0;
        width: 100%;
    }
    
    .home-content {
        padding: 12px 16px;
        gap: 16px;
    }
    
    .qr-box {
        width: 120px !important;
        height: 120px !important;
    }
    
    .app-header {
        padding: 8px 14px;
    }
    
    .messages-section-full {
        max-height: 120px;
    }
}
/* ══════════════════════════════════════════
   Local Discovery — Mode Tabs & Device Cards
   ══════════════════════════════════════════ */

/* ── Mode Tabs ──────────────────────────── */
.mode-tabs {
    display: flex;
    gap: 6px;
    padding: 10px 16px 0;
    flex-shrink: 0;
    background: transparent;
}

.mode-tab {
    flex: 1;
    padding: 10px 8px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-bottom: 2px solid transparent;
    border-radius: 12px 12px 0 0;
    color: #8899aa;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.22s ease;
    white-space: nowrap;
}

.mode-tab:hover {
    background: rgba(0,210,255,0.07);
    color: #aac8e0;
}

.mode-tab.active {
    background: rgba(0,210,255,0.1);
    border-color: rgba(0,210,255,0.25) rgba(0,210,255,0.25) transparent;
    color: #00d2ff;
}

/* ── Tab Panels ─────────────────────────── */
.tab-panel {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    /* ✅ Hide scrollbar — internet panel */
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.tab-panel::-webkit-scrollbar { display: none; }

.tab-panel.hidden { display: none !important; }

/* ── Local Discovery Panel ─────────────── */
.local-discovery-panel {
    padding: 16px 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 1;
}

.local-scan-header {
    text-align: center;
    padding: 20px 12px 16px;
}

.local-scan-icon {
    font-size: 2.6rem;
    display: block;
    margin-bottom: 10px;
    transition: transform 0.3s;
}

.local-scan-icon.scanning {
    animation: scanWave 1.4s ease-in-out infinite;
}

@keyframes scanWave {
    0%, 100% { transform: scale(1);    opacity: 1;   }
    50%       { transform: scale(1.18); opacity: 0.65; }
}

.local-scan-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: #dde4f0;
    margin-bottom: 6px;
}

.local-scan-subtitle {
    font-size: 0.8rem;
    color: #8899aa;
    line-height: 1.6;
    margin-bottom: 18px;
}

.local-scan-subtitle small {
    color: #43e97b;
    font-size: 0.75rem;
}

/* ── Device List ─────────────────────────── */
.local-devices-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.local-no-devices {
    text-align: center;
    padding: 28px 16px;
    color: #8899aa;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.local-no-devices p  { font-size: 0.9rem; color: #aabbc8; }
.local-no-devices small { font-size: 0.75rem; color: #667788; }

/* Pulse ring animation */
.local-pulse-ring {
    width: 52px;
    height: 52px;
    border: 3px solid rgba(0,210,255,0.5);
    border-radius: 50%;
    position: relative;
    animation: localRing 1.6s ease-out infinite;
}

.local-pulse-ring::after {
    content: '📶';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.4rem;
}

@keyframes localRing {
    0%   { transform: scale(0.75); opacity: 1;   border-color: rgba(0,210,255,0.8); }
    100% { transform: scale(1.9);  opacity: 0;   border-color: rgba(0,210,255,0);   }
}

.local-found-label {
    font-size: 0.78rem;
    color: #43e97b;
    text-align: center;
    letter-spacing: 0.03em;
    font-weight: 700;
    padding-bottom: 4px;
}

/* ── Device Card ─────────────────────────── */
.local-device-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    background: rgba(0,210,255,0.05);
    border: 1px solid rgba(0,210,255,0.14);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.local-device-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(0,210,255,0.08) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.2s;
}

.local-device-card:hover {
    background: rgba(0,210,255,0.1);
    border-color: rgba(0,210,255,0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,210,255,0.12);
}

.local-device-card:hover::before { opacity: 1; }

.local-device-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #43e97b;
    flex-shrink: 0;
    box-shadow: 0 0 8px rgba(67,233,123,0.6);
    animation: dotPulse 2s ease-in-out infinite;
}

@keyframes dotPulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.45; }
}

.local-device-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.local-device-name {
    font-size: 0.92rem;
    font-weight: 700;
    color: #dde4f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.local-device-status {
    font-size: 0.73rem;
    color: #43e97b;
}

.local-device-status.connected {
    color: #00d2ff;
    font-weight: 700;
}

.local-device-dot.connected {
    background: #00d2ff;
    box-shadow: 0 0 8px rgba(0,210,255,0.7);
}

.local-connect-btn.new-session {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: #020a18;
}

.local-connect-btn {
    background: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 100%);
    border: none;
    border-radius: 12px;
    padding: 8px 16px;
    color: #fff;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.2s, transform 0.15s;
    position: relative;
    z-index: 1;
}

.local-connect-btn:hover  { opacity: 0.85; transform: scale(1.04); }
.local-connect-btn:active { transform: scale(0.97); }
.local-connect-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Incoming Invite Modal ─────────────── */
.local-invite-box {
    text-align: center;
}

.local-invite-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
    animation: invitePulse 1.2s ease-in-out infinite;
}

@keyframes invitePulse {
    0%, 100% { transform: scale(1);    }
    50%       { transform: scale(1.15); }
}

.local-invite-from {
    font-size: 1.2rem;
    font-weight: 900;
    color: #00d2ff;
    margin: 6px 0 4px;
}

.local-invite-sub {
    font-size: 0.82rem;
    color: #8899aa;
    margin-bottom: 4px;
}
/* ══════════════════════════════════════════
   🏠 زر العودة للرئيسية — Home Button
══════════════════════════════════════════ */
.home-btn {
    background: linear-gradient(135deg, #1a3a5c 0%, #0d2137 100%) !important;
    border: 1px solid rgba(0, 210, 255, 0.45) !important;
    color: #00d2ff !important;
    font-weight: 700 !important;
    padding: 6px 14px !important;
    border-radius: 20px !important;
    font-size: 0.82rem !important;
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
    box-shadow: 0 0 12px rgba(0,210,255,0.18), inset 0 1px 0 rgba(255,255,255,0.07) !important;
    transition: all 0.22s ease !important;
    letter-spacing: 0.02em !important;
    white-space: nowrap !important;
}

.home-btn:hover {
    background: linear-gradient(135deg, #1e4a7a 0%, #102840 100%) !important;
    border-color: rgba(0, 210, 255, 0.75) !important;
    box-shadow: 0 0 20px rgba(0,210,255,0.35), inset 0 1px 0 rgba(255,255,255,0.1) !important;
    transform: translateY(-1px) !important;
    color: #40e0ff !important;
}

.home-btn:active {
    transform: translateY(0) scale(0.97) !important;
    box-shadow: 0 0 8px rgba(0,210,255,0.2) !important;
}

/* ══════════════════════════════════════════
   ✕ زر إلغاء الإرسال
══════════════════════════════════════════ */
.file-action-btn.cancel-send {
    background: linear-gradient(135deg, rgba(255, 80, 80, 0.18), rgba(200, 30, 30, 0.25));
    border: 1px solid rgba(255, 100, 100, 0.4);
    color: #ff8080;
    font-size: 0.76rem;
    padding: 5px 10px;
    border-radius: 12px;
    cursor: pointer;
    font-family: 'Tajawal', sans-serif;
    font-weight: 700;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.file-action-btn.cancel-send:hover {
    background: linear-gradient(135deg, rgba(255, 80, 80, 0.32), rgba(200, 30, 30, 0.4));
    border-color: rgba(255, 100, 100, 0.7);
    color: #ffaaaa;
    transform: scale(1.04);
}

.file-action-btn.cancel-send:active {
    transform: scale(0.96);
}

/* ══════════════════════════════════════════
   📋 شريط طابور الملفات المرئي
══════════════════════════════════════════ */
.queue-preview-strip {
    background: rgba(6, 18, 38, 0.92);
    border-top: 1px solid rgba(0, 210, 255, 0.18);
    border-bottom: 1px solid rgba(0, 210, 255, 0.1);
    padding: 8px 12px 6px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 160px;
    flex-shrink: 0;
    backdrop-filter: blur(8px);
}

.queue-strip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.queue-strip-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: rgba(0, 210, 255, 0.75);
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.queue-strip-items {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,210,255,0.3) transparent;
}

.queue-strip-items::-webkit-scrollbar {
    height: 3px;
}
.queue-strip-items::-webkit-scrollbar-track { background: transparent; }
.queue-strip-items::-webkit-scrollbar-thumb {
    background: rgba(0,210,255,0.3);
    border-radius: 2px;
}

.queue-item {
    flex-shrink: 0;
    width: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 6px 4px 4px;
    position: relative;
    transition: background 0.2s;
}

.queue-item:hover {
    background: rgba(255,255,255,0.07);
    border-color: rgba(0,210,255,0.25);
}

.queue-thumb {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.queue-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.queue-thumb-icon {
    font-size: 1.8rem;
    line-height: 1;
}

.queue-item-name {
    font-size: 0.62rem;
    color: #aabbcc;
    text-align: center;
    word-break: break-all;
    line-height: 1.2;
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.queue-item-size {
    font-size: 0.58rem;
    color: rgba(120,160,200,0.65);
    text-align: center;
}

.queue-delete-btn {
    position: absolute;
    top: -5px;
    left: -5px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(255, 70, 70, 0.85);
    border: none;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s;
    z-index: 2;
    padding: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.queue-delete-btn:hover {
    background: rgba(255, 30, 30, 1);
    transform: scale(1.2);
}

.queue-delete-btn:active {
    transform: scale(0.9);
}