/* 全局样式 */
:root {
    --primary-color: #4285f4;
    --secondary-color: #34a853;
    --accent-color: #ea4335;
    --text-color: #333;
    --light-text: #666;
    --background-color: #f5f5f5;
    --card-background: #fff;
    --border-color: #e0e0e0;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
}

.header h1 {
    color: var(--primary-color);
    font-size: 2.5rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

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

/* 主内容区样式 */
.main-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

/* 设备发现区样式 */
.devices-section {
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.devices-section h2 {
    margin-bottom: 20px;
    color: var(--primary-color);
    font-size: 1.5rem;
}

.devices-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    min-height: 150px;
}

.device-card {
    background-color: #f9f9f9;
    border-radius: var(--border-radius);
    padding: 15px;
    width: 150px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.device-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
    border-color: var(--primary-color);
}

.device-card.selected {
    border-color: var(--primary-color);
    background-color: rgba(66, 133, 244, 0.1);
}

.device-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 10px;
}

.device-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.device-type {
    color: var(--light-text);
    font-size: 0.9rem;
}

.no-devices {
    width: 100%;
    text-align: center;
    padding: 40px 0;
    color: var(--light-text);
}

.no-devices i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* 文件传输区样式 */
.file-transfer-section {
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.transfer-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.file-selector {
    width: 100%;
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 40px 20px;
    text-align: center;
    transition: var(--transition);
    position: relative;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.upload-area:hover, .upload-area.dragover {
    border-color: var(--primary-color);
    background-color: rgba(66, 133, 244, 0.05);
}

.upload-area i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.upload-area p {
    margin-bottom: 20px;
    color: var(--light-text);
}

#fileInput {
    display: none;
}

.select-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition);
}

.select-btn:hover {
    background-color: #3367d6;
}

.transfer-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.send-btn, .history-btn {
    padding: 10px 20px;
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 5px;
}

.send-btn {
    background-color: var(--secondary-color);
    color: white;
}

.send-btn:hover:not(:disabled) {
    background-color: #2d9249;
}

.send-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.history-btn {
    background-color: #f0f0f0;
    color: var(--text-color);
}

.history-btn:hover {
    background-color: #e0e0e0;
}

