/* styles.css */

:root {
    --primary-color: #4a90e2;
    --secondary-color: #f5f5f5;
    --card-bg: rgba(255, 255, 255, 0.95);
    --text-color: #333;
    --border-radius: 15px;
    --box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    background: url('http://yz.0s.ink/background.jpg') no-repeat center center fixed;
    background-size: cover;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
}

.card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 20px;
    width: 100%;
    box-sizing: border-box;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
}

h1, h2 {
    color: var(--text-color);
    text-align: center;
    margin-bottom: 2rem;
    font-weight: 700;
    position: relative;
    padding-bottom: 10px;
}

h1::after, h2::after {
    display: none;
}

.form-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 25px;
}

input[type="text"] {
    flex: 1;
    min-width: 200px;
    padding: 12px 20px;
    border: 2px solid rgba(74, 144, 226, 0.2);
    border-radius: var(--border-radius);
    font-size: 16px;
    transition: all 0.3s ease;
    background: white;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 80px;
}

button:hover {
    background-color: #357abd;
    transform: translateY(-2px);
}

button i {
    font-size: 14px;
    margin: 0;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 20px;
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
}

th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

th {
    background-color: var(--primary-color);
    color: white;
    font-weight: 500;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: rgba(74, 144, 226, 0.1);
}

/* 操作按钮样式 */
.action-buttons {
    display: flex;
    gap: 8px;
}

.edit-btn, .delete-btn {
    padding: 8px 16px;
    font-size: 14px;
    border-radius: 20px;
    min-width: 80px;
}

.edit-btn {
    background-color: #ffc107;
}

.edit-btn:hover {
    background-color: #e0a800;
}

.delete-btn {
    background-color: #dc3545;
}

.delete-btn:hover {
    background-color: #c82333;
}

/* 美化消息提示 */
.message {
    padding: 15px;
    margin: 15px 0;
    border-radius: var(--border-radius);
    text-align: center;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.success {
    background-color: #28a745;
    color: white;
}

.error {
    background-color: #dc3545;
    color: white;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .card {
        padding: 15px;
        margin-left: auto;
        margin-right: auto;
        width: 100%;
    }

    /* 表格响应式处理 */
    .table-responsive {
        margin: 0 auto;
        width: 100%;
    }

    table {
        min-width: unset;
        width: 100%;
    }

    td, th {
        padding: 10px;
        font-size: 14px;
        white-space: normal;
    }

    .form-group {
        display: flex;
        flex-direction: row;
        gap: 8px;
        width: 100%;
    }

    .form-group input {
        flex: 1;
        margin: 0;
    }

    #generateCdkBtn, #addCdkBtn {
        padding: 8px 12px;
        font-size: 14px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .action-buttons {
        display: flex;
        gap: 5px;
        flex-wrap: nowrap;
    }

    .edit-btn, .delete-btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    .copyable-cdk {
        padding: 4px 8px;
        font-size: 13px;
    }

    h1, h2 {
        font-size: 1.5rem;
    }

    .edit-btn, .delete-btn {
        min-width: 60px;
        padding: 8px 12px;
    }
}

/* 加载动画 */
.loading {
    position: relative;
    opacity: 0.7;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

#generateCdkBtn, #addCdkBtn {
    background-color: var(--primary-color);
}

#generateCdkBtn:hover, #addCdkBtn:hover {
    background-color: #357abd;
}

/* 添加弹窗样式 */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.toast {
    padding: 15px 25px;
    margin-bottom: 10px;
    border-radius: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    max-width: 400px;
    animation: slideInRight 0.3s ease, fadeOut 0.5s ease 2.5s forwards;
    cursor: pointer;
    opacity: 1;
}

.toast i {
    font-size: 20px;
}

.toast.success {
    background-color: #28a745;
}

.toast.error {
    background-color: #dc3545;
}

.toast.info {
    background-color: #17a2b8;
}

.toast.warning {
    background-color: #ffc107;
    color: #333;
}

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

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

/* 添加登录相关样式 */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: url('https://source.unsplash.com/random/1920x1080?nature') no-repeat center center fixed;
    background-size: cover;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    max-width: 400px;
    width: 100%;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.login-card h2 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--text-color);
    font-size: 24px;
}

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

.login-card input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 25px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
}

.login-card input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

.login-card button {
    width: 100%;
    padding: 12px;
    border-radius: 25px;
    background-color: var(--primary-color);
    color: white;
    font-size: 16px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.login-card button:hover {
    background-color: #357abd;
    transform: translateY(-2px);
}

.login-card button i {
    font-size: 18px;
}

/* 退出登录按钮样式 */
.logout-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 10px 20px;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.logout-btn:hover {
    background-color: #c82333;
    transform: translateY(-2px);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .login-card {
        margin: 20px;
        padding: 20px;
    }

    .login-card h2 {
        font-size: 20px;
        margin-bottom: 20px;
    }

    .login-card input {
        padding: 10px 15px;
        font-size: 14px;
    }

    .login-card button {
        padding: 10px;
        font-size: 14px;
    }

    .logout-btn {
        bottom: 15px;
        right: 15px;
        padding: 8px 16px;
        font-size: 14px;
    }
}

/* 确保其他样式不受影响 */
#adminPanel {
    padding-bottom: 80px; /* 为退出按钮留出空间 */
}

