/* api/web_admin/static/css/admin.css */
/* ===== 基础重置与布局 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f7fa;
    min-height: 100vh;
}

/* ===== 顶部导航栏 ===== */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 40px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 40px;
}

.header h1 {
    font-size: 24px;
    white-space: nowrap;
}

.header .nav {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.header .nav a, .header .nav .nav-tab {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    padding: 8px 16px;
    font-size: 14px;
    transition: all 0.3s;
    border-radius: 4px;
    cursor: pointer;
    display: inline-block;
}

.header .nav a:hover, .header .nav .nav-tab:hover {
    color: white;
    background: rgba(255,255,255,0.1);
}

.header .nav a.active, .header .nav .nav-tab.active {
    color: white;
    background: rgba(255,255,255,0.2);
    font-weight: 500;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 14px;
}

.user-info-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    padding: 6px 12px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    transition: all 0.3s;
    font-size: 14px;
}

.user-info-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.5);
    color: white;
}

.user-role {
    background: rgba(255,255,255,0.2);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
}

.logout-btn {
    color: white;
    text-decoration: none;
    padding: 6px 12px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    transition: all 0.3s;
}

.logout-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.5);
}

/* ===== 主容器 ===== */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* ===== 卡片组件 ===== */
.card {
    background: white;
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.card h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 18px;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

/* ===== 表单样式 ===== */
.form-group { margin-bottom: 20px; }

label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
    font-size: 14px;
}

input[type="text"],
input[type="password"],
input[type="url"],
input[type="number"],
input[type="email"],
input[type="date"],
input[type="datetime-local"],
input[type="time"],
textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: all 0.3s;
    font-family: inherit;
}

input:focus, textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    background: white;
}

.input-group { display: flex; gap: 10px; }

.input-group input { flex: 1; }

/* ===== 按钮样式 ===== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.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: #f0f0f0;
    color: #666;
}

.btn-secondary:hover { background: #e0e0e0; }

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

/* ===== 状态标签 ===== */
.status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 10px;
}

.status-success { background: #d4edda; color: #155724; }
.status-error { background: #f8d7da; color: #721c24; }

/* ===== 辅助文本 ===== */
.help-text { color: #666; font-size: 12px; margin-top: 5px; }

/* ===== Toast 提示 ===== */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 5px;
    color: white;
    font-weight: 500;
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.toast.success { background: #28a745; }
.toast.error { background: #dc3545; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ===== Tab 内容切换 ===== */
.tab-content { display: none; }

.tab-content.active { display: block; animation: fadeIn 0.3s ease; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== 元信息栏 ===== */
.config-meta {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 13px;
    color: #666;
}

/* ===== 业务数据专用组件 ===== */
.service-card {
    cursor: pointer;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid transparent;
    transition: all 0.3s;
}

.service-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.data-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e8e8e8;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    transition: all 0.2s;
}

.data-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border-color: #d0d0d0;
}

.item-actions {
    display: flex;
    gap: 8px;
}

.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    margin-left: 8px;
}

.tag-category {
    background: #e3f2fd;
    color: #1976d2;
}

.tag-priority {
    background: #fff3e0;
    color: #f57c00;
}

.empty-state {
    text-align: center;
    color: #999;
    padding: 40px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
}

/* ===== List page filter bars ===== */
.filter-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-bar input,
.filter-bar select {
    width: auto !important;
    min-width: 120px;
    max-width: 220px;
    flex: 0 1 auto;
}

.filter-bar input[type="text"] {
    min-width: 180px;
    max-width: 260px;
}

.filter-bar .btn {
    flex-shrink: 0;
}

/* ===== 表格样式 ===== */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    padding: 12px;
    text-align: left;
    border-bottom: 2px solid #dee2e6;
    background: #f8f9fa;
}

td {
    padding: 12px;
    border-bottom: 1px solid #dee2e6;
}

/* ===== 登录/注册页面特殊样式 ===== */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.auth-card {
    text-align: center;
    background: white;
    padding: 50px 40px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.1);
    max-width: 450px;
    animation: slideIn 0.5s ease-out;
}

.login-container, .register-container {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
    margin: auto;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.login-container h1, .register-container h1 {
    color: #333;
    margin-bottom: 10px;
    font-size: 24px;
}

.subtitle {
    color: #666;
    margin-bottom: 30px;
    font-size: 14px;
}

.error {
    color: #e74c3c;
    margin-top: 10px;
    font-size: 14px;
}

.register-link, .login-link {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: #666;
}

.register-link a, .login-link a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.register-link a:hover {
    text-decoration: underline;
}

/* ===== 图标动画 ===== */
.icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: scaleIn 0.5s ease-out 0.2s both;
}

.success-icon { color: #52c41a; }
.error-icon { color: #ff4d4f; }

@keyframes scaleIn {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

/* ===== 飞书授权结果页特殊样式 ===== */
.user-info {
    background: #f6ffed;
    border: 1px solid #b7eb8f;
    color: #666;
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
}

.error-msg {
    background: #fff2f0;
    border: 1px solid #ffccc7;
    color: #ff4d4f;
    padding: 15px;
    border-radius: 8px;
    word-break: break-all;
}

.countdown {
    margin-top: 15px;
    font-size: 13px;
    color: #999;
}

/* ===== 左侧侧边栏导航 ===== */
.page-layout {
    display: flex;
    min-height: calc(100vh - 60px);
}

.sidebar {
    width: 200px;
    background: white;
    border-right: 1px solid #e8e8e8;
    padding: 20px 0;
    flex-shrink: 0;
    box-shadow: 2px 0 8px rgba(0,0,0,0.03);
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-title {
    padding: 0 20px 15px;
    font-size: 12px;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav a {
    display: block;
    padding: 12px 20px;
    color: #555;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    background: #f5f7fa;
    color: #667eea;
    border-left-color: #d0d8eb;
}

.sidebar-nav a.active {
    background: linear-gradient(90deg, #f0f4ff 0%, #fff 100%);
    color: #667eea;
    font-weight: 500;
    border-left-color: #667eea;
}

.main-content {
    flex: 1;
    padding: 30px 40px;
    overflow-y: auto;
    background: #f5f7fa;
}

.main-content .container {
    max-width: 1200px;
    margin: 0;
    padding: 0;
}

/* ===== 二级导航条（兼容旧版，现已改为侧边栏） ===== */
.sub-nav-bar {
    display: none;
}

/* ===== 响应式布局 ===== */
@media (max-width: 768px) {
    .header {
        padding: 15px 20px;
        flex-direction: column;
        gap: 10px;
    }

    .header-left {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }

    .header .nav {
        width: 100%;
        justify-content: center;
    }

    .service-card {
        margin-bottom: 10px;
    }

    .data-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .item-actions {
        width: 100%;
        justify-content: flex-end;
    }
}