/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    min-height: 100vh;
    color: #1a1a1a;
    line-height: 1.6;
    -webkit-tap-highlight-color: transparent;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

.app-container {
    /* max-width: 1200px; */
    width: 100%;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(33, 150, 243, 0.1);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.header-device {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: rgba(255,255,255,0.6);
    border: 1px solid rgba(33,150,243,0.15);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: #0d47a1;
}
.header-device .divider { color: #90caf9; }

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-item.active {
    border-color: #2196f3;
    color: #2196f3;
}

.btn-compact {
    padding: 0.5rem 0.75rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo i {
    font-size: 2rem;
    color: #2196f3;
    animation: pulse 2s infinite;
}

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

.logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, #2196f3, #21cbf3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: opacity 0.2s ease;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 2rem;
    border: 1px solid rgba(33, 150, 243, 0.2);
}

.connection-status i {
    font-size: 0.75rem;
    color: #f44336;
    transition: color 0.3s ease;
}

.connection-status.connected i {
    color: #4caf50;
}

.connection-status span {
    font-size: 0.875rem;
    font-weight: 500;
}

/* Broadcast/Scan animations */
.broadcasting #broadcastIcon {
    animation: pulse 1s infinite;
    color: #2196f3;
}

.scanning #scanIcon {
    animation: spin 1s linear infinite;
    color: #2196f3;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    display: flex;
    justify-content: center;
    align-items: stretch;
}

/* Panels */
.discovery-panel,
.connection-panel,
.transfer-panel,
.incoming-panel {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 1.5rem;
    padding: 2.5rem;
    box-shadow: 0 20px 40px rgba(33, 150, 243, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    max-width: 800px;
    width: 100%;
    transition: all 0.3s ease;
}

/* Wider canvas for the three-column transfer view */
.transfer-panel { max-width: 1400px; margin: 0 auto; width: 100%; height: 100%; }

.panel-header {
    text-align: center;
    margin-bottom: 2rem;
}

.panel-header h2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 0.5rem;
}

.panel-header p {
    color: #666;
    font-size: 1rem;
}