/* Toast提示样式保持不变 */
.toast-container {
    z-index: 9999; /* 确保显示在最上层 */
}

/* 美化表格样式 */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    background: white;
    border-radius: 15px;
    margin: 0 auto;
}

table {
    min-width: 800px;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    background: #f8f9fa;
    padding: 15px;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #dee2e6;
}

td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background-color: #f8f9fa;
}

/* 可复制的CDK样式 */
.copyable-cdk {
    cursor: pointer;
    padding: 5px 10px;
    background: #f8f9fa;
    border-radius: 4px;
    display: inline-block;
    transition: all 0.3s ease;
}

.copyable-cdk:hover {
    background: #e9ecef;
}

/* 公告弹窗样式优化 */
.announcement-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    animation: fadeIn 0.3s ease;
    padding: 20px;
    box-sizing: border-box;
}

.announcement-content {
    position: relative;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 25px;
    border-radius: 15px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    max-height: 90vh;
    overflow-y: auto;
}

.announcement-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.announcement-header h3 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.announcement-header h3 i {
    color: #ffc107;
}

.announcement-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.announcement-close:hover {
    background: #f0f0f0;
    color: #dc3545;
}

.announcement-body {
    margin-bottom: 20px;
    line-height: 1.6;
    color: #444;
}

.announcement-body ul {
    padding-left: 20px;
    margin: 10px 0;
}

.announcement-body li {
    margin-bottom: 8px;
    position: relative;
    padding-left: 5px;
}

.announcement-footer {
    text-align: right;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

.announcement-footer button {
    padding: 8px 16px;
    border-radius: 25px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.announcement-footer button:hover {
    background-color: #357abd;
    transform: translateY(-2px);
}

/* 按钮通用样式优化 */
.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
}

.edit-btn, .delete-btn {
    padding: 8px 16px;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    white-space: nowrap;
}

.edit-btn {
    background-color: #28a745;
    color: white;
}

.edit-btn:hover {
    background-color: #218838;
    transform: translateY(-2px);
}

.delete-btn {
    background-color: #dc3545;
    color: white;
}

.delete-btn:hover {
    background-color: #c82333;
    transform: translateY(-2px);
}

/* 移动端适配优化 */
@media (max-width: 768px) {
    .announcement-content {
        padding: 20px;
        margin: 0;
        max-height: 80vh;
    }

    .announcement-header h3 {
        font-size: 1.2rem;
    }

    .announcement-body {
        font-size: 14px;
    }

    .action-buttons {
        gap: 5px;
    }

    .edit-btn, .delete-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    td, th {
        padding: 10px;
        font-size: 14px;
    }
}

/* 添加图标样式 */
.card h2 i {
    margin-right: 10px;
    color: var(--primary-color);
}

.copyable-cdk i {
    margin-right: 5px;
    color: #6c757d;
}

td i {
    margin-right: 5px;
    color: #6c757d;
    width: 16px;
    text-align: center;
}

.form-group i {
    margin-right: 5px;
}

/* 美化未绑定IP的显示 */
td:nth-child(2) {
    color: #6c757d;
}

/* 优化表格内容垂直对齐 */
td {
    vertical-align: middle;
}

/* 优化可复制CDK的样式 */
.copyable-cdk {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    background: #f8f9fa;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.copyable-cdk:hover {
    background: #e9ecef;
}

/* 确保按钮图标垂直对齐 */
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

button:before, 
button:after {
    display: none;
}

button i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 1em;
}

/* 确保所有按钮都有正确的内边距 */
.edit-btn, .delete-btn, #generateCdkBtn, #addCdkBtn, .logout-btn, .announcement-footer button {
    padding: 8px 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* 移动端适配优化 */
@media (max-width: 768px) {
    /* 表格响应式处理 */
    .table-responsive {
        margin: -15px;
        width: calc(100% + 30px);
    }

    table {
        min-width: unset; /* 移除最小宽度限制 */
        width: 100%;
    }

    /* 调整表格内容显示 */
    td, th {
        padding: 10px;
        font-size: 14px;
        white-space: normal; /* 允许文字换行 */
    }

    /* 优化按钮组布局 */
    .form-group {
        display: flex;
        flex-direction: row;
        gap: 8px;
        width: 100%;
    }

    /* 输入框和按钮布局 */
    .form-group input {
        flex: 1;
        margin: 0;
    }

    #generateCdkBtn, #addCdkBtn {
        padding: 8px 12px;
        font-size: 14px;
        white-space: nowrap;
        flex-shrink: 0; /* 防止按钮被压缩 */
    }

    /* 操作按钮布局 */
    .action-buttons {
        display: flex;
        gap: 5px;
        flex-wrap: nowrap;
    }

    .edit-btn, .delete-btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    /* 调整卡片内边距 */
    .card {
        padding: 15px;
        margin-bottom: 15px;
    }

    /* CDK文本样式 */
    .copyable-cdk {
        padding: 4px 8px;
        font-size: 13px;
    }
}

/* 确保表格在所有屏幕尺寸下都能正常显示 */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    background: white;
    border-radius: 15px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

/* 优化按钮样式 */
#generateCdkBtn, #addCdkBtn {
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* 输入框样式统一 */
.form-group input {
    height: 40px;
    padding: 8px 12px;
}

/* 确保内容不会超出容器 */
* {
    box-sizing: border-box;
}