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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --success: #10b981;
    --danger: #ef4444;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] {
    --primary: #818cf8;
    --primary-dark: #6366f1;
    --primary-light: #a5b4fc;
    --success: #34d399;
    --danger: #f87171;
    --bg: #0f172a;
    --card-bg: #1e293b;
    --text: #f1f5f9;
    --text-light: #94a3b8;
    --border: #334155;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    padding: 40px 20px;
    position: relative;
}

.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: var(--text);
    padding: 0;
}

.theme-toggle:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: rotate(180deg);
}

.theme-toggle .sun-icon,
.theme-toggle .moon-icon {
    width: 22px;
    height: 22px;
    position: absolute;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.theme-toggle .moon-icon {
    opacity: 0;
    transform: scale(0.8);
}

[data-theme="dark"] .theme-toggle .sun-icon {
    opacity: 0;
    transform: scale(0.8);
}

[data-theme="dark"] .theme-toggle .moon-icon {
    opacity: 1;
    transform: scale(1);
}

header h1 {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-light);
    font-size: 1.1rem;
}

.card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card h2 {
    font-size: 1.5rem;
    margin-bottom: 16px;
    color: var(--text);
}

#qr-code {
    display: flex;
    justify-content: center;
    margin: 20px 0;
    padding: 24px;
    background: var(--card-bg);
    border-radius: 12px;
    border: 2px solid var(--border);
    box-shadow: var(--shadow);
}

#qr-code canvas, #qr-code img {
    max-width: 200px;
    height: auto;
}

.hint {
    text-align: center;
    color: var(--text-light);
    font-size: 0.9rem;
    margin-top: 10px;
}

#scanner {
    width: 100%;
    max-width: 400px;
    margin: 20px auto;
    border-radius: 8px;
    overflow: hidden;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    background: var(--border);
    color: var(--text);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 6px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    box-shadow: 0 6px 12px rgba(99, 102, 241, 0.4);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 6px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, var(--danger) 100%);
    box-shadow: 0 6px 12px rgba(239, 68, 68, 0.4);
    transform: translateY(-2px);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.clipboard-input textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 16px;
}

.clipboard-input textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.file-upload {
    margin-bottom: 16px;
}

.file-upload input[type="file"] {
    display: none;
}

.file-upload label {
    display: inline-block;
    cursor: pointer;
}

#file-list {
    margin-bottom: 16px;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: var(--bg);
    border-radius: 6px;
    margin-bottom: 8px;
}

.file-item-name {
    flex: 1;
    font-size: 0.9rem;
}

.file-item-size {
    color: var(--text-light);
    font-size: 0.85rem;
    margin-left: 10px;
}

.remove-file {
    background: var(--danger);
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    margin-left: 10px;
}

.received-content {
    margin-top: 20px;
    padding: 16px;
    background: var(--bg);
    border-radius: 8px;
}

.received-content h3 {
    font-size: 1.1rem;
    margin-bottom: 12px;
}

#received-text-content {
    white-space: pre-wrap;
    word-break: break-word;
    padding: 12px;
    background: white;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.received-file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: white;
    border-radius: 6px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
}

.download-btn {
    background: var(--success);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9rem;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

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

#progress-text {
    text-align: center;
    color: var(--text-light);
    font-size: 0.9rem;
}

.success {
    color: var(--success);
    font-weight: 500;
}

#connection-status {
    text-align: center;
    margin-bottom: 10px;
}

#device-id {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-top: 10px;
}

footer {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 600px) {
    header h1 {
        font-size: 2rem;
    }
    
    .card {
        padding: 16px;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    #qr-code canvas, #qr-code img {
        max-width: 150px;
    }
}

/* Loading animation */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
