:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --accent: #06b6d4;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1e293b;
    --light: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-600: #475569;
    --gray-700: #334155;
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #06b6d4 100%);
    --gradient-dark: linear-gradient(135deg, #1e293b 0%, #334155 50%, #475569 100%);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --radius-sm: 0.375rem;
    --radius: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
}

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    color: var(--gray-700);
    line-height: 1.6;
}

/* ===== 导航栏优化 ===== */
.navbar {
    background: var(--gradient-dark) !important;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-lg);
    padding: 0.75rem 0;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.35rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.navbar-nav .nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: var(--radius);
    transition: all 0.3s ease;
    position: relative;
}

.navbar-nav .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.navbar-nav .nav-link.active {
    background: rgba(99, 102, 241, 0.2);
    color: #fff !important;
}

.navbar-text {
    font-weight: 500;
}

/* ===== Hero Banner ===== */
.hero-banner {
    background: var(--gradient-primary);
    color: #fff;
    border-radius: var(--radius-lg);
    padding: 3rem 2.5rem;
    margin-bottom: 2.5rem;
    box-shadow: var(--shadow-xl);
    position: relative;
    overflow: hidden;
}

.hero-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 60%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    pointer-events: none;
}

.hero-banner h1 {
    font-weight: 700;
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
    position: relative;
}

.hero-banner p {
    font-size: 1.05rem;
    opacity: 0.9;
    max-width: 600px;
    position: relative;
}

/* ===== 卡片样式 ===== */
.card {
    border: none;
    border-radius: var(--radius-lg);
    background: #fff;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-body {
    padding: 1.5rem;
}

.card-title {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.75rem;
}

.card-text {
    color: var(--gray-600);
    line-height: 1.6;
}

/* ===== 按钮样式 ===== */
.btn {
    font-weight: 500;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius);
    transition: all 0.3s ease;
    border: none;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::after {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: var(--gradient-primary);
    box-shadow: 0 4px 14px 0 rgba(99, 102, 241, 0.39);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 4px 14px 0 rgba(16, 185, 129, 0.39);
}

.btn-success:hover {
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
    transform: translateY(-2px);
}

.btn-outline-primary {
    border: 2px solid var(--primary);
    color: var(--primary);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-2px);
}

.btn-sm {
    padding: 0.4rem 0.875rem;
    font-size: 0.875rem;
}

/* ===== 表单样式 ===== */
.form-control, .form-select {
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: #fff;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    outline: none;
}