/* Device Info */
.device-info {
    background: rgba(33, 150, 243, 0.1);
    border: 2px solid rgba(33, 150, 243, 0.2);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.device-id-display label {
    display: block;
    font-weight: 500;
    color: #1a1a1a;
    margin-bottom: 0.5rem;
}

.id-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.device-id {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: #2196f3;
    letter-spacing: 0.25rem;
    background: rgba(255, 255, 255, 0.8);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(33, 150, 243, 0.3);
}

/* Discovery Options */
.discovery-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.option-card {
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid rgba(33, 150, 243, 0.1);
    border-radius: 1rem;
    padding: 2rem 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.option-card:hover {
    border-color: #2196f3;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(33, 150, 243, 0.15);
}

.option-icon {
    width: 4rem;
    height: 4rem;
    background: linear-gradient(135deg, #2196f3, #21cbf3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.option-icon i {
    font-size: 1.5rem;
    color: white;
}

.option-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #1a1a1a;
}

.option-card p {
    color: #666;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.btn-primary {
    background: linear-gradient(135deg, #2196f3, #21cbf3);
    color: white;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.9);
    color: #2196f3;
    border: 2px solid #2196f3;
}

.btn-secondary:hover:not(:disabled) {
    background: #2196f3;
    color: white;
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    color: #666;
    border: 2px solid rgba(102, 102, 102, 0.3);
}

.btn-outline:hover:not(:disabled) {
    background: rgba(102, 102, 102, 0.1);
    border-color: #666;
}

.btn-success {
    background: linear-gradient(135deg, #4caf50, #66bb6a);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #f44336, #ef5350);
    color: white;
}

.btn-icon {
    padding: 0.5rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: rgba(33, 150, 243, 0.1);
    color: #2196f3;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Nearby Devices */
.nearby-devices {
    margin-top: 2rem;
}

.nearby-devices h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 1rem;
}

.devices-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.device-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(33, 150, 243, 0.2);
    border-radius: 0.75rem;
    transition: all 0.3s ease;
}

.device-item:hover {
    background: rgba(33, 150, 243, 0.05);
    border-color: #2196f3;
    transform: translateY(-1px);
}

.device-info-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.device-icon {
    width: 2.5rem;
    height: 2.5rem;
    background: linear-gradient(135deg, #2196f3, #21cbf3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
}

.device-details h4 {
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 0.25rem;
}

.device-details p {
    font-size: 0.875rem;
    color: #666;
}

.device-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.device-status.online {
    color: #4caf50;
}

.device-status.offline {
    color: #f44336;
}

/* Device Input */
.device-input {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.device-id-input {
    flex: 1;
    padding: 1rem;
    border: 2px solid rgba(33, 150, 243, 0.2);
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    letter-spacing: 0.125rem;
    font-family: 'Courier New', monospace;
    transition: border-color 0.3s ease;
}

.device-id-input:focus {
    outline: none;
    border-color: #2196f3;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

/* Waiting Message */
.waiting-message {
    text-align: center;
    margin-bottom: 2rem;
}

.spinner {
    width: 3rem;
    height: 3rem;
    border: 3px solid rgba(33, 150, 243, 0.2);
    border-top: 3px solid #2196f3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

/* File Drop Zone */
.file-drop-zone {
    border: 3px dashed rgba(33, 150, 243, 0.3);
    border-radius: 1rem;
    padding: 3rem 2rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    margin-bottom: 2rem;
}

.file-drop-zone:hover,
.file-drop-zone.dragover {
    border-color: #2196f3;
    background: rgba(33, 150, 243, 0.05);
    transform: translateY(-2px);
}

.drop-zone-content i {
    font-size: 3rem;
    color: #2196f3;
    margin-bottom: 1rem;
}

.drop-zone-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #1a1a1a;
}

.drop-zone-content p {
    color: #666;
    font-size: 0.875rem;
}

/* File List */
.file-list {
    margin-bottom: 2rem;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(33, 150, 243, 0.1);
    border-radius: 0.75rem;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
}

.file-item:hover {
    background: rgba(33, 150, 243, 0.05);
    border-color: #2196f3;
}

.file-icon {
    width: 2.5rem;
    height: 2.5rem;
    background: linear-gradient(135deg, #2196f3, #21cbf3);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 500;
    color: #1a1a1a;
    display: block;
    margin-bottom: 0.25rem;
}

.file-size {
    font-size: 0.875rem;
    color: #666;
}

.file-progress {
    width: 100px;
    height: 0.5rem;
    background: rgba(33, 150, 243, 0.2);
    border-radius: 0.25rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2196f3, #21cbf3);
    transition: width 0.3s ease;
    width: 0%;
}

/* Connected Devices */
.connected-devices {
    margin-bottom: 2rem;
}

.connected-devices h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 1rem;
}

.devices-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
}

.connected-device-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(33, 150, 243, 0.2);
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    transition: all 0.2s ease;
}

.connected-device-card:hover {
    background: rgba(33, 150, 243, 0.05);
    border-color: #2196f3;
    transform: translateY(-2px);
}

.connected-device-card h4 { margin: 0; font-weight: 600; color: #1a1a1a; }

.connected-device-card p { margin: 0; font-size: 0.85rem; color: #666; }

.connected-device-card .left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.connected-device-card .device-icon { width: 2rem; height: 2rem; }

.send-file-picker { display:flex; gap:0.75rem; align-items:center; }

/* File Hub */
.file-hub {
    background: rgba(33, 150, 243, 0.05);
    border: 1px solid rgba(33, 150, 243, 0.2);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.file-hub h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 0.5rem;
}

.file-hub p {
    color: #666;
    margin-bottom: 1.5rem;
}

.shared-files {
    margin-top: 1.5rem;
}

.shared-files h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 1rem;
}

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

.shared-file-item {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(33, 150, 243, 0.2);
    border-radius: 0.75rem;
    padding: 1rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.shared-file-item:hover {
    background: rgba(33, 150, 243, 0.1);
    border-color: #2196f3;
    transform: translateY(-2px);
}

.shared-file-item .file-icon {
    width: 2rem;
    height: 2rem;
    margin: 0 auto 0.5rem;
    background: linear-gradient(135deg, #2196f3, #21cbf3);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.875rem;
}
.shared-file-item .file-icon img { width: 100%; height: 100%; object-fit: cover; border-radius: 0.5rem; }

.shared-file-item .file-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: #1a1a1a;
    margin-bottom: 0.25rem;
    word-break: break-word;
}

.shared-file-item .file-size {
    font-size: 0.75rem;
    color: #666;
}

.shared-file-actions {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.btn-mini {
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
    border-radius: 0.5rem;
}

/* Direct Transfer */
.direct-transfer {
    background: rgba(76, 175, 80, 0.05);
    border: 1px solid rgba(76, 175, 80, 0.2);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.direct-transfer h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 0.5rem;
}

.direct-transfer p {
    color: #666;
    margin-bottom: 1.5rem;
}

.transfer-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: center;
}

.device-select {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid rgba(33, 150, 243, 0.2);
    border-radius: 0.75rem;
    font-size: 0.875rem;
    background: white;
    transition: border-color 0.3s ease;
}

.device-select:focus {
    outline: none;
    border-color: #2196f3;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.selected-files {
    margin-top: 1rem;
}

.selected-files h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 1rem;
}

/* Global Controls */
.global-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

/* Acceptance Settings */
.acceptance-settings {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(33, 150, 243, 0.2);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.setting-item {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.setting-item:last-child {
    margin-bottom: 0;
}

.setting-item label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-weight: 500;
    color: #1a1a1a;
}

.setting-item input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    accent-color: #2196f3;
    cursor: pointer;
}

/* Incoming Files */
.incoming-files {
    margin-bottom: 2rem;
}

.incoming-file-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
    border-radius: 0.75rem;
    margin-bottom: 0.5rem;
}

.incoming-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    border-radius: 1.5rem;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1a1a1a;
}

.progress-info {
    text-align: center;
}

.file-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.file-name {
    font-weight: 500;
    color: #1a1a1a;
}

.file-progress {
    font-weight: 600;
    color: #2196f3;
}

.progress-bar {
    width: 100%;
    height: 1rem;
    background: rgba(33, 150, 243, 0.2);
    border-radius: 0.5rem;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2196f3, #21cbf3);
    transition: width 0.3s ease;
    width: 0%;
}

.transfer-stats {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
}

.stat {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.875rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-weight: 600;
    color: #1a1a1a;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: white;
    border-radius: 0.75rem;
    padding: 1rem 1.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #2196f3;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

.toast.success {
    border-left-color: #4caf50;
}

.toast.error {
    border-left-color: #f44336;
}

.toast.warning {
    border-left-color: #ff9800;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

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

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        padding: 0.75rem 1rem;
    }
    
    .main-content {
        padding: 0.75rem 1rem 1rem;
    }
    
    .discovery-options {
        grid-template-columns: 1fr;
    }
    
    .device-input {
        flex-direction: column;
    }
    
    .transfer-controls,
    .incoming-controls,
    .global-controls {
        flex-direction: column;
    }
    
    .devices-grid {
        grid-template-columns: 1fr;
    }
    
    .files-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .toast-container {
        top: calc(1rem + env(safe-area-inset-top));
        right: 1rem;
        left: 1rem;
    }
    
    .toast {
        min-width: auto;
    }
}

/* Icon-first navbar for small screens */
@media (max-width: 540px) {
    .header-content { flex-wrap: wrap; gap: 0.5rem; }
    .header-actions { gap: 0.5rem; flex: 1; justify-content: flex-end; }
    .header-actions .btn span { display: none; }
    .header-actions .btn {
        padding: 0.5rem;
        width: 2.5rem;
        height: 2.5rem;
        border-radius: 50%;
    }
    .header-device { display: none; }
    .logo h1 { display: none; }
    .logo .logo-image { width: 28px; height: 28px; }
}

/* Re-introduce compact brand text on slightly wider phones */
@media (min-width: 541px) and (max-width: 680px) {
    .logo h1 { display: inline; font-size: 1.1rem; opacity: 1; }
    .logo .logo-image { width: 30px; height: 30px; }
    .header-actions .btn span { display: none; }
}

/* Transfer Columns */
.transfer-columns {
    display: grid;
    grid-template-columns: 1.05fr 1.6fr 1.1fr;
    gap: 1.25rem;
    width: 100%;
}

.col {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(33, 150, 243, 0.15);
    border-radius: 1rem;
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

.col h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.col-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

/* Shared Hub split */
.shared-split {
    display: grid;
    grid-template-rows: 1fr 1fr;
    gap: 1rem;
}

/* Scroll areas inside shared sections */
.files-scroll {
    max-height: 360px;
    overflow: auto;
    padding-right: 0.25rem;
}

.files-grouped { display: flex; flex-direction: column; gap: 1rem; }
.user-group { border: 1px solid rgba(33, 150, 243, 0.15); border-radius: 0.75rem; padding: 0.75rem; background: rgba(255, 255, 255, 0.85); }
.user-group h5 { margin-bottom: 0.5rem; font-weight: 600; font-size: 0.95rem; }
.user-group .files-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }

/* Hide download button on own files */
.shared-section#ownSection .btn.btn-primary.btn-mini { display: none; }

.shared-section h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* History */
.history { margin-top: 1rem; }
.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.history-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(33, 150, 243, 0.15);
    border-radius: 0.75rem;
    padding: 0.5rem 0.75rem;
}
.history-item .badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 0.5rem;
    color: white;
}
.badge.sent { background: #2196f3; }
.badge.received { background: #4caf50; }

/* Responsive columns */
@media (max-width: 1024px) {
    .transfer-columns { grid-template-columns: 1fr; }
    .col { padding: 0.75rem; }
    .col h3 { font-size: 1rem; }
    .btn { padding: 0.6rem 1rem; }
    .btn-compact { padding: 0.4rem 0.6rem; }
}

/* Very small devices */
@media (max-width: 380px) {
    .header-content { gap: 0.5rem; }
    .logo h1 { font-size: 1.25rem; }
    .header-actions { gap: 0.5rem; }
    .connection-status { display: none; }
}

/* Support for landscape mobile with limited height */
@media (max-height: 520px) and (max-width: 900px) {
    .main-content { padding: 0.5rem; }
    .panel-header { margin-bottom: 1rem; }
    .file-drop-zone { padding: 2rem 1rem; }
    .files-scroll { max-height: 220px; }
}

/* Scan Overlay */
.scan-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 32, 61, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1200;
}

.scan-card {
    background: rgba(255,255,255,0.98);
    border-radius: 1.5rem;
    border: 1px solid rgba(33,150,243,0.2);
    box-shadow: 0 40px 80px rgba(13, 71, 161, 0.3);
    width: min(800px, 95vw);
    padding: 1.5rem 1.5rem 2rem;
}

.scan-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.scan-header h3 { 
    font-size: 1.25rem; 
    font-weight: 600; 
    color: #1a1a1a;
}

.radar {
    position: relative;
    width: 100%;
    height: 280px;
    margin: 0.5rem auto 1rem;
    overflow: hidden;
    border-radius: 1.25rem;
    background: 
        radial-gradient(ellipse at center bottom, rgba(33,150,243,0.15) 0%, rgba(33,150,243,0.08) 40%, transparent 70%),
        linear-gradient(135deg, rgba(33,150,243,0.05) 0%, rgba(33,150,243,0.02) 100%);
    border: 1px solid rgba(33,150,243,0.1);
}

/* Benchmark-inspired ripple waves on the radar container */
/* .radar::before,
.radar::after {
    content: "";
    position: absolute;
    width: 88%;
    height: 88%;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 1px solid rgba(33,150,243,0.18);
    animation: ripple 2.4s infinite linear;
    pointer-events: none;
    z-index: 0;
}

.radar::after { animation-delay: 1.2s; } */

.radar-grid {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 50% 100%, rgba(33,150,243,0.2) 0 1px, transparent 1px),
        radial-gradient(circle at 50% 100%, rgba(33,150,243,0.12) 0 1px, transparent 1px),
        radial-gradient(circle at 50% 100%, rgba(33,150,243,0.08) 0 1px, transparent 1px),
        radial-gradient(circle at 50% 100%, rgba(33,150,243,0.05) 0 1px, transparent 1px);
    background-size: 100% 100%, 75% 100%, 50% 100%, 25% 100%;
    background-position: center bottom, center bottom, center bottom, center bottom;
    background-repeat: no-repeat;
    z-index: 1;
}

