/*
 * 主样式表
 * 
 * @copyright Copyright (c) 2023 录哲资源网 (https://www.luzhezy.top/)
 * @author 录哲资源网 <contact@469375246@qq.com>
 * @version 1.3.0
 */

/* 基本样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 现代化美化样式 */
:root {
    --primary-color: #4361ee;
    --primary-hover: #3a56d4;
    --secondary-color: #6c757d;
    --success-color: #2ecc71;
    --danger-color: #e74c3c;
    --light-bg: #f7f9fc;
    --dark-text: #2c3e50;
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --transition-speed: 0.3s;
}

body {
    font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--dark-text);
    background-color: var(--light-bg);
    transition: background-color 0.3s ease;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    color: #2c3e50;
    margin-bottom: 10px;
}

header p {
    color: #7f8c8d;
}

/* 表单样式 */
.form-container {
    background-color: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--card-shadow);
    margin-bottom: 30px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.form-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.result-container {
    background-color: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--card-shadow);
    margin-top: 30px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.result-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.search-container {
    background-color: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--card-shadow);
    margin-bottom: 20px;
}

.history-container {
    background-color: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--card-shadow);
    margin-bottom: 30px;
}

/* 表单元素样式 */
input[type="url"], 
input[type="password"],
input[type="text"],
textarea {
    width: 100%;
    padding: 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
    max-width: 100%; /* 确保不会超出容器 */
    box-sizing: border-box; /* 确保padding和border包含在width内 */
}

input[type="url"]:focus, 
input[type="password"]:focus,
input[type="text"]:focus,
textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
    outline: none;
}

/* 按钮样式 */
.btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all var(--transition-speed);
    position: relative;
    overflow: hidden;
}

.btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%, -50%);
    transform-origin: 50% 50%;
}

.btn:focus:not(:active)::after {
    animation: ripple 1s ease-out;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }
    100% {
        transform: scale(200, 200);
        opacity: 0;
    }
}

.btn-secondary {
    background-color: #6c757d;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

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

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

.btn-sm {
    padding: 6px 12px;
    font-size: 14px;
}

.mt-15 {
    margin-top: 15px;
}

/* 表单文本提示 */
.form-text {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #6c757d;
}

/* 结果区域样式 */
.result-container h2 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.result-box {
    background-color: #f1f8fd;
    padding: 20px;
    border-radius: 4px;
    border-left: 4px solid #3498db;
}

.url-display {
    display: flex;
    margin-top: 15px;
}

#generatedUrl {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
    font-size: 14px;
}

.btn-copy {
    background-color: #2ecc71;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
}

.btn-copy:hover {
    background-color: #27ae60;
}

.error-message {
    background-color: #ffeaea;
    color: #e74c3c;
    padding: 15px;
    border-radius: 4px;
    margin-top: 20px;
    border-left: 4px solid #e74c3c;
}

footer {
    text-align: center;
    margin-top: 50px;
    color: #7f8c8d;
    font-size: 14px;
}

/* 响应式设计 */
@media (max-width: 600px) {
    .container {
        padding: 15px;
    }
    
    .form-container, .result-container {
        padding: 20px;
    }
    
    .search-input-group {
        flex-direction: column;
        gap: 10px;
    }
}

/* 选项卡样式 */
.tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid #ddd;
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #7f8c8d;
    position: relative;
}

.tab-btn:hover {
    color: #3498db;
}

.tab-btn.active {
    color: #3498db;
    font-weight: 600;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: #3498db;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 批量结果表格样式 */
.batch-results-table {
    margin-top: 15px;
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden; /* 防止水平方向溢出 */
    width: 100%;
}

.batch-results-table table {
    table-layout: fixed; /* 固定表格布局 */
    width: 100%;
}

.batch-results-table th,
.batch-results-table td {
    word-break: break-word; /* 长文本自动换行 */
    overflow-wrap: break-word;
}

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

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.url-cell {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    word-break: break-word;
    line-height: 1.4;
    padding: 12px 15px;
    background-color: #f9f9f9;
    border-radius: 6px;
    box-shadow: inset 0 0 3px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
}

.url-cell:hover {
    background-color: #f0f7ff;
    box-shadow: inset 0 0 5px rgba(67, 97, 238, 0.15);
}

.short-url-text {
    font-weight: 500;
    color: var(--primary-color);
    padding: 4px 8px;
    border-radius: 4px;
    background-color: rgba(67, 97, 238, 0.08);
    display: inline-block;
    margin: 2px 0;
}

.copy-cell-btn {
    background-color: #2ecc71;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

copy-cell-btn:hover {
    background-color: #27ae60;
}

/* 表格美化 */
.history-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.history-table th {
    background-color: #f1f4f9;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.05em;
    padding: 16px;
}

.history-table td {
    padding: 16px;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s;
}

.history-table tr:hover td {
    background-color: #f8fafd;
}

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

/* 导航样式 */
.main-nav {
    margin-top: 15px;
}

.main-nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.main-nav a {
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
    padding: 5px 10px;
}

.main-nav a:hover {
    text-decoration: underline;
}

.history-link {
    margin-left: auto;
    color: #3498db;
    text-decoration: none;
    font-size: 14px;
}

.history-link:hover {
    text-decoration: underline;
}

/* 历史记录页面样式 */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
}

.empty-state p {
    margin-bottom: 20px;
    color: #7f8c8d;
    font-size: 18px;
}

/* 合并重复的历史记录按钮样式 */
.copy-btn, .delete-btn {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    margin-left: 5px;
}

copy-btn:hover {
    background-color: #2980b9;
}

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

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

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

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 500px;
    position: relative;
}

close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #6c757d;
}

close-btn:hover {
    color: #343a40;
}

.modal h3 {
    margin-bottom: 15px;
    color: #343a40;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* 通知效果美化 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    transform: translateX(120%);
    animation: slide-in 0.5s forwards, slide-out 0.5s 2.5s forwards;
}

.notification.success {
    background-color: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.notification.error {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

@keyframes slide-in {
    to { transform: translateX(0); }
}

@keyframes slide-out {
    to { transform: translateX(120%); }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* 密码搜索表单样式 */
.password-search-form {
    max-width: 600px;
    margin: 0 auto;
}

.search-input-group {
    display: flex;
    gap: 10px;
}

.search-input-group input {
    flex: 1;
}

.results-header {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.results-header h3 {
    color: #2c3e50;
    font-size: 18px;
    font-weight: 600;
}

/* 管理员入口链接样式 */
.admin-link {
    color: #7f8c8d;
    text-decoration: none;
    font-size: 13px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.admin-link:hover {
    opacity: 1;
    text-decoration: underline;
}

/* 批量操作样式 */
.flex-space-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.batch-actions {
    display: flex;
    gap: 10px;
    position: sticky;
    right: 0;
    background-color: white;
    padding: 10px;
    box-shadow: -5px 0 5px rgba(0, 0, 0, 0.1);
}

input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
    vertical-align: middle;
}

/* 增强表格样式 */
.history-table th:first-child,
.history-table td:first-child {
    text-align: center;
    padding: 12px 8px;
}

.history-table th {
    position: relative;
}

.history-table th input[type="checkbox"] {
    margin: 0;
}

/* 表格样式简化 */
.table-container {
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    margin-bottom: 15px;
    position: relative;
}

/* 固定表头样式 */
.table-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background-color: #f1f4f9;
    width: 100%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.table-header table {
    margin-bottom: 0;
    border-bottom: 2px solid #e0e0e0;
}

.table-body {
    width: 100%;
}

/* 隐藏滚动区域内表格的表头 */
.table-body thead {
    display: none;
}

/* 批量转换区域样式 */
#batchForm {
    overflow: hidden;
}

#batchUrls {
    resize: vertical;
    min-height: 120px;
    max-height: 400px;
    overflow-y: auto;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .tab-content {
        padding: 15px 10px;
    }
    
    #batchUrls {
        min-height: 100px;
    }
    
    .url-cell {
        max-width: 200px; /* 在移动设备上减小宽度 */
    }
}

/* 单选按钮组样式 */
.radio-group {
    display: flex;
    gap: 20px;
    margin-top: 8px;
}

.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.radio-label input[type="radio"] {
    margin-right: 8px;
    cursor: pointer;
}

/* 标签样式 */
.tag {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 8px;
    opacity: 1;
    animation: tag-appear 0.3s ease-in, tag-disappear 0.5s ease-out 3s forwards;
}

.tag-primary {
    background-color: rgba(67, 97, 238, 0.1);
    color: var(--primary-color);
    border: 1px solid rgba(67, 97, 238, 0.2);
}

.tag-success {
    background-color: rgba(46, 204, 113, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(46, 204, 113, 0.2);
}

/* 标签动画效果 */
@keyframes tag-appear {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes tag-disappear {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.8);
        display: none;
    }
}

/* 标签消失后移除元素 */
.tag.fade-out {
    animation: tag-disappear 0.5s ease-out forwards;
}