.form-label {
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.form-control::placeholder {
    color: var(--gray-300);
}

/* ===== 分类框样式 ===== */
.category-box {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.category-box:hover {
    box-shadow: var(--shadow);
    border-color: var(--gray-300);
}

.category-box h5 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.category-box h5 .badge {
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.35em 0.65em;
}

/* ===== 提示词选项按钮 ===== */
.prompt-option {
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    color: var(--gray-700);
    padding: 0.5rem 1rem;
    margin: 0.25rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.prompt-option:hover {
    background: #fff;
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.prompt-option.active {
    background: var(--gradient-primary);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

/* ===== 结果面板 ===== */
.result-panel {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.result-panel .card-header {
    background: var(--gradient-dark);
    color: #fff;
    font-weight: 600;
    padding: 1rem 1.5rem;
    border: none;
}

.result-panel textarea {
    font-size: 0.9rem;
    line-height: 1.6;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    resize: vertical;
    font-family: 'SF Mono', Monaco, monospace;
}

.result-panel textarea:focus {
    background: #fff;
}

/* ===== 徽章样式 ===== */
.badge {
    font-weight: 500;
    padding: 0.5em 0.75em;
    border-radius: var(--radius-sm);
}

.badge.bg-primary {
    background: var(--gradient-primary) !important;
}

.badge.bg-secondary {
    background: var(--gray-200) !important;
    color: var(--gray-700);
}

/* ===== 列表组 ===== */
.list-group-item {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius) !important;
    margin-bottom: 0.75rem;
    padding: 1.25rem;
    transition: all 0.3s ease;
}

.list-group-item:hover {
    box-shadow: var(--shadow);
    border-color: var(--gray-300);
}

/* ===== 模板内容预览 ===== */
.tpl-content, pre.bg-light {
    background: var(--gray-100) !important;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1rem;
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--gray-700);
}

/* ===== 后台管理样式 ===== */
.sidebar {
    background: var(--gradient-dark);
    min-height: 100vh;
    box-shadow: var(--shadow-lg);
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.8) !important;
    padding: 0.875rem 1.25rem;
    margin: 0.25rem 0.75rem;
    border-radius: var(--radius);
    transition: all 0.3s ease;
    font-weight: 500;
}

.sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff !important;
    transform: translateX(4px);
}

.sidebar .nav-link.active {
    background: var(--gradient-primary);
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

/* ===== 统计卡片 ===== */
.card.border-primary, .card.border-success, .card.border-warning, 
.card.border-secondary, .card.border-info {
    border: none !important;
    position: relative;
    overflow: hidden;
}

.card.border-primary::before { background: var(--primary); }
.card.border-success::before { background: var(--success); }
.card.border-warning::before { background: var(--warning); }
.card.border-secondary::before { background: var(--gray-600); }
.card.border-info::before { background: var(--accent); }

.card.border-primary::before,
.card.border-success::before,
.card.border-warning::before,
.card.border-secondary::before,
.card.border-info::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.card h3 {
    font-weight: 700;
    font-size: 2rem;
    color: var(--dark);
    margin-top: 0.5rem;
}

.card h6 {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ===== 表格样式 ===== */
.table {
    background: #fff;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table thead th {
    background: var(--gray-100);
    font-weight: 600;
    color: var(--gray-700);
    border-bottom: 2px solid var(--gray-200);
    padding: 1rem;
}

.table tbody td {
    padding: 1rem;
    vertical-align: middle;
}

.table-actions .btn {
    margin: 0.125rem;
    padding: 0.375rem 0.75rem;
}

/* ===== 登录/注册卡片 ===== */
.login-card {
    max-width: 420px;
    margin: 2rem auto;
}

.login-card .card-header {
    background: var(--gradient-primary);
    color: #fff;
    text-align: center;
    padding: 1.5rem;
    border: none;
}

.login-card .card-header h4 {
    margin: 0;
    font-weight: 600;
}

/* ===== 页脚 ===== */
footer {
    background: #fff !important;
    border-top: 1px solid var(--gray-200) !important;
    margin-top: auto;
}

footer a {
    color: var(--primary) !important;
    text-decoration: none;
    font-weight: 500;
}

footer a:hover {
    text-decoration: underline;
}

/* ===== 动画效果 ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.container > .row > div {
    animation: fadeIn 0.5s ease forwards;
}

.container > .row > div:nth-child(1) { animation-delay: 0.1s; }
.container > .row > div:nth-child(2) { animation-delay: 0.2s; }
.container > .row > div:nth-child(3) { animation-delay: 0.3s; }

/* ===== 响应式优化 ===== */
@media (max-width: 991.98px) {
    .hero-banner {
        padding: 2rem 1.5rem;
    }
    
    .hero-banner h1 {
        font-size: 1.5rem;
    }
    
    .sticky-top {
        position: relative !important;
        top: 0 !important;
    }
    
    .result-panel {
        margin-top: 1.5rem;
    }
}

@media (max-width: 767.98px) {
    .category-box {
        padding: 1rem;
    }
    
    .prompt-option {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
    }
}

/* ===== 滚动条美化 ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ===== 提示框 ===== */
.alert {
    border: none;
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
}

/* ===== 分页 ===== */
.pagination .page-link {
    border: none;
    color: var(--gray-700);
    font-weight: 500;
    padding: 0.5rem 0.875rem;
    margin: 0 0.125rem;
    border-radius: var(--radius);
}

.pagination .page-link:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.pagination .page-item.active .page-link {
    background: var(--gradient-primary);
    color: #fff;
}