.radar-sweep {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 200%;
    transform-origin: bottom center;
    background: conic-gradient(
        from 180deg,
        rgba(33,150,243,0.6) 0deg,
        rgba(33,150,243,0.38) 12deg,
        rgba(33,150,243,0.1) 26deg,
        transparent 40deg
    );
    -webkit-mask-image: radial-gradient(ellipse at center bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,0.85) 35%, rgba(0,0,0,1) 100%);
    mask-image: radial-gradient(ellipse at center bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,0.85) 35%, rgba(0,0,0,1) 100%);
    filter: blur(1.1px) saturate(115%);
    animation: sweep 4s linear infinite;
    z-index: 2;
}

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

/* Radar sizing on smaller screens */
@media (max-width: 540px) {
    .radar { height: 220px; }
}
@media (max-width: 380px) {
    .radar { height: 200px; }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .radar-sweep { animation-duration: 8s; filter: none; }
}

.radar-center {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 1rem;
    height: 1rem;
    background: #2196f3;
    border-radius: 50%;
    box-shadow: 
        0 0 0 3px rgba(33,150,243,0.3), 
        0 0 0 6px rgba(33,150,243,0.15),
        0 0 20px rgba(33,150,243,0.6);
    animation: pulse-center 2s ease-in-out infinite;
    z-index: 3;
}

