/* 
 * 提示词管理平台 - 主样式文件
 * 包含全局样式、布局样式和基础组件样式
 */

/* ===== 错误提示样式 ===== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.error-toast {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    animation: slideIn 0.3s ease-out;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #721c24;
    margin-left: auto;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ===== 全局样式 ===== */
:root {
    /* 保留非主题相关的全局变量 */
    --border-radius: 0.5rem;
    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --box-shadow-lg: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);

    --font-family-sans-serif: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    --font-family-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

    /* 注意：颜色相关变量已移至主题文件中 (themes/light.css 和 themes/dark.css) */
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family-sans-serif);
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== 现代化字体层级系统 ===== */
h1, .h1 { 
    font-size: 2.5rem; 
    line-height: 1.2; 
    font-weight: 600; 
    margin-bottom: 1.5rem;
    color: var(--text-primary, #262626);
}

h2, .h2 { 
    font-size: 2rem; 
    line-height: 1.3; 
    font-weight: 600; 
    margin-bottom: 1.25rem;
    color: var(--text-primary, #262626);
}

h3, .h3 { 
    font-size: 1.5rem; 
    line-height: 1.4; 
    font-weight: 600; 
    margin-bottom: 1rem;
    color: var(--text-primary, #262626);
}

h4, .h4 { 
    font-size: 1.25rem; 
    line-height: 1.4; 
    font-weight: 500; 
    margin-bottom: 0.875rem;
    color: var(--text-primary, #262626);
}

h5, .h5 { 
    font-size: 1.125rem; 
    line-height: 1.4; 
    font-weight: 500; 
    margin-bottom: 0.75rem;
    color: var(--text-primary, #262626);
}

h6, .h6 { 
    font-size: 1rem; 
    line-height: 1.4; 
    font-weight: 500; 
    margin-bottom: 0.75rem;
    color: var(--text-primary, #262626);
}

/* 正文和辅助文字 */
p, .text-body { 
    font-size: 1rem; 
    line-height: 1.6; 
    margin-bottom: 1rem;
    color: var(--text-primary, #262626);
}

.text-sm, small { 
    font-size: 0.875rem; 
    line-height: 1.5; 
    color: var(--text-secondary, #8c8c8c);
}

.text-lg { 
    font-size: 1.125rem; 
    line-height: 1.6; 
}

.text-xl { 
    font-size: 1.25rem; 
    line-height: 1.5; 
}

/* 字重变化 */
.font-light { font-weight: 300; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* 响应式字体大小 */
@media (max-width: 768px) {
    h1, .h1 { font-size: 2rem; }
    h2, .h2 { font-size: 1.75rem; }
    h3, .h3 { font-size: 1.375rem; }
    h4, .h4 { font-size: 1.125rem; }
    h5, .h5 { font-size: 1rem; }
    h6, .h6 { font-size: 0.875rem; }
}

@media (max-width: 480px) {
    h1, .h1 { font-size: 1.75rem; }
    h2, .h2 { font-size: 1.5rem; }
    h3, .h3 { font-size: 1.25rem; }
    h4, .h4 { font-size: 1.125rem; }
    h5, .h5 { font-size: 1rem; }
    h6, .h6 { font-size: 0.875rem; }
}

/* ===== 可访问性 ===== */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color, #1890ff);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 0 0 4px 4px;
    z-index: 1000;
}

.skip-link:focus {
    top: 0;
}

/* ===== 布局样式 ===== */
.main-content {
    flex: 1;
    padding-top: 2rem;
}

.container-fluid {
    max-width: 1000px;
}

/* 导航栏内容对齐 - 完全左右对齐 */
.navbar .container {
    padding-left: 0; /* 完全左对齐 */
    padding-right: 0; /* 完全右对齐 */
    max-width: 100%; /* 占满整个宽度 */
    display: flex;
    justify-content: space-between; /* 左右对齐 */
    align-items: center;
    width: 100%;
}

/* 导航栏左侧Logo区域 */
.navbar .container > :first-child {
    margin-left: 1rem; /* Logo左侧保持适当间距 */
}

/* 导航栏右侧按钮区域 */
.navbar .container > :last-child {
    margin-right: 1rem; /* 右侧按钮保持适当间距 */
}

@media (max-width: 768px) {
    .navbar .container > :first-child {
        margin-left: 0.5rem;
    }

    .navbar .container > :last-child {
        margin-right: 0.5rem;
    }
}

/* ===== 导航栏样式 ===== */
.navbar {
    backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.95) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    z-index: 9998; /* 确保导航栏在高层级，但低于搜索建议 */
    position: relative;
}

.navbar-brand {
    font-weight: 700;
    color: var(--primary-color, #1890ff) !important;
}

.navbar-brand:hover {
    color: var(--primary-hover, #40a9ff) !important;
}

.nav-link {
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-link:hover {
    color: var(--primary-color, #1890ff) !important;
    transform: translateY(-1px);
}

.nav-link.active {
    color: var(--primary-color, #1890ff) !important;
    font-weight: 600;
}

/* 导航栏右侧区域 */
.navbar-collapse {
    flex-grow: 0; /* 防止搜索框和按钮区域过度扩展 */
}

.navbar-nav.me-auto {
    flex-grow: 1; /* 让中间区域占据剩余空间 */
}

/* 导航栏操作按钮样式 */
.nav-action-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    margin: 0 0.25rem;
    text-decoration: none;
    color: var(--text-color, #333);
    background-color: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.nav-action-btn:hover {
    color: var(--primary-color, #1890ff);
    background-color: var(--surface-color, rgba(24, 144, 255, 0.1));
    text-decoration: none;
    transform: translateY(-1px);
}

.nav-action-btn i {
    margin-right: 0.5rem;
    font-size: 0.9rem;
}

/* 搜索框容器 */
.d-flex.me-3 {
    margin-right: 1rem !important;
}

/* 右侧按钮组间距 */
.navbar-nav.align-items-center {
    gap: 0.5rem;
}

.navbar-nav.align-items-center .nav-item {
    margin: 0;
}

/* ===== 按钮样式 ===== */
.btn {
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
}

/* Tech按钮样式系统 - 现代化设计 */
.tech-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    border-radius: 0.75rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    position: relative;
    overflow: hidden;
    gap: 0.5rem;
}

.tech-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.tech-btn-primary {
    background: var(--primary-gradient, linear-gradient(135deg, #3B82F6 0%, #6366F1 100%));
    color: white;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.25);
}

.tech-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #2563EB 0%, #5B5BD6 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.35);
    color: white;
    text-decoration: none;
}

.tech-btn-secondary {
    background: var(--surface-color, #fafafa);
    color: var(--text-primary, #262626);
    border: 1px solid var(--border-color, #f0f0f0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.tech-btn-secondary:hover:not(:disabled) {
    background: var(--primary-color, #3B82F6);
    color: white;
    border-color: var(--primary-color, #3B82F6);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.25);
    text-decoration: none;
}

.tech-btn i {
    font-size: 1rem;
}

/* Tech按钮动画效果 */
.tech-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s;
}

.tech-btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--box-shadow-lg);
}

.btn-primary {
    background: var(--gradient-primary);
    border: none;
}

.btn-primary:hover {
    background: var(--gradient-primary-modern);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--gradient-shadow);
}

.btn-success {
    background: var(--gradient-success);
}

.btn-info {
    background: var(--gradient-info);
}

.btn-warning {
    background: var(--gradient-warning);
}

.btn-danger {
    background: var(--gradient-danger);
}

/* ===== 卡片样式 ===== */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: all 0.3s ease;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--box-shadow-lg);
}

.card-header {
    background: var(--gradient-primary);
    color: white;
    border: none;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

/* ===== 表单样式 ===== */
/* 表单控件统一样式 - 覆盖Bootstrap默认样式 */
.form-control {
    border: 1px solid var(--border-color, #f0f0f0);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--surface-color, #ffffff);
    color: var(--text-primary, #262626);
    width: 100%;
    line-height: 1.5;
}

.form-control:focus {
    border-color: var(--primary-color, #3B82F6);
    box-shadow: 0 0 0 0.125rem rgba(59, 130, 246, 0.25);
    background: var(--surface-color, #ffffff);
    color: var(--text-primary, #262626);
    outline: none;
}

.form-control::placeholder {
    color: var(--text-secondary, #8c8c8c);
    opacity: 1;
}

/* 表单状态样式 */
.form-control.is-valid {
    border-color: var(--success-color, #10B981);
}

.form-control.is-invalid {
    border-color: var(--error-color, #EF4444);
}

.form-select {
    border: 1px solid var(--border-color, #f0f0f0);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    background: var(--surface-color, #ffffff);
    color: var(--text-primary, #262626);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-select:focus {
    border-color: var(--primary-color, #3B82F6);
    box-shadow: 0 0 0 0.125rem rgba(59, 130, 246, 0.25);
    outline: none;
}

/* ===== 提示框样式 ===== */
.alert {
    border: none;
    border-radius: var(--border-radius);
    border-left: 4px solid;
}

.alert-success {
    background-color: var(--success-bg, #f6ffed);
    border-left-color: var(--success-color, #52c41a);
    color: var(--text-primary, #262626);
}

.alert-info {
    background-color: var(--surface-color, #f0f9ff);
    border-left-color: var(--info-color, #1890ff);
    color: var(--text-primary, #262626);
}

.alert-warning {
    background-color: var(--warning-bg, #fffbe6);
    border-left-color: var(--warning-color, #faad14);
    color: var(--text-primary, #262626);
}

.alert-danger {
    background-color: #f8d7da;
    border-left-color: var(--danger-color);
    color: #721c24;
}

/* ===== 加载动画 ===== */
.loading-overlay {
    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: 9999;
}

.loading-spinner {
    text-align: center;
    color: white;
}

.loading-text {
    font-size: 1.1rem;
    font-weight: 500;
}

/* ===== 返回顶部按钮 ===== */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--gradient-primary);
    border: none;
    color: white;
    font-size: 1.2rem;
    box-shadow: var(--box-shadow-lg);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.2);
}

/* ===== 工具提示样式 ===== */
.tooltip {
    font-size: 0.875rem;
}

.tooltip-inner {
    background-color: var(--dark-color);
    border-radius: var(--border-radius);
}

/* ===== 模态框样式 ===== */
.modal-content {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-lg);
}

.modal-header {
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.modal-header .btn-close {
    filter: invert(1);
}

/* ===== 徽章样式 ===== */
.badge {
    border-radius: var(--border-radius);
    font-weight: 500;
}

/* ===== 进度条样式 ===== */
.progress {
    border-radius: var(--border-radius);
    background-color: #e9ecef;
}

.progress-bar {
    background: var(--gradient-primary);
}

/* ===== 列表组样式 ===== */
.list-group-item {
    border: none;
    border-bottom: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.list-group-item:hover {
    background-color: #f8f9fa;
    transform: translateX(5px);
}

.list-group-item:last-child {
    border-bottom: none;
}

/* ===== 响应式图片 ===== */
.img-responsive {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
}

/* ===== 文本样式 ===== */
.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-shadow {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ===== 动画效果 ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in-left {
    animation: slideInLeft 0.6s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in-right {
    animation: slideInRight 0.6s ease-out;
}

/* ===== 实用工具类 ===== */
.cursor-pointer {
    cursor: pointer;
}

.user-select-none {
    user-select: none;
}

.overflow-hidden {
    overflow: hidden;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.text-truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== 打印样式 ===== */
@media print {
    .navbar,
    .footer,
    .back-to-top,
    .btn,
    .modal {
        display: none !important;
    }

    .main-content {
        padding-top: 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ===== 移动端优化 ===== */
@media (max-width: 768px) {
    .main-content {
        padding-top: 1rem;
    }

    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    .back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 45px;
        height: 45px;
    }
}

/* ===== 搜索建议样式 ===== */
.search-autocomplete-wrapper {
    position: relative;
    width: 300px;
    z-index: 9999; /* 确保整个搜索容器在最上层 */
}

.navbar-search-input {
    width: 100%;
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--background-color, #ffffff);
    border: 1px solid var(--border-color, #e1e8ed);
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 9999; /* 提高z-index确保搜索建议始终在最上层 */
    max-height: 300px;
    overflow-y: auto;
}

.search-suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color, #f0f0f0);
    transition: background-color 0.2s ease;
}

.search-suggestion-item:hover,
.search-suggestion-item.active {
    background-color: var(--hover-bg, #f5f5f5);
}

.search-suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-title {
    font-weight: 500;
    color: var(--text-primary, #262626);
    margin-bottom: 4px;
}

.suggestion-category {
    font-size: 12px;
    color: var(--text-secondary, #8c8c8c);
}

.suggestion-highlight {
    background-color: var(--primary-color, #1890ff);
    color: #ffffff;
    padding: 1px 3px;
    border-radius: 2px;
}

@media (max-width: 768px) {
    .search-autocomplete-wrapper {
        width: 250px;
    }

    /* 移动端导航栏优化 */
    .navbar .container {
        flex-direction: column;
        align-items: stretch;
    }

    .navbar-collapse {
        margin-top: 1rem;
    }

    .d-flex.me-3 {
        margin-bottom: 1rem;
        margin-right: 0 !important;
    }

    .search-autocomplete-wrapper {
        width: 100%;
    }

    .navbar-nav.align-items-center {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch !important;
    }

    .nav-action-btn {
        justify-content: center;
        margin: 0;
        padding: 0.75rem 1rem;
    }
}
