/* 基础样式与重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", sans-serif;
}

:root {
    --primary: #2196F3;
    --success: #4CAF50;
    --danger: #f44336;
    --gray: #9e9e9e;
    --light-gray: #f5f5f5;
    --dark: #2c3e50;
    --white: #ffffff;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

body {
    background-color: #f8f9fa;
    color: var(--dark);
    line-height: 1.6;
    padding: 0;
    margin: 0;
}

/* 通用按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 6px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    height: 40px;
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: #0b7dda;
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-danger:hover {
    background-color: #d32f2f;
}

.btn-refresh {
    background-color: var(--primary);
    color: white;
}

.btn-refresh:hover {
    background-color: #0b7dda;
}

.btn-cancel {
    background-color: var(--light-gray);
    color: var(--dark);
}

.btn-cancel:hover {
    background-color: #e0e0e0;
}

/* 登录页面样式 */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 400px;
    background-color: var(--white);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: var(--transition);
}

.login-header {
    padding: 30px 20px;
    text-align: center;
    background-color: var(--primary);
    color: white;
}

.login-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.9;
}

.login-title {
    font-size: 22px;
    font-weight: 600;
    margin: 0;
}

.login-form {
    padding: 30px 25px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
    font-size: 14px;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
}

.form-control {
    width: 100%;
    padding: 12px 12px 12px 40px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    transition: var(--transition);
    background-color: #f9f9f9;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
    background-color: white;
}

.login-btn {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    background-color: var(--primary);
    color: white;
}

.login-btn:hover {
    background-color: #0b7dda;
}

.login-footer {
    padding: 20px;
    text-align: center;
    background-color: #f9f9f9;
    border-top: 1px solid #eee;
}

.login-footer p {
    margin: 0;
    color: #777;
    font-size: 13px;
}

.footer-hint {
    margin-top: 5px;
    color: #999;
    font-size: 12px;
}

.error-message {
    padding: 10px 15px;
    background-color: #ffebee;
    color: #c62828;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
    display: none;
    border-left: 4px solid var(--danger);
}

.error-message.show {
    display: block;
}

/* 主页面样式 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background-color: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    box-sizing: border-box;
}

.system-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.system-icon {
    font-size: 24px;
    color: var(--primary);
}

.system-title {
    font-size: 17px;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 全局更新时间样式 */
.global-update-time {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #666;
    font-size: 13px;
    margin-right: 15px;
    white-space: nowrap;
}

.global-update-time i {
    color: var(--primary);
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 14px;
    padding: 8px 12px;
    border-radius: 4px;
    transition: var(--transition);
    min-width: 40px;
    justify-content: center;
}

.logout-btn:hover {
    color: var(--danger);
    background-color: #fff5f5;
}

.main-content {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 2px;
    width: 100%;
    flex-wrap: nowrap;
    gap: 10px;
}