@keyframes pulse-center {
    0%, 100% { 
        transform: translateX(-50%) scale(1);
        box-shadow: 
            0 0 0 3px rgba(33,150,243,0.3), 
            0 0 0 6px rgba(33,150,243,0.15),
            0 0 20px rgba(33,150,243,0.6);
    }
    50% { 
        transform: translateX(-50%) scale(1.1);
        box-shadow: 
            0 0 0 4px rgba(33,150,243,0.4), 
            0 0 0 8px rgba(33,150,243,0.2),
            0 0 25px rgba(33,150,243,0.8);
    }
}

/* Device indicators in radar */
.radar-device {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #4caf50;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 0 2px rgba(76,175,80,0.3), 0 0 10px rgba(76,175,80,0.6);
    animation: device-pulse 1.5s ease-in-out infinite;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    transition: all 0.5s ease-out;
    cursor: pointer;
    z-index: 4;
}

.radar-device.connected {
    background: #ff9800;
    box-shadow: 0 0 0 2px rgba(255,152,0,0.3), 0 0 10px rgba(255,152,0,0.6);
}

.radar-device:hover {
    transform: translate(-50%, -50%) scale(1.3) !important;
    z-index: 10;
}

.radar-device-label {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    margin-top: 0.3rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    font-family: 'Courier New', monospace;
}