/* 传输状态区样式 */
.transfer-status-section {
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.transfer-status-section h2 {
    margin-bottom: 20px;
    color: var(--primary-color);
    font-size: 1.5rem;
}

.transfer-status {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.transfer-item {
    background-color: #f9f9f9;
    border-radius: var(--border-radius);
    padding: 15px;
}

.transfer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.transfer-file-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.transfer-file-icon {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.transfer-file-name {
    font-weight: bold;
}

.transfer-file-size {
    color: var(--light-text);
    font-size: 0.9rem;
}

.transfer-status-text {
    font-size: 0.9rem;
    color: var(--secondary-color);
}

.transfer-progress-container {
    width: 100%;
    height: 8px;
    background-color: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 10px;
}

.transfer-progress-bar {
    height: 100%;
    background-color: var(--secondary-color);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* 帮助区样式 */
.help-section {
    text-align: center;
    padding: 20px 0;
}

.help-btn {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 8px 16px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.9rem;
    margin-bottom: 10px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 5px;
}

.help-btn:hover {
    background-color: #f0f0f0;
}

.privacy-note {
    font-size: 0.9rem;
    color: var(--light-text);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

/* 弹窗样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: var(--card-background);
    margin: 5% auto;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: var(--primary-color);
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.error-header {
    background-color: var(--accent-color);
    color: white;
}

.error-header h2 {
    color: white;
}

.close {
    color: var(--light-text);
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
}

.close:hover {
    color: var(--text-color);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* 连接指南弹窗样式 */
.guide-steps {
    margin-bottom: 20px;
}

.step {
    display: flex;
    margin-bottom: 20px;
    align-items: flex-start;
}

.step-number {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 15px;
    flex-shrink: 0;
}

.step-content h3 {
    margin-bottom: 5px;
    color: var(--primary-color);
}

/* 移动设备弹窗优化 */
@media (max-width: 600px) {
    .modal-content {
        margin: 5% auto;
        width: 90%;
        max-width: 400px;
        max-height: 85vh;
        overflow-y: auto;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 10px 12px;
    }
    
    .modal-header h2 {
        font-size: 1rem;
    }
    
    .step {
        margin-bottom: 12px;
    }
    
    .step-number {
        width: 22px;
        height: 22px;
        font-size: 0.7rem;
        margin-right: 10px;
    }
    
    .step-content h3 {
        font-size: 0.8rem;
        margin-bottom: 3px;
    }
    
    .step-content p {
        font-size: 0.75rem;
        line-height: 1.3;
    }
    
    .network-info h3,
    .device-name-setting h3 {
        font-size: 0.8rem;
        margin-bottom: 6px;
    }
    
    .network-info p,
    .hint {
        font-size: 0.75rem;
    }
    
    .name-input-group {
        flex-direction: column;
        gap: 6px;
    }
    
    .name-input-group input {
        font-size: 0.75rem;
        padding: 7px;
    }
    
    .primary-btn,
    .accept-btn,
    .reject-btn,
    .cancel-btn,
    .clear-history-btn,
    .close-history-btn,
    .close-error-btn,
    .close-help-btn {
        padding: 7px 12px;
        font-size: 0.75rem;
    }
    
    .modal-footer {
        gap: 6px;
        justify-content: center;
    }
    
    .network-info,
    .device-name-setting {
        margin-top: 12px;
        padding: 10px;
    }
}

.network-info {
    background-color: #f9f9f9;
    border-radius: var(--border-radius);
    padding: 15px;
    margin-top: 20px;
}

.network-info h3 {
    margin-bottom: 10px;
    color: var(--primary-color);
}

/* 设备名称设置样式 */
.device-name-setting {
    background-color: #f9f9f9;
    border-radius: var(--border-radius);
    padding: 15px;
    margin-top: 20px;
}

.device-name-setting h3 {
    margin-bottom: 10px;
    color: var(--primary-color);
    text-align: center;
}

.name-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.name-input-group input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 14px;
}

.name-input-group button {
    padding: 10px 20px;
}

.hint {
    font-size: 12px;
    color: #666;
    text-align: center;
    margin: 0;
}

/* 接收确认弹窗样式 */
.sender-info {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.sender-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-right: 15px;
}

.sender-details p {
    margin: 5px 0;
}

.sender-name {
    font-weight: bold;
    font-size: 1.1rem;
}

.sender-device {
    color: var(--light-text);
    font-size: 0.9rem;
}

.file-preview {
    margin-bottom: 20px;
    text-align: center;
    max-height: 200px;
    overflow: hidden;
    border-radius: var(--border-radius);
}

.file-preview img {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
}

.file-info {
    margin-bottom: 20px;
}

.file-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.file-size {
    color: var(--light-text);
    font-size: 0.9rem;
}

/* 传输详情弹窗样式 */
.transfer-info {
    margin-bottom: 20px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 5px 0;
    border-bottom: 1px solid #f0f0f0;
}

.info-label {
    color: var(--light-text);
}

.info-value {
    font-weight: bold;
}

.progress-bar-container {
    width: 100%;
    height: 10px;
    background-color: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 20px;
}

.progress-bar {
    height: 100%;
    background-color: var(--secondary-color);
    border-radius: 5px;
    transition: width 0.3s ease;
}

/* 历史记录弹窗样式 */
.history-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.history-item:last-child {
    border-bottom: none;
}

.history-file-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.history-file-icon {
    font-size: 1.2rem;
    color: var(--primary-color);
}

.history-file-name {
    font-weight: bold;
}

.history-file-size {
    color: var(--light-text);
    font-size: 0.9rem;
}

.history-time {
    color: var(--light-text);
    font-size: 0.9rem;
}

.no-history {
    text-align: center;
    padding: 40px 0;
    color: var(--light-text);
}

.no-history i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* 错误弹窗样式 */
.error-message {
    font-size: 1.1rem;
    text-align: center;
}

/* 按钮样式 */
.primary-btn, .accept-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition);
}

.primary-btn:hover, .accept-btn:hover {
    background-color: #3367d6;
}

.reject-btn, .cancel-btn, .clear-history-btn {
    background-color: #f0f0f0;
    color: var(--text-color);
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition);
}

.reject-btn:hover, .cancel-btn:hover, .clear-history-btn:hover {
    background-color: #e0e0e0;
}

.close-history-btn, .close-error-btn, .close-help-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition);
}

.close-history-btn:hover, .close-error-btn:hover, .close-help-btn:hover {
    background-color: #3367d6;
}

/* 已选择文件样式 */
.selected-files {
    width: 100%;
}

.selected-files p {
    margin-bottom: 15px;
    font-weight: bold;
    color: var(--text-color);
}

.selected-file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: #f0f0f0;
    padding: 10px;
    border-radius: var(--border-radius);
    margin-bottom: 10px;
}

.selected-file-item i {
    font-size: 1.2rem;
    color: var(--primary-color);
}

.selected-file-item .file-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.selected-file-item .file-name {
    font-weight: bold;
    font-size: 0.9rem;
}

.selected-file-item .file-size {
    color: var(--light-text);
    font-size: 0.8rem;
}

/* 动画 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* 通知样式 */
.success-notification,
.error-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 300px;
    max-width: 500px;
}

.success-notification.show,
.error-notification.show {
    transform: translateX(0);
}

.success-notification {
    background-color: var(--secondary-color);
    color: white;
}

.error-notification {
    background-color: var(--accent-color);
    color: white;
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.notification-content i {
    font-size: 1.2rem;
}

.notification-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    margin-left: 15px;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.notification-close:hover {
    opacity: 1;
}

/* 响应式设计 */
@media (min-width: 768px) {
    .main-content {
        grid-template-columns: 1fr 1fr;
    }
    
    .transfer-container {
        flex-direction: row;
    }
    
    .file-selector {
        flex: 1;
    }
    
    .transfer-controls {
        flex-direction: column;
        justify-content: flex-end;
    }
    
    .send-btn, .history-btn {
        width: 100%;
    }
}

@media (max-width: 767px) {
    .header h1 {
        font-size: 2rem;
    }
    
    .device-card {
        width: 130px;
    }
    
    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
    
    .success-notification {
        left: 20px;
        right: 20px;
        transform: translateY(-100px);
    }
    
    .success-notification.show {
        transform: translateY(0);
    }
}