/* style.css - 移动端优化版 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    background: #0a0a0f;
    color: #ffffff;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* 容器和布局 */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
    margin-top: 70px; /* 为固定导航栏留出空间 */
}

/* 导航栏 */
.navbar {
    background: rgba(20, 20, 30, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(79, 70, 229, 0.3);
    padding: 12px 16px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(90deg, #4f46e5, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #4f46e5, #8b5cf6);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}

.btn-outline {
    background: transparent;
    border: 1px solid #4f46e5;
    color: #4f46e5;
}

.btn-outline:hover {
    background: rgba(79, 70, 229, 0.1);
}

/* 卡片 */
.card {
    background: rgba(20, 20, 30, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    margin: 16px 0;
    transition: all 0.3s ease;
}

.card:hover {
    border-color: #4f46e5;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* 文件列表 */
.file-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin: 20px 0;
}

.file-item {
    background: rgba(30, 30, 40, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
}

.file-item:hover {
    background: rgba(79, 70, 229, 0.1);
    border-color: #4f46e5;
}

.file-icon {
    width: 40px;
    height: 40px;
    background: rgba(79, 70, 229, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #4f46e5;
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 12px;
    color: #94a3b8;
}

.file-actions {
    display: flex;
    gap: 8px;
}

/* 编辑器容器 */
.editor-container {
    background: #1a1a2e;
    border-radius: 12px;
    overflow: hidden;
    margin: 20px 0;
    border: 1px solid rgba(79, 70, 229, 0.3);
}

.editor-header {
    background: rgba(30, 30, 40, 0.9);
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.editor-title {
    font-size: 14px;
    font-weight: 500;
    color: #94a3b8;
}

.editor-tools {
    display: flex;
    gap: 8px;
    align-items: center;
}

.tool-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
}

.tool-btn:hover {
    background: rgba(79, 70, 229, 0.2);
    color: #4f46e5;
    border-color: #4f46e5;
}

/* 上传区域 */
.upload-area {
    border: 2px dashed rgba(79, 70, 229, 0.3);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    background: rgba(79, 70, 229, 0.05);
    margin: 20px 0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: #4f46e5;
    background: rgba(79, 70, 229, 0.1);
}

.upload-icon {
    font-size: 48px;
    color: #4f46e5;
    margin-bottom: 16px;
}

.upload-text {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 8px;
}

.upload-hint {
    font-size: 14px;
    color: #94a3b8;
}

/* 搜索框 */
.search-box {
    background: rgba(30, 30, 40, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
}

.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    font-size: 14px;
    outline: none;
}

.search-box input::placeholder {
    color: #94a3b8;
}

/* 全屏模式 */
.fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    border-radius: 0 !important;
    border: none !important;
    z-index: 9999;
}

.fullscreen .CodeMirror {
    height: calc(100vh - 60px) !important;
}

/* 触摸优化 */
@media (hover: none) {
    .btn, .file-item, .tool-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .file-list {
        grid-template-columns: 1fr;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 12px;
        margin-top: 60px;
    }
    
    .navbar {
        padding: 10px 12px;
    }
    
    .logo {
        font-size: 18px;
    }
    
    .file-list {
        grid-template-columns: 1fr;
    }
    
    .editor-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .editor-tools {
        width: 100%;
        justify-content: space-between;
    }
    
    .card {
        padding: 16px;
    }
    
    .btn {
        padding: 12px 16px;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 8px;
    }
    
    .file-item {
        flex-direction: column;
        text-align: center;
        padding: 12px;
    }
    
    .file-info {
        width: 100%;
    }
    
    .file-actions {
        width: 100%;
        justify-content: center;
    }
}

/* 状态指示器 */
.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status.online {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.status.offline {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.status.pending {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

/* 消息提示 */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(20, 20, 30, 0.95);
    border: 1px solid rgba(79, 70, 229, 0.3);
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    z-index: 10000;
    animation: slideIn 0.3s ease;
    max-width: 90vw;
}

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

/* 加载动画 */
.loading {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: #4f46e5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 特效元素 */
.glow {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(79, 70, 229, 0.1), transparent 70%);
    pointer-events: none;
    z-index: -1;
}

.grid-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(79, 70, 229, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(79, 70, 229, 0.05) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: -1;
}

/* 项目URL显示 */
.project-urls {
    margin: 12px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.url-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.url-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.url-item.primary {
    background: rgba(79, 70, 229, 0.1);
    border-color: rgba(79, 70, 229, 0.3);
}

.url-item.primary:hover {
    background: rgba(79, 70, 229, 0.15);
}

.url-link {
    flex: 1;
    color: white;
    text-decoration: none;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.url-link:hover {
    color: #4f46e5;
    text-decoration: underline;
}

.url-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.url-item.primary .url-badge {
    background: #4f46e5;
    color: white;
}

.url-item:not(.primary) .url-badge {
    background: rgba(255, 255, 255, 0.1);
    color: #94a3b8;
}

/* 项目元信息 */
.project-meta {
    display: flex;
    gap: 16px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #94a3b8;
}

.meta-item i {
    font-size: 10px;
}