.section-header h2 {
    margin: 0;
    font-size: 20px;
    color: var(--dark);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 卡片容器样式 */
.cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.card {
    background-color: var(--white);
    border-radius: 10px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
    position: relative;
    border-top: 4px solid var(--gray);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.card-online {
    border-top-color: var(--success);
    background-color: #f9fff9;
}

.card-offline {
    border-top-color: var(--danger);
    background-color: #fff9f9;
}

.card-unknown {
    border-top-color: var(--gray);
    background-color: #f9f9f9;
}

/* 超时卡片样式（超过6小时10分钟未更新） */
.card-timeout {
    border-top-color: #ffc107; /* 黄色边框 */
    background-color: #fffdf0; /* 浅黄色背景 */
}

.card-timeout .status-dot {
    background-color: #ffc107; /* 黄色状态点 */
}

.card-timeout .status-text {
    color: #e6a800; /* 深黄色文字 */
}

.card-header {
    padding: 15px 20px;
    position: relative;
    border-bottom: 1px solid #f0f0f0;
}

.card-title {
    font-size: 17px;
    font-weight: 600;
    margin: 0;
    color: var(--dark);
}

.card-delete-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    font-size: 16px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.card-delete-btn:hover {
    color: var(--danger);
    background-color: #fff5f5;
}

.card-status {
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    border-bottom: 1px solid #f0f0f0;
}

.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.card-online .status-dot {
    background-color: var(--success);
}

.card-offline .status-dot {
    background-color: var(--danger);
}

.card-unknown .status-dot {
    background-color: var(--gray);
}

.status-text {
    font-weight: 500;
    font-size: 14px;
}

.card-online .status-text {
    color: var(--success);
}

.card-offline .status-text {
    color: var(--danger);
}

.last-check {
    font-size: 12px;
    color: #777;
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 5px;
}

.last-check::before {
    content: "\f017";
    font-family: "Font Awesome 6 Free";
    font-weight: 400;
    font-size: 11px;
    color: #999;
}

.card-body {
    padding: 20px;
}

.card-info {
    margin-bottom: 12px;
    font-size: 14px;
}

.card-info:last-child {
    margin-bottom: 0;
}

.info-label {
    display: inline-block;
    width: 70px;
    color: #666;
    font-weight: 500;
}

.ip-port {
    color: var(--primary);
    text-decoration: underline;
    cursor: copy;
    padding: 2px 4px;
    border-radius: 3px;
    transition: var(--transition);
}

.ip-port:hover {
    background-color: #e3f2fd;
}

/* 卡片底部时间样式优化 */
.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background-color: #f9f9f9;
    border-top: 1px solid #f0f0f0;
}

.update-time {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #666;
}

.update-time i {
    font-size: 11px;
    color: #999;
}

/* 卡片时间显示优化 */
.update-time-text, .check-time {
    color: #666;
}

/* 超时状态下的时间显示 */
.card-timeout .update-time-text,
.card-timeout .check-time {
    color: #b38b00;
    font-weight: 500;
}

/* 空状态样式 */
.empty-state {
    grid-column: 1 / -1;
    padding: 50px 20px;
    text-align: center;
    background-color: var(--white);
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.empty-icon {
    font-size: 48px;
    color: #ddd;
    margin-bottom: 15px;
}

.empty-state p {
    margin: 0;
    color: #777;
    font-size: 16px;
}

.empty-hint {
    margin-top: 8px;
    color: #999;
    font-size: 14px;
}

/* 提示组件样式 */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--dark);
    color: white;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.toast.show {
    opacity: 1;
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    transform: translateX(120%);
    transition: transform 0.3s ease;
    z-index: 1000;
    max-width: 300px;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    background-color: var(--success);
}

.notification.error {
    background-color: var(--danger);
}

.notification.info {
    background-color: var(--primary);
}

/* 删除确认框样式 */
.confirm-modal {
    position: absolute;
    z-index: 1010;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.confirm-modal.active {
    opacity: 1;
    visibility: visible;
}

.confirm-dialog {
    background-color: var(--white);
    border-radius: 8px;
    width: 280px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    transform: translateY(-10px);
    transition: transform 0.2s;
}

.confirm-modal.active .confirm-dialog {
    transform: translateY(0);
}

.confirm-title {
    padding: 15px 20px;
    background-color: #f5f5f5;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 1px solid #eee;
}

.confirm-message {
    padding: 20px;
    text-align: center;
    font-size: 14px;
    color: #555;
}

.confirm-buttons {
    display: flex;
    border-top: 1px solid #eee;
}

.confirm-buttons .btn {
    flex: 1;
    border-radius: 0;
    height: 45px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .section-header {
        flex-direction: row;
        align-items: center;
    }
    
    .section-header h2 {
        font-size: 18px;
    }
    
    .refresh-text {
        display: none;
    }
    
    .btn-refresh {
        padding: 10px;
        min-width: 40px;
        justify-content: center;
    }
    
    .logout-text {
        display: none;
    }
    
    .global-update-time {
        display: none; /* 移动端隐藏全局更新时间 */
    }
    
    .last-check {
        margin-left: 0;
        width: 100%;
        margin-top: 5px;
    }
    
    .card-status {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .empty-state {
        padding: 30px 15px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 10px 12px;
    }
    
    .system-icon {
        font-size: 22px;
    }
    
    .system-title {
        font-size: 16px;
    }
    
    .main-content {
        padding: 12px;
    }
    
    .section-header {
        margin-bottom: 15px;
    }
    
    .cards-container {
        gap: 15px;
    }
    
    .card {
        min-width: 0;
    }
    
    .card-header, .card-body, .card-footer {
        padding: 12px 15px;
    }
    
    .card-title {
        font-size: 16px;
    }
    
    .card-status .last-check {
        font-size: 11px;
    }
    
    .card-footer .update-time {
        font-size: 11px;
    }
}