/**
 * 网址导航 - 后台管理样式
 */

/* 基础重置 */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --bg-color: #f1f5f9;
    --card-bg: #ffffff;
    --sidebar-bg: #1e293b;
    --sidebar-text: #94a3b8;
    --sidebar-active: #4f46e5;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.1);
    --radius: 10px;
    --radius-sm: 6px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

/* 登录页面 */
.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-box {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 28px;
    color: var(--text-color);
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-muted);
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

.login-form input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 16px;
    transition: border-color 0.2s;
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.login-footer {
    margin-top: 25px;
    text-align: center;
}

.login-footer a {
    color: var(--text-muted);
}

/* 警告框 */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
}

.alert-error {
    background: #fef2f2;
    color: var(--danger-color);
    border: 1px solid #fecaca;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    background: var(--border-color);
    color: var(--text-color);
}

.btn:hover {
    opacity: 0.9;
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-hover);
    color: #fff;
}

.btn-info {
    background: var(--info-color);
    color: #fff;
}

.btn-danger {
    background: var(--danger-color);
    color: #fff;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-block {
    display: block;
    width: 100%;
}

/* 后台布局 */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: 250px;
    background: var(--sidebar-bg);
    min-height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 {
    color: #fff;
    font-size: 20px;
    font-weight: 600;
}

.sidebar-header .logo-image {
    text-align: center;
}

.sidebar-header .logo-image img {
    max-width: 100%;
    max-height: 50px;
    object-fit: contain;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 5px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: var(--sidebar-text);
    transition: all 0.2s;
    border-left: 3px solid transparent;
    font-size: 15px;
}

.sidebar-nav a i {
    font-size: 18px;
}

.sidebar-nav a:hover,
.sidebar-nav li.active a {
    background: rgba(255,255,255,0.05);
    color: #fff;
    border-left-color: var(--primary-color);
}

.sidebar-nav .icon {
    font-size: 18px;
    width: 18px;
    text-align: center;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-footer a {
    color: var(--sidebar-text);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.sidebar-footer a:hover {
    color: #fff;
}

/* 主内容区 */
.main-content {
    flex: 1;
    margin-left: 250px;
    min-height: 100vh;
}

.content-header {
    background: var(--card-bg);
    padding: 20px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.content-header h1 {
    font-size: 22px;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-right span {
    color: var(--text-muted);
}

.content-body {
    padding: 30px;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
}

.stat-icon.blue { background: #eff6ff; }
.stat-icon.green { background: #ecfdf5; }
.stat-icon.orange { background: #fff7ed; }
.stat-icon.purple { background: #faf5ff; }

.stat-info h3 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-color);
}

.stat-info p {
    color: var(--text-muted);
    font-size: 14px;
}

/* 卡片 */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.card-body {
    padding: 25px;
}

.mb-3 {
    margin-bottom: 20px;
}

/* 表格 */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 14px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 13px;
    text-transform: uppercase;
}

.table tbody tr:hover {
    background: #f8fafc;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

/* 徽章 */
.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 20px;
}

.badge-success {
    background: #ecfdf5;
    color: var(--success-color);
}

.badge-secondary {
    background: #f1f5f9;
    color: var(--text-muted);
}

/* 表单 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

textarea.form-control {
    resize: vertical;
}

select.form-control {
    cursor: pointer;
}

.required {
    color: var(--danger-color);
}

.form-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
}

.form-inline label {
    margin: 0;
}

.form-inline .form-control {
    width: auto;
    min-width: 150px;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 0;
}

.form-row .form-group {
    flex: 1;
}

.col-6 {
    flex: 0 0 calc(50% - 10px);
}

small.text-muted {
    display: block;
    margin-top: 5px;
    font-size: 12px;
}

/* 模态框 */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-dialog {
    background: var(--card-bg);
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: auto;
    transform: translateY(-20px);
    transition: transform 0.2s;
    margin: 20px;
}

.modal.show .modal-dialog {
    transform: translateY(0);
}

.modal-lg {
    max-width: 700px;
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-color);
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* 站点图标 */
.site-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: contain;
}

.icon-placeholder {
    font-size: 20px;
    color: var(--primary-color);
}

.url-cell {
    max-width: 200px;
}

.url-cell a {
    color: var(--text-muted);
    word-break: break-all;
}

.url-cell a:hover {
    color: var(--primary-color);
}

.remark-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    color: var(--text-muted);
}

/* Logo设置样式 */
.logo-preview-section {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--bg-color);
    border-radius: var(--radius);
}

.logo-preview {
    width: 200px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: var(--radius);
    border: 2px dashed var(--border-color);
}

.logo-preview img {
    max-width: 100%;
    max-height: 100px;
    object-fit: contain;
}

.logo-placeholder {
    text-align: center;
    color: var(--text-muted);
}

.logo-placeholder i {
    font-size: 40px;
    display: block;
    margin-bottom: 10px;
    opacity: 0.5;
}

.logo-info {
    flex: 1;
}

.logo-info h3 {
    font-size: 16px;
    margin-bottom: 10px;
}

.logo-upload-form {
    max-width: 600px;
}

.file-input-wrapper {
    position: relative;
}

.file-input {
    position: absolute;
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
}

.file-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-color);
    cursor: pointer;
    transition: all 0.3s;
}

.file-label:hover {
    border-color: var(--primary-color);
    background: #f8f9ff;
}

.file-label i {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.file-label span {
    color: var(--text-muted);
    font-size: 14px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-item label {
    font-weight: 500;
    color: var(--text-muted);
    min-width: 80px;
}

.info-item span {
    color: var(--text-color);
}

/* 筛选表单 */
.filter-form .form-inline {
    flex-wrap: wrap;
}

/* 响应式 */
@media (max-width: 1024px) {
    .sidebar {
        width: 200px;
    }
    
    .main-content {
        margin-left: 200px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        transform: translateX(-100%);
        z-index: 1000;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .col-6 {
        flex: 0 0 100%;
    }
    
    .table {
        display: block;
        overflow-x: auto;
    }
}
