* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 导航栏 */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    border-radius: 15px;
}

.navbar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #667eea;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-links a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: #667eea;
}

/* 卡片样式 */
.card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 表单样式 */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #555;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 按钮样式 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

/* 表格样式 */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.table th,
.table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
}

.table tr:hover {
    background-color: #f8f9fa;
}

/* 移动端优化 */
/* 搜索表单横向布局与等宽适配 */
.search-form { display: flex; align-items: center; gap: 10px; }
.search-form .form-control { max-width: 240px; }
.search-form .btn { flex: 0 0 auto; }

@media (max-width: 768px) {
    .container {
        padding: 12px;
    }
    .navbar {
        padding: 0.75rem 1rem;
        margin-bottom: 1rem;
    }
    .navbar-content {
        flex-wrap: wrap;
        gap: 10px;
    }
    .nav-links {
        gap: 1rem;
        flex-wrap: wrap;
    }
    .card {
        padding: 1rem;
        border-radius: 14px;
    }
    .btn-sm {
        padding: 6px 10px;
        font-size: 12px;
    }
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        position: relative; /* 作为粘性定位的滚动容器 */
    }
    .table {
        min-width: 800px; /* 保证中间列可横向滚动 */
    }
    .table th, .table td {
        padding: 10px;
        white-space: nowrap;
    }
    /* 首尾列设置最小宽度，避免内容被裁剪 */
    .table th:first-child, .table td:first-child { min-width: 160px; }
    .table th:last-child, .table td:last-child { min-width: 180px; }
    /* 左右两侧列固定，便于横向滚动时保持名称和操作可见 */
    .table thead th:first-child,
    .table tbody td:first-child {
        position: sticky;
        left: 0;
        z-index: 2;
        background: #fff; /* 行内单元格使用白色背景 */
        box-shadow: 2px 0 8px rgba(0,0,0,0.06);
    }
    .table thead th:last-child,
    .table tbody td:last-child {
        position: sticky;
        right: 0;
        z-index: 2;
        background: #fff; /* 行内单元格使用白色背景 */
        box-shadow: -2px 0 8px rgba(0,0,0,0.06);
    }
    /* 表头保持原梯度背景，并提升层级避免被遮挡 */
    .table thead th:first-child,
    .table thead th:last-child {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        z-index: 4;
    }
    /* 头部布局在手机端：添加新密码在上，搜索在下 */
    .list-header { flex-direction: column; align-items: flex-start !important; }
    .header-actions { width: 100%; flex-direction: column; align-items: stretch !important; }
    .header-actions .add-btn { order: 1; width: 100%; }
    .header-actions .search-form { order: 2; width: 100%; flex-direction: row; flex-wrap: nowrap; }
    .header-actions .search-form .form-control { width: 100%; flex: 1 1 auto; min-width: 0; }
    .header-actions .search-form .btn { flex: 0 0 auto; }
}

/* 桌面端搜索框与按钮等高（尽量对齐视觉高度） */
.search-form .form-control { padding: 8px 16px; }

/* 警告和成功消息 */
.alert {
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 10px;
    border: none;
}

.alert-success {
    background: rgba(40, 167, 69, 0.1);
    color: #155724;
    border-left: 4px solid #28a745;
}

.alert-danger {
    background: rgba(220, 53, 69, 0.1);
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.alert-info {
    background: rgba(23, 162, 184, 0.1);
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: #000;
}

/* 密码强度指示器 */
.password-strength {
    margin-top: 5px;
    height: 5px;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.strength-weak { background: #dc3545; width: 33%; }
.strength-medium { background: #ffc107; width: 66%; }
.strength-strong { background: #28a745; width: 100%; }

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .navbar {
        padding: 1rem;
    }
    
    .navbar-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-links {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .card {
        padding: 1.5rem;
    }
    
    .table {
        font-size: 14px;
    }
    
    .table th,
    .table td {
        padding: 10px 8px;
    }
}

/* 工具提示 */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: rgba(0, 0, 0, 0.8);
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 14px;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* 加载动画 */
.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); }
}

/* 密码显示/隐藏按钮 */
.password-toggle {
    position: relative;
}

.password-toggle-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    font-size: 18px;
}

.password-toggle-btn:hover {
    color: #333;
}