/* ============================================
   服务器管理系统 - 极简蓝白风格
   版本：v2.0 - 增强续费按钮显示
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #5792f5;
    --primary-dark: #3d7bd9;
    --success: #52c41a;
    --warning: #faad14;
    --danger: #ff4d4f;
    --dark: #333333;
    --gray: #666666;
    --light-gray: #f5f5f5;
    --border: #e0e0e0;
    --white: #ffffff;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Microsoft YaHei", sans-serif;
    background: #f5f5f5;
    color: #333;
    font-size: 14px;
    line-height: 1.6;
}

.wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================
   顶部导航栏
   ============================================ */
.main-header {
    background: var(--primary);
    padding: 0 2rem;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-left {
    display: flex;
    align-items: center;
}

.logo {
    font-size: 18px;
    font-weight: 500;
    color: white;
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.user-info {
    color: white;
    font-size: 14px;
}

.btn-logout {
    padding: 6px 16px;
    background: rgba(255,255,255,0.2);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 13px;
    border: none;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.3);
}

/* ============================================
   主内容区
   ============================================ */
.main-content {
    flex: 1;
    padding: 20px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* ============================================
   统计面板 - 隐藏
   ============================================ */
.stats-grid {
    display: none;
}

/* ============================================
   服务器列表区域
   ============================================ */
.content-section {
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
}

.section-header-simple {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: white;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 12px;
}

.header-title h2 {
    font-size: 16px;
    color: var(--dark);
    font-weight: 500;
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-filter {
    padding: 6px 16px;
    border: 1px solid var(--border);
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    color: var(--dark);
    transition: all 0.2s;
}

.btn-filter:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-filter.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-add-new {
    padding: 6px 16px;
    background: var(--primary);
    color: white;
    border: 1px solid var(--primary);
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.btn-add-new:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* ============================================
   列表表头
   ============================================ */
.list-header {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    background: #fafafa;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 13px;
    color: var(--dark);
}

/* ============================================
   列表主体
   ============================================ */
.list-body {
    max-height: calc(100vh - 240px);
    overflow-y: auto;
}

/* ============================================
   列表项
   ============================================ */
.list-item {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s;
    background: white;
}

.list-item:hover {
    background: #fafafa;
}

.list-item:last-child {
    border-bottom: none;
}

/* 状态样式 */
.item-expired {
    background: #fff2f0;
}

.item-expired:hover {
    background: #ffe7e3;
}

.item-expiring {
    background: #fffbe6;
}

.item-expiring:hover {
    background: #fff8d6;
}

/* 列宽度 */
.col-name { flex: 0 0 14%; min-width: 120px; }
.col-ip { flex: 0 0 12%; min-width: 110px; }
.col-price { flex: 0 0 9%; min-width: 80px; }
.col-expire { flex: 0 0 12%; min-width: 100px; }
.col-status { flex: 0 0 8%; min-width: 70px; }
.col-wechat { flex: 0 0 14%; min-width: 120px; }
.col-remark { flex: 0 0 13%; min-width: 110px; }
.col-actions { flex: 0 0 18%; min-width: 180px; }

/* ============================================
   单元格样式
   ============================================ */
.name-text {
    font-size: 14px;
    color: var(--dark);
    font-weight: 500;
}

.ip-text {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    color: var(--gray);
    font-size: 13px;
}

.price-text {
    color: var(--dark);
    font-weight: 500;
    font-size: 14px;
}

.expire-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.expire-date {
    font-size: 13px;
    color: var(--dark);
}

.expire-days {
    font-size: 12px;
    font-weight: 500;
}

.expire-days.active { 
    color: var(--success);
}

.expire-days.expiring { 
    color: var(--warning);
}

.expire-days.expired { 
    color: var(--danger);
}

.status-tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.status-tag.active {
    background: #f6ffed;
    color: var(--success);
    border: 1px solid #b7eb8f;
}

.status-tag.expiring {
    background: #fffbe6;
    color: var(--warning);
    border: 1px solid #ffe58f;
}

.status-tag.expired {
    background: #fff2f0;
    color: var(--danger);
    border: 1px solid #ffccc7;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.contact-item {
    font-size: 13px;
    color: var(--gray);
    display: flex;
    gap: 6px;
}

.contact-item .label {
    color: var(--gray);
    font-weight: 600;
}

.contact-item .value {
    color: var(--dark);
    font-weight: 500;
}

.remark-text {
    font-size: 13px;
    color: var(--gray);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

/* ============================================
   操作按钮
   ============================================ */
.action-btns {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.btn-action {
    padding: 5px 12px;
    border: 1px solid;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-action:hover {
    opacity: 0.8;
}

/* 普通续费按钮（正常状态的服务器） */
.btn-renew {
    border-color: var(--success);
    color: var(--success);
}

.btn-renew:hover {
    background: var(--success);
    color: white;
}

/* 主要续费按钮（已过期的服务器）- 更醒目 */
.btn-renew-primary {
    border-color: var(--warning);
    background: linear-gradient(135deg, #faad14 0%, #ff8c00 100%);
    color: white;
    font-weight: 600;
    padding: 6px 14px;
    box-shadow: 0 2px 4px rgba(250, 173, 20, 0.3);
}

.btn-renew-primary:hover {
    background: linear-gradient(135deg, #ff8c00 0%, #faad14 100%);
    box-shadow: 0 3px 6px rgba(250, 173, 20, 0.4);
    transform: translateY(-1px);
}

.btn-edit {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-edit:hover {
    background: var(--primary);
    color: white;
}

.btn-delete {
    border-color: var(--danger);
    color: var(--danger);
}

.btn-delete:hover {
    background: var(--danger);
    color: white;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray);
    font-size: 14px;
}

/* ============================================
   登录页面
   ============================================ */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f2f5;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    max-width: 400px;
    width: 100%;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 24px;
    color: var(--dark);
    margin-bottom: 8px;
    font-weight: 500;
}

.login-header p {
    color: var(--gray);
    font-size: 14px;
}

.alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 13px;
}

.alert-error {
    background: #fff2f0;
    color: var(--danger);
    border: 1px solid #ffccc7;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    color: var(--dark);
    font-weight: 500;
    font-size: 14px;
}

.login-form input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s;
    outline: none;
}

.login-form input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(87,146,245,0.1);
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-block {
    width: 100%;
}

.login-footer {
    margin-top: 20px;
    text-align: center;
    color: var(--gray);
    font-size: 12px;
}

/* ============================================
   模态框
   ============================================ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.45);
    z-index: 2000;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 4px;
    max-width: 650px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.modal-header {
    padding: 16px 20px;
    background: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 18px;
    color: var(--dark);
    font-weight: 500;
}

.modal-close {
    font-size: 24px;
    color: var(--gray);
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s;
}

.modal-close:hover {
    color: var(--dark);
}

.modal-form {
    padding: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--dark);
    font-weight: 500;
    font-size: 14px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s;
    outline: none;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(87,146,245,0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.modal-footer {
    padding: 16px 20px;
    background: #fafafa;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid var(--border);
}

.btn-secondary {
    background: white;
    color: var(--dark);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--light-gray);
}

/* ============================================
   响应式设计
   ============================================ */
.contact-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.contact-item {
    font-size: 13px;
    color: var(--gray);
}

.contact-item .label {
    color: var(--gray);
    font-weight: 500;
}

.contact-item .value {
    color: var(--dark);
}

.remark-text {
    font-size: 13px;
    color: var(--gray);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 列宽度 */
.col-name { flex: 0 0 14%; min-width: 120px; }
.col-ip { flex: 0 0 16%; min-width: 140px; }
.col-price { flex: 0 0 9%; min-width: 80px; }
.col-expire { flex: 0 0 12%; min-width: 100px; }
.col-status { flex: 0 0 8%; min-width: 70px; }
.col-wechat { flex: 0 0 13%; min-width: 110px; }
.col-remark { flex: 0 0 10%; min-width: 90px; }
.col-actions { flex: 0 0 18%; min-width: 180px; }

/* 批量导入预览表格 */
.batch-preview {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

@media (max-width: 1400px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1200px) {
    .col-name { flex: 0 0 15%; }
    .col-remark { flex: 0 0 11%; }
    .col-actions { flex: 0 0 20%; }
}

@media (max-width: 1024px) {
    .main-content {
        padding: 1.5rem 1rem;
    }
    
    .stats-grid {
        gap: 1rem;
    }
    
    .list-item {
        font-size: 13px;
        padding: 1rem 1.5rem;
    }
}

@media (max-width: 768px) {
    .main-header {
        padding: 1rem;
        flex-wrap: wrap;
        height: auto;
        min-height: 70px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .section-header-simple {
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
    }
    
    .header-title {
        margin-bottom: 0.75rem;
    }
    
    .header-actions {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .btn-filter {
        flex: 1 1 calc(25% - 0.5rem);
        min-width: 70px;
        text-align: center;
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .btn-add-new {
        width: 100%;
        margin-top: 0.5rem;
    }
    
    /* 手机端隐藏表头，改为卡片 */
    .list-header {
        display: none;
    }
    
    .list-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 1rem;
        gap: 0.75rem;
    }
    
    .list-item::before {
        display: none;
    }
    
    .list-item > div {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .list-item > div::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--gray);
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    .col-name::before { content: "🏷️ 名称"; }
    .col-ip::before { content: "🌐 IP"; }
    .col-price::before { content: "💰 价格"; }
    .col-expire::before { content: "📅 到期"; }
    .col-status::before { content: "📊 状态"; }
    .col-wechat::before { content: "👤 客户"; }
    .col-remark::before { content: "📝 备注"; }
    .col-actions::before { content: "⚙️ 操作"; }
    
    .col-name, .col-ip, .col-price, .col-expire,
    .col-status, .col-wechat, .col-remark, .col-actions {
        flex: none;
    }
    
    .contact-info {
        flex-direction: row;
        gap: 12px;
    }
    
    .expire-info {
        flex-direction: row;
        gap: 8px;
    }
    
    .action-btns {
        justify-content: flex-end;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 16px;
    }
    
    .stat-value {
        font-size: 1.75rem;
    }
    
    .btn-action {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .modal-content {
        width: 95%;
    }
    
    .modal-form {
        padding: 1.5rem;
    }
}
