/* 六椰手工小屋 - 全局样式优化 */

/* 基础重置和通用样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #333;
    line-height: 1.5;
    overflow-x: hidden;
}

/* 容器样式优化 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px;
    width: 100%;
}

/* 卡片式布局优化 */
.content {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    overflow: hidden;
}

/* 表格容器优化 - 确保在小屏幕上可滚动 */
.table-container {
    overflow-x: auto;
    margin-bottom: 20px;
    border-radius: 10px;
    border: 1px solid #f0f0f0;
}

/* 表格样式优化 */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th, td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
    white-space: nowrap;
}

th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #666;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:hover {
    background-color: #f8f9fa;
}

/* 按钮样式优化 */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: 80px;
    justify-content: center;
}

.btn-group {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

/* 表单样式优化 */
.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #666;
    font-size: 14px;
}

.form-input, .form-select {
    width: 100%;
    padding: 10px;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

/* 模态框样式优化 */
.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;
    overflow-y: auto;
}

.modal-content {
    background-color: white;
    margin: 20px auto;
    padding: 20px;
    border-radius: 15px;
    width: 95%;
    max-width: 500px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    animation: slideIn 0.3s;
    max-height: 90vh;
    overflow-y: auto;
}

/* 布局优化 - 更紧凑的间距 */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    gap: 10px;
    flex-wrap: wrap;
}

.search-box {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* 响应式设计优化 */
@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
        padding: 15px;
    }
    
    .user-info {
        width: 100%;
        justify-content: center;
    }
    
    .action-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .search-box {
        justify-content: center;
    }
    
    .search-input {
        width: 200px;
    }
    
    .content {
        padding: 15px;
    }
    
    .page-title {
        font-size: 18px;
        margin-bottom: 15px;
    }
    
    .modal-content {
        margin: 10px;
        padding: 15px;
        max-height: 95vh;
    }
    
    /* 表格在移动端优化 */
    table {
        font-size: 12px;
    }
    
    th, td {
        padding: 8px 6px;
    }
    
    /* 隐藏部分次要列 */
    th:nth-child(6), th:nth-child(7), 
    td:nth-child(6), td:nth-child(7) {
        display: none;
    }
}

@media (max-width: 480px) {
    .header-title {
        font-size: 18px;
    }
    
    .search-input {
        width: 150px;
    }
    
    .btn {
        padding: 6px 12px;
        font-size: 12px;
        min-width: 60px;
    }
    
    .form-group {
        margin-bottom: 12px;
    }
    
    .form-input, .form-select {
        padding: 8px;
        font-size: 13px;
    }
    
    /* 隐藏更多列 */
    th:nth-child(5), th:nth-child(8), 
    td:nth-child(5), td:nth-child(8) {
        display: none;
    }
}

/* 统计卡片优化 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.stat-card {
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    font-size: 14px;
}

.stat-value {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 12px;
    opacity: 0.9;
}

/* 会员管理页面优化 */
#userModal .form-group {
    margin-bottom: 12px;
}

#userModal h4 {
    font-size: 14px;
    margin-bottom: 12px;
    color: #666;
    font-weight: 600;
}

#userModal hr {
    margin: 15px 0;
    border: 1px solid #f0f0f0;
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        transform: translateY(-20px); 
        opacity: 0; 
    }
    to { 
        transform: translateY(0); 
        opacity: 1; 
    }
}

/* 消息提示优化 */
.message {
    margin-bottom: 15px;
    padding: 10px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
}

/* 优化滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* 内容区域紧凑布局 */
.content-compact {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* 输入框分组 */
.input-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.input-group .form-group {
    flex: 1;
    min-width: 150px;
}

/* 底部导航栏 - 优化移动端体验 */
.bottom-nav {
    background: white;
    border-radius: 20px 20px 0 0;
    padding: 12px 10px 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.08);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 100%;
    margin: 0;
    display: flex;
    justify-content: space-around;
    gap: 5px;
    z-index: 1000;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: #666;
    text-decoration: none;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.2s ease;
    padding: 8px 12px;
    border-radius: 12px;
    min-width: 60px;
    text-align: center;
}

.nav-item:hover, .nav-item.active {
    color: #667eea;
    background-color: rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.nav-item i {
    font-size: 22px;
    margin-bottom: 2px;
}

/* 移动端触控优化 */
.btn, .project-card, .project-action, .nav-item {
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

/* 表单元素优化 */
.form-input, .form-select {
    font-size: 16px;
    min-height: 44px;
    padding: 12px 15px;
}

.form-label {
    font-size: 14px;
    font-weight: 600;
}

/* 按钮优化 */
.btn {
    min-height: 44px;
    min-width: 100px;
    font-size: 16px;
    padding: 10px 20px;
    border-radius: 10px;
}

/* 卡片优化 */
.project-card {
    margin-bottom: 15px;
    padding: 20px;
    border-radius: 15px;
}

/* 移动端字体优化 */
@media (max-width: 768px) {
    body {
        font-size: 16px;
        line-height: 1.6;
    }
    
    .page-title {
        font-size: 20px;
        font-weight: 700;
    }
    
    .project-name {
        font-size: 18px;
        font-weight: 600;
    }
    
    /* 优化滚动体验 */
    html {
        scroll-behavior: smooth;
    }
    
    /* 避免内容被底部导航栏遮挡 */
    .container {
        padding-bottom: 100px;
    }
    
    /* 优化列表项间距 */
    .projects-grid {
        gap: 12px;
    }
    
    /* 优化模态框体验 */
    .modal {
        padding: 10px;
    }
    
    .modal-content {
        margin: 10px auto;
        max-height: calc(100vh - 20px);
        overflow-y: auto;
    }
    
    /* 优化表单间距 */
    .form-group {
        margin-bottom: 18px;
    }
    
    /* 优化输入框焦点样式 */
    .form-input:focus, .form-select:focus {
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
    }
    
    /* 优化按钮点击反馈 */
    .btn:active {
        transform: scale(0.98);
    }
    
    /* 优化头像大小 */
    .user-avatar {
        width: 50px;
        height: 50px;
    }
}

/* 优化的间距 */
.mt-1 { margin-top: 5px; }
.mt-2 { margin-top: 10px; }
.mt-3 { margin-top: 15px; }
.mb-1 { margin-bottom: 5px; }
.mb-2 { margin-bottom: 10px; }
.mb-3 { margin-bottom: 15px; }
.mx-1 { margin-left: 5px; margin-right: 5px; }
.mx-2 { margin-left: 10px; margin-right: 10px; }
.p-1 { padding: 5px; }
.p-2 { padding: 10px; }
.p-3 { padding: 15px; }

/* 优化的滚动条 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* 防止文本溢出 */
.text-ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 优化图片显示 */
img {
    max-width: 100%;
    height: auto;
}

/* 优化加载状态 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}