:root {
    --primary-color: #2ecc71;
    --bg-color: #f4f4f4;
    --card-bg: #ffffff;
    --text-color: #333333;
    --border-color: #dddddd;
    --table-header-bg: #2ecc71;
    --table-header-text: #ffffff;
    --table-row-even: #f9f9f9;
    --btn-success: #2ecc71;
    --btn-secondary: #95a5a6;
}

body.night-mode {
    --primary-color: #27ae60;
    --bg-color: #1a1a1a;
    --card-bg: #2d2d2d;
    --text-color: #e0e0e0;
    --border-color: #444444;
    --table-header-bg: #1e8449;
    --table-header-text: #ffffff;
    --table-row-even: #333333;
    --btn-success: #27ae60;
    --btn-secondary: #7f8c8d;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
    line-height: 1.6;
}

.top-bar {
    background-color: var(--card-bg);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.top-bar-inner {
    max-width: 1500px;
    margin: 0 auto;
    padding: 1.2rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mode-toggle {
    cursor: pointer;
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: var(--bg-color);
    transition: transform 0.3s;
}

.mode-toggle:hover {
    transform: scale(1.1);
}

.search-container {
    display: flex;
    align-items: center;
}

.search-container input {
    padding: 8px 15px;
    width: 250px;
    border: 1px solid var(--border-color);
    border-radius: 0; /* 矩形无圆角 */
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.search-container input:focus {
    border-color: var(--primary-color);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--card-bg);
    border-radius: 12px;
    width: 90%;
    max-width: 520px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 1.2rem 2rem;
    background-color: rgba(46, 204, 113, 0.1);
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 1.25rem;
    color: var(--primary-color);
    margin: 0;
}

.modal-body {
    padding: 1.5rem 2rem;
    overflow-y: auto;
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-group.full-width {
    width: 100%;
}

.form-group input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 1rem;
    transition: all 0.3s;
}

.form-group input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.2);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 1rem;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: opacity 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn:hover {
    opacity: 0.8;
}

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

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 2rem;
    padding: 1rem 0;
}

.page-btn {
    padding: 8px 16px;
    background-color: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.page-btn:hover:not(.disabled) {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.page-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.page-info {
    font-size: 0.9rem;
    color: var(--text-color);
    font-weight: 500;
    margin: 0 10px;
}

.filter-custom-select {
    width: 150px;
}

.filter-custom-select .select-selected {
    padding: 6px 12px;
    font-size: 0.9rem;
}

.filter-custom-select .select-items {
    font-size: 0.9rem;
}

/* Custom Select 基础样式 (如果之前没定义全的话补全) */
.custom-select {
    position: relative;
    user-select: none;
}

.select-selected {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: border-color 0.2s;
}

.select-selected:hover {
    border-color: var(--primary-color);
}

.select-selected:after {
    content: "";
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-color: var(--text-color) transparent transparent transparent;
}

.select-items {
    position: absolute;
    background-color: var(--card-bg);
    top: 100%;
    left: 0;
    right: 0;
    z-index: 99;
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.select-items div {
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.select-items div:hover {
    background-color: rgba(46, 204, 113, 0.1);
}

.select-hide {
    display: none;
}

.option-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
}

.night-mode .sun, .day-mode .moon {
    display: none;
}

.container {
    max-width: 1500px;
    margin: 0 auto;
    padding: 0 1rem;
}

.table-container {
    background-color: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap; /* 强制不换行 */
}

/* 基础列宽分配逻辑 */
table {
    table-layout: auto; /* 恢复自动布局 */
    width: 100%;
}

th, td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

/* 前台针对性列宽及对齐分配 */
th:nth-child(1), td:nth-child(1) { width: 45px; text-align: center; }  /* 序号 */
th:nth-child(2), td:nth-child(2) { width: 220px; }                     /* 邮箱账号 */
th:nth-child(3), td:nth-child(3) { width: 110px; }                    /* 邮箱平台 */
th:nth-child(4), td:nth-child(4) { width: 75px; text-align: center; }  /* 前缀修改 (居中) */
th:nth-child(5), td:nth-child(5) { width: 120px; text-align: center; } /* 登录密码 (居中) */
th:nth-child(6), td:nth-child(6) { width: 90px; }                     /* 当前状态 */
th:nth-child(7), td:nth-child(7) { width: 100px; text-align: center; } /* 2FA秘钥 (居中) */
th:nth-child(8), td:nth-child(8) { width: 110px; text-align: center; } /* 辅助手机 (居中) */
th:nth-child(9), td:nth-child(9) { width: 160px; text-align: center; } /* 辅助邮箱 (居中) */
th:nth-child(10), td:nth-child(10) { width: auto; min-width: 150px; } /* 备注 */
th:nth-child(11), td:nth-child(11) { width: 130px; }                 /* 更新时间 */

.time-toggle {
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--btn-secondary);
    transition: color 0.2s;
}

.time-toggle:hover {
    color: var(--primary-color);
}

.time-hour {
    color: #2ecc71 !important; /* 1小时内：强绿 */
    font-weight: bold;
}

.time-day {
    color: #a5d6a7 !important; /* 1小时到1天：浅绿 */
    font-weight: 500;
}

th {
    background-color: var(--table-header-bg);
    color: var(--table-header-text);
    font-weight: 600;
}

tbody tr:nth-child(even) {
    background-color: var(--table-row-even);
}

td:nth-child(2) {
    color: #3498db;
    font-weight: 500;
}

tbody tr:hover {
    background-color: rgba(46, 204, 113, 0.1);
}

.linked-row {
    position: relative;
}

.linked-row td:first-child {
    padding-left: 10px; /* 给左侧色条留出一点空间感 */
}

/* 固定敏感信息列宽度，防止复制时文字变化导致晃动 */
th:nth-child(4), td:nth-child(4), /* 登录密码 */
th:nth-child(6), td:nth-child(6), /* 2FA秘钥 */
th:nth-child(7), td:nth-child(7)  /* 辅助手机 */ {
    width: 100px;
    text-align: center;
}

.copyable-secret {
    background-color: rgba(0,0,0,0.05);
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: bold;
    letter-spacing: 2px;
    color: var(--btn-secondary);
    display: inline-block;
}

.copyable-secret:hover {
    background-color: rgba(46, 204, 113, 0.1);
    color: #27ae60;
}

.copyable-email {
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.copyable-email:hover {
    text-decoration: underline;
    opacity: 0.8;
}

.copy-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #2ecc71;
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 9999;
    animation: fadeInOut 2s ease-in-out forwards;
}

/* Switch 开关样式 */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 22px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #2ecc71;
}

input:focus + .slider {
    box-shadow: 0 0 1px #2ecc71;
}

input:checked + .slider:before {
    transform: translateX(22px);
}

/* 表格中的开关间距 */
.table-switch-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translate(-50%, 20px); }
    15% { opacity: 1; transform: translate(-50%, 0); }
    85% { opacity: 1; transform: translate(-50%, 0); }
    100% { opacity: 0; transform: translate(-50%, -20px); }
}

.option-icon, .platform-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    transition: transform 0.2s;
}
