/* 基础样式 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    padding: 20px;
}

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

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1000px;
    margin: 0 auto;
}

.brand {
    text-align: left;
}

.brand h1 {
    font-size: 2.5rem;
    color: #2a6ac8;
    margin: 0;
}

.brand p {
    color: #6c757d;
    margin: 5px 0 0 0;
}

/* 语言选择器样式 */
.language-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.language-selector label {
    font-weight: 500;
    color: #5a5a5a;
}

.language-selector select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    font-size: 14px;
    min-width: 120px;
    cursor: pointer;
}

.language-selector select:focus {
    outline: none;
    border-color: #2a6ac8;
    box-shadow: 0 0 0 2px rgba(42, 106, 200, 0.1);
}

/* RTL support for Arabic and other RTL languages */
[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .header-content {
    flex-direction: row-reverse;
}

[dir="rtl"] .brand {
    text-align: right;
}

[dir="rtl"] .language-selector {
    flex-direction: row-reverse;
}

/* Mobile responsive design for language selector */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .brand {
        text-align: center;
    }
    
    .language-selector {
        justify-content: center;
    }
    
    [dir="rtl"] .header-content {
        flex-direction: column;
    }
    
    [dir="rtl"] .brand {
        text-align: center;
    }
}

/* 房间信息样式 */
#room-id-container {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

#room-id-container p {
    margin-right: 15px;
    flex-grow: 1;
}

#room-id {
    font-weight: bold;
    background: #f3f3f3;
    padding: 5px 10px;
    border-radius: 4px;
    display: inline-block;
}

#copy-link-btn {
    background: #2a6ac8;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
}

#copy-link-btn:hover {
    background: #1c5bb9;
}

/* 连接状态样式 */
#connection-status {
    background: #f3f3f3;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

#status-text.connected {
    color: #28a745;
    font-weight: bold;
}

#status-text.disconnected {
    color: #dc3545;
    font-weight: bold;
}

#status-text.connecting {
    color: #ffc107;
    font-weight: bold;
}

/* 文件分享区域样式 */
#file-sharing-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    #file-sharing-area {
        grid-template-columns: 1fr;
    }
}

#drop-zone {
    border: 3px dashed #ccc;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

#drop-zone:hover, #drop-zone.dragover {
    border-color: #2a6ac8;
    background-color: rgba(42, 106, 200, 0.05);
}

#drop-zone p {
    color: #666;
    font-size: 1.1rem;
}

/* 文件列表样式 */
#file-list {
    max-height: 300px;
    overflow-y: auto;
}

#no-files-message {
    color: #6c757d;
    text-align: center;
    font-style: italic;
    padding: 20px 0;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border: 1px solid #eee;
    border-radius: 4px;
    margin-bottom: 10px;
    transition: all 0.2s;
}

.file-item:hover {
    background-color: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.file-info {
    flex-grow: 1;
}

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

.file-size {
    font-size: 0.85rem;
    color: #6c757d;
}

.file-download-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
    margin-left: 10px;
}

.file-download-btn:hover {
    background: #218838;
}

.file-download-btn.downloading {
    background: #6c757d;
    cursor: default;
}

.progress-container {
    height: 6px;
    width: 100%;
    background-color: #e9ecef;
    border-radius: 3px;
    margin-top: 5px;
}

.progress-bar {
    height: 100%;
    background-color: #2a6ac8;
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s;
}

/* 二维码区域样式 */
#qrcode-container {
    text-align: center;
    padding: 15px;
    margin: 20px 0;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: block;
}

#qrcode-container h3 {
    color: #2a6ac8;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

#qrcode {
    display: inline-block;
    padding: 10px;
    background-color: white;
    border-radius: 4px;
    margin: 0 auto 15px;
}

.qrcode-hint {
    color: #6c757d;
    font-size: 0.9rem;
    margin-top: 10px;
}

/* 二维码加载错误消息样式 */
.error-message {
    color: #dc3545;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 10px 15px;
    margin: 15px 0;
    font-weight: 500;
}

/* 页脚样式 */
footer {
    text-align: center;
    color: #6c757d;
    padding: 20px 0;
    margin-top: 30px;
    font-size: 0.9rem;
}

/* 模态窗口样式 */
#modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#modal.hidden {
    display: none !important;
}

.modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    width: 90%;
    position: relative;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #aaa;
}

.close-btn:hover {
    color: #333;
}

/* iOS设备的特殊样式 */
.ios-start-button {
    display: block;
    width: 80%;
    max-width: 300px;
    margin: 20px auto;
    padding: 15px;
    background-color: #2a6ac8;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: background-color 0.2s;
    position: fixed;
    z-index: 100;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.ios-start-button:hover {
    background-color: #1c5bb9;
}

/* 响应式设计调整 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    #qrcode {
        max-width: 80%;
    }
    
    #room-id-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    #room-id-container p {
        margin-right: 0;
    }
    
    #copy-link-btn {
        align-self: stretch;
        text-align: center;
    }
}

/* 额外的移动端优化 */
@media (max-width: 480px) {
    .brand h1 {
        font-size: 2rem;
    }
    
    #drop-zone {
        padding: 30px 15px;
    }
    
    #drop-zone p {
        font-size: 1rem;
    }
    
    .file-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .file-download-btn {
        align-self: stretch;
        margin-left: 0;
        text-align: center;
    }
}