.radar-device:hover .radar-device-label {
    opacity: 1;
}

@keyframes device-pulse {
    0%, 100% { 
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    50% { 
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.8;
    }
}

.radar-device::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 1px solid currentColor;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: ripple 2s ease-out infinite;
    opacity: 0;
}

@keyframes ripple {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.7;
    }
    100% {
        transform: translate(-50%, -50%) scale(2.2);
        opacity: 0;
    }
}

.scan-results h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0.25rem 0 0.5rem;
}

.scan-list {
    background: rgba(255,255,255,0.75);
    border: 1px solid rgba(33,150,243,0.15);
    border-radius: 0.75rem;
    max-height: 220px;
    overflow: auto;
    padding: 0.5rem;
}

.scan-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.6rem;
    background: rgba(255,255,255,0.9);
    border: 1px solid rgba(33,150,243,0.12);
    border-radius: 0.65rem;
    margin: 0.35rem 0;
}

.scan-item .left { display: flex; align-items: center; gap: 0.65rem; }
.scan-item .device-icon { width: 1.8rem; height: 1.8rem; }
.scan-item .name { font-weight: 600; }
.scan-item .id { font-size: 0.8rem; color: #666; }

.scan-actions {
    display: flex;
    gap: 0.6rem;
    justify-content: flex-end;
    margin-top: 0.75rem;
}
