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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(to bottom, #E0F7FA 0%, #FFFFFF 100%);
    background-image: url('/static/images/background.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

/* Decorative background elements matching the image */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        /* Mint green rings in upper right */
        radial-gradient(circle at 85% 15%, rgba(129, 212, 250, 0.2) 0%, transparent 15%),
        radial-gradient(circle at 90% 10%, rgba(77, 182, 172, 0.25) 0%, transparent 20%),
        /* Mint green blob in lower left */
        radial-gradient(ellipse at 10% 85%, rgba(77, 182, 172, 0.15) 0%, transparent 40%),
        /* Subtle grid pattern */
        repeating-linear-gradient(0deg, transparent, transparent 40px, rgba(200, 230, 240, 0.03) 40px, rgba(200, 230, 240, 0.03) 41px),
        repeating-linear-gradient(90deg, transparent, transparent 40px, rgba(200, 230, 240, 0.03) 40px, rgba(200, 230, 240, 0.03) 41px);
    z-index: 0;
    pointer-events: none;
}

/* Background decorative icons */
.bg-icon {
    position: fixed;
    z-index: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.bg-icon-house {
    bottom: 15%;
    left: 8%;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #4CAF50 0%, #66BB6A 100%);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.bg-icon-house svg {
    width: 32px;
    height: 32px;
}

.bg-icon-checkmark {
    bottom: 25%;
    left: 15%;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #2196F3 0%, #42A5F5 100%);
    color: white;
    font-size: 28px;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.container {
    width: 100%;
    max-width: 500px;
    position: relative;
    z-index: 1;
}

.card {
    background: white;
    border-radius: 28px;
    padding: 0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 24px 20px 24px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.card-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.card-header-icon {
    width: 48px;
    height: 48px;
    background: white;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
    padding: 8px;
}

.card-header-icon svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.card-header-icon:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.card-header h1 {
    color: #1a1a1a;
    font-size: 1.5em;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.5px;
}


.card-close {
    width: 36px;
    height: 36px;
    border: none;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 20px;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: all 0.2s;
}

.card-close:hover {
    background: #e0e0e0;
    color: #333;
    transform: scale(1.05);
}

.card-body {
    padding: 28px;
}

.subtitle {
    color: #666;
    margin-bottom: 24px;
    font-size: 0.95em;
    text-align: center;
}

.loading {
    padding: 60px 40px;
    text-align: center;
}

.spinner {
    border: 4px solid #f0f0f0;
    border-top: 4px solid #4CAF50;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.hidden {
    display: none !important;
}

.qr-container {
    padding: 0;
}

.qr-preview-label {
    text-align: center;
    color: #333;
    font-size: 1em;
    font-weight: 600;
    margin-bottom: 20px;
}

#qr-code {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 20px;
    margin-bottom: 20px;
    border: 2px solid rgba(33, 150, 243, 0.1);
}

#qr-code img {
    max-width: 100%;
    min-width: 250px;
    width: auto;
    height: auto;
    border-radius: 16px;
    display: block;
    background: white;
    padding: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.status-text {
    margin-top: 16px;
    color: #666;
    font-size: 0.9em;
    text-align: center;
}

.connected-view {
    animation: fadeIn 0.5s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.success-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, #4CAF50 0%, #66BB6A 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 36px;
    color: white;
    font-weight: bold;
    box-shadow: 0 8px 24px rgba(76, 175, 80, 0.3);
}

.connected-view h2 {
    color: #1a1a1a;
    margin-bottom: 8px;
    font-size: 1.5em;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.connected-view p {
    color: #666;
    margin-bottom: 24px;
    font-size: 0.95em;
}

.file-section {
    margin-top: 32px;
    text-align: left;
}

.file-section h3 {
    color: #1a1a1a;
    margin-bottom: 16px;
    font-size: 1.1em;
    font-weight: 700;
}

/* Modern File Upload Area */
.file-upload-area {
    border: 2px dashed #d0d0d0;
    border-radius: 20px;
    padding: 36px 20px;
    text-align: center;
    background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.file-upload-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.05) 0%, rgba(33, 150, 243, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.file-upload-area:hover {
    border-color: #4CAF50;
    background: linear-gradient(135deg, #f0f7f0 0%, #e8f5e9 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(76, 175, 80, 0.15);
}

.file-upload-area:hover::before {
    opacity: 1;
}

.file-upload-area.drag-over {
    border-color: #4CAF50;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    transform: scale(1.02);
    box-shadow: 0 12px 32px rgba(76, 175, 80, 0.2);
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.upload-text {
    font-size: 1.05em;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

.upload-subtext {
    font-size: 0.9em;
    color: #999;
    margin: 8px 0 20px 0;
    position: relative;
    z-index: 1;
}

.btn-secondary {
    background: white;
    color: #4CAF50;
    border: 2px solid #4CAF50;
    padding: 12px 24px;
    border-radius: 14px;
    font-size: 0.95em;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    display: inline-block;
    position: relative;
    z-index: 1;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.15);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #4CAF50 0%, #66BB6A 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.3);
    border-color: #4CAF50;
}

.btn-secondary:active {
    transform: translateY(0);
}

.btn-folder {
    background: white;
    color: #667eea;
    border: 1.5px solid #667eea;
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    display: inline-block;
    box-shadow: 0 1px 4px rgba(102, 126, 234, 0.15);
}

.btn-folder:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(102, 126, 234, 0.25);
    border-color: #667eea;
}

.btn-folder:active {
    transform: translateY(0);
}

#file-input {
    display: none;
}

.btn-primary {
    background: linear-gradient(135deg, #4CAF50 0%, #66BB6A 100%);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 16px;
    font-size: 1.05em;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    font-weight: 700;
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.3);
    letter-spacing: 0.3px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(76, 175, 80, 0.4);
    background: linear-gradient(135deg, #66BB6A 0%, #4CAF50 100%);
}

.btn-primary:active {
    transform: translateY(0);
}

.file-list {
    margin-top: 20px;
}

.file-item {
    background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
    padding: 18px;
    border-radius: 16px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    flex-wrap: wrap;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
}

.file-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.file-item .file-info {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.file-item .file-name {
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 6px;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    font-size: 0.95em;
}

.file-item .file-size {
    color: #999;
    font-size: 0.85em;
}

.file-item .file-status {
    color: #666;
    font-size: 0.85em;
    margin-top: 6px;
    font-weight: 500;
}

.file-item .file-error-detail {
    color: #d32f2f;
    font-size: 0.8em;
    margin-top: 8px;
    padding: 12px;
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    border-left: 4px solid #f44336;
    border-radius: 8px;
    word-break: break-word;
    white-space: pre-wrap;
}

.file-item .file-progress {
    width: 100%;
    height: 8px;
    background: #e8e8e8;
    border-radius: 4px;
    margin-top: 12px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.file-item .file-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50 0%, #66BB6A 100%);
    transition: width 0.3s;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(76, 175, 80, 0.3);
}

.file-item.pending-file {
    border-left: 5px solid #FFA726;
    background: linear-gradient(135deg, #fff8e1 0%, #ffe0b2 100%);
}

.file-item.downloaded-file {
    border-left: 5px solid #4CAF50;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
}

.file-item.sending-file {
    border-left: 5px solid #2196F3;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
}

.file-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.btn-reject-all {
    background: linear-gradient(135deg, #f44336 0%, #e53935 100%);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(244, 67, 54, 0.2);
}

.btn-reject-all:hover {
    background: linear-gradient(135deg, #e53935 0%, #f44336 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.3);
}

.btn-reject-all:active {
    transform: translateY(0);
}

.btn-accept {
    background: linear-gradient(135deg, #4CAF50 0%, #66BB6A 100%);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.2);
}

.btn-accept:hover {
    background: linear-gradient(135deg, #66BB6A 0%, #4CAF50 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.btn-accept:active {
    transform: translateY(0);
}

.btn-reject {
    background: linear-gradient(135deg, #f44336 0%, #e53935 100%);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(244, 67, 54, 0.2);
}

.btn-reject:hover {
    background: linear-gradient(135deg, #e53935 0%, #f44336 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.3);
}

.btn-reject:active {
    transform: translateY(0);
}

#qr-url {
    margin-top: 20px;
    padding: 16px;
    background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
    border-radius: 16px;
    word-break: break-all;
    font-size: 0.85em;
    color: #666;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

#qr-url-link {
    color: #2196F3;
    text-decoration: none;
    font-weight: 500;
}

#qr-url-link:hover {
    text-decoration: underline;
    color: #1976D2;
}

#qr-video {
    width: 100%;
    max-width: 400px;
    border-radius: 20px;
    margin: 20px 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

#start-scanner {
    margin-bottom: 20px;
}

.no-files-message {
    text-align: center;
    color: #999;
    padding: 40px 20px;
    font-size: 0.9em;
}

@media (max-width: 600px) {
    .file-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-accept,
    .btn-reject {
        width: 100%;
    }
    
    .card {
        border-radius: 24px;
    }
    
    .card-body {
        padding: 24px;
    }
    
    .card-header {
        padding: 20px 20px 16px 20px;
    }
    
    .card-header h1 {
        font-size: 1.3em;
    }
    
    .card-header-icon {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
}

/* Disconnection Overlay */
.disconnection-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.disconnection-overlay.hidden {
    display: none;
}

.disconnection-modal {
    background: white;
    border-radius: 20px;
    padding: 32px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.disconnection-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.disconnection-modal h2 {
    color: #333;
    margin-bottom: 12px;
    font-size: 1.5em;
}

.disconnection-modal p {
    color: #666;
    margin-bottom: 24px;
    line-height: 1.5;
}

.disconnection-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.disconnection-actions button {
    min-width: 120px;
}

.reconnect-countdown {
    margin-top: 16px;
    color: #999;
    font-size: 0.9em;
    font-style: italic;
}

.reconnect-countdown.hidden {
    display: none;
}
