/**
 * 主样式文件 - 全局基础样式
 */

/* ===== 基础重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

/* ===== 布局容器 ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
}

.card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    padding: 30px;
    margin-bottom: 20px;
}

/* ===== 排版 ===== */
h1, h2, h3 {
    color: #333;
    margin-bottom: 20px;
}

/* ===== 按钮 ===== */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    color: white;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.btn-primary { background: #667eea; }
.btn-primary:hover { background: #5568d3; }

.btn-success { background: #48bb78; }
.btn-success:hover { background: #38a169; }

.btn-danger { background: #f56565; }
.btn-danger:hover { background: #e53e3e; }

.btn-secondary { background: #718096; }
.btn-secondary:hover { background: #4a5568; }

/* ===== 表单 ===== */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: 500;
}

input[type="text"],
input[type="password"],
input[type="number"],
textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: #667eea;
}

/* ===== 提示框 ===== */
.alert {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.alert-error {
    background: #fed7d7;
    color: #c53030;
    border: 1px solid #fc8181;
}

.alert-success {
    background: #c6f6d5;
    color: #2f855a;
    border: 1px solid #9ae6b4;
}

.alert-info {
    background: #bee3f8;
    color: #2c5282;
    border: 1px solid #90cdf4;
}

/* ===== 导航栏 ===== */
nav {
    background: white;
    border-radius: 10px;
    padding: 15px 30px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

nav .logo {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
}

nav .nav-links {
    display: flex;
    gap: 20px;
    align-items: center;
}

nav a {
    text-decoration: none;
    color: #555;
    font-weight: 500;
    transition: color 0.3s;
}

nav a:hover {
    color: #667eea;
}

/* ===== 表格 ===== */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background: #f7fafc;
    font-weight: 600;
    color: #2d3748;
}

tr:hover {
    background: #f7fafc;
}

/* ===== 状态 ===== */
.loading {
    text-align: center;
    padding: 40px;
    color: #667eea;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #718096;
}

.empty-state svg {
    width: 100px;
    height: 100px;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* ===== 徽章 ===== */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    position: relative;
    transition: all 0.2s ease;
}

.badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.badge-pending {
    background: #fef5e7;
    color: #d68910;
}

.badge-completed {
    background: #d4edda;
    color: #155724;
}

.badge-failed {
    background: #f8d7da;
    color: #721c24;
}

/* ===== 表格容器（桌面端滚动） ===== */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -30px;
    padding: 0 30px;
}

/* ===== 移动端卡片布局 ===== */
.mobile-cards {
    display: none;
}

.mobile-card {
    background: #f8fafc;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 12px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
}

.mobile-card:active {
    background: #edf2f7;
}

.mobile-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.mobile-card-title {
    font-weight: 600;
    color: #2d3748;
    font-size: 15px;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-card-status {
    flex-shrink: 0;
}

.mobile-card-info {
    margin-top: 10px;
    font-size: 13px;
    color: #718096;
}

.mobile-card-info-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid #e2e8f0;
}

.mobile-card-info-item:last-child {
    border-bottom: none;
}

.mobile-card-info-label {
    color: #a0aec0;
}

.mobile-card-info-value {
    color: #4a5568;
    font-weight: 500;
}

.mobile-card-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.mobile-card-actions .btn {
    flex: 1;
    min-width: 80px;
    text-align: center;
}

.mobile-card-details {
    display: none;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
    overflow: hidden;
}

.mobile-card-details.expanded {
    display: block;
}

.mobile-card-details pre {
    white-space: pre-wrap;
    word-break: break-all;
    overflow-wrap: break-word;
    max-width: 100%;
    overflow-x: hidden;
}

.mobile-card-expand {
    width: 100%;
    text-align: center;
    padding: 8px;
    background: transparent;
    border: none;
    color: #667eea;
    font-size: 13px;
    cursor: pointer;
    margin-top: 8px;
}

.mobile-select-all {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: #edf2f7;
    border-radius: 8px;
    margin-bottom: 12px;
}

.mobile-select-all label {
    margin: 0;
    color: #4a5568;
    font-weight: 500;
}

/* ===== 响应式：平板 ===== */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 0;
    }
    
    .card {
        padding: 15px;
        border-radius: 8px;
    }
    
    nav {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
    }
    
    nav .logo {
        font-size: 18px;
    }
    
    nav .nav-links {
        flex-direction: column;
        gap: 10px;
        width: 100%;
        text-align: center;
    }
    
    /* 隐藏桌面端表格，显示移动端卡片 */
    .table-container table,
    .desktop-table {
        display: none !important;
    }
    
    .mobile-cards {
        display: block !important;
    }
    
    .table-container {
        margin: 0;
        padding: 0;
        overflow-x: visible;
    }
    
    .button-group {
        flex-wrap: wrap !important;
    }
    
    .btn {
        font-size: 14px;
        padding: 8px 12px;
    }
    
    h2 {
        font-size: 20px;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
}

/* ===== 响应式：手机 ===== */
@media (max-width: 480px) {
    nav .logo {
        font-size: 16px;
    }
    
    .btn {
        font-size: 13px;
        padding: 6px 10px;
    }
    
    h2 {
        font-size: 18px;
    }
    
    .mobile-card {
        padding: 12px;
    }
    
    .mobile-card-title {
        font-size: 14px;
    }
    
    .mobile-card-info {
        font-size: 12px;
    }
}

/* ===== 桌面端强制显示表格 ===== */
@media (min-width: 769px) {
    .desktop-table {
        display: table !important;
    }
    
    .mobile-cards {
        display: none !important;
    }
}
