/* ===== 论文助手 — 现代简约学术风 ===== */

:root {
    --primary: #4361ee;
    --primary-light: #3a86ff;
    --primary-subtle: #eef1ff;
    --primary-glow: rgba(67, 97, 238, 0.15);
    --accent: #7209b7;
    --success: #10b981;
    --success-subtle: #ecfdf5;
    --warning: #f59e0b;
    --warning-subtle: #fffbeb;
    --danger: #ef4444;
    --danger-subtle: #fef2f2;
    --info: #06b6d4;
    --info-subtle: #ecfeff;
    --bg: #f5f7fb;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.06);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.08), 0 8px 24px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.08), 0 16px 40px rgba(0,0,0,0.06);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --gradient: linear-gradient(135deg, var(--primary), var(--primary-light));
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* --- Navbar --- */
.navbar {
    background: var(--gradient) !important;
    box-shadow: 0 2px 16px rgba(67, 97, 238, 0.2);
    padding: 0.6rem 0;
    border: none;
}
.navbar-brand { font-weight: 700; font-size: 1.15rem; letter-spacing: -0.02em; }
.navbar .nav-link {
    font-size: 0.9rem; font-weight: 500;
    padding: 0.5rem 0.9rem !important;
    border-radius: var(--radius-sm);
    transition: background var(--transition), opacity var(--transition);
}
.navbar .nav-link:hover { background: rgba(255,255,255,0.15); }
.navbar .nav-link.active-page { background: rgba(255,255,255,0.2); font-weight: 600; }
.navbar .user-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: rgba(255,255,255,0.25);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0.75rem; color: white; font-weight: 600; margin-right: 6px;
}

/* --- Cards --- */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow);
    transition: transform var(--transition), box-shadow var(--transition);
    overflow: hidden;
}
.card-header { border-bottom: 1px solid var(--border); }
.hover-card { cursor: pointer; }
.hover-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }

/* --- Icon Box --- */
.icon-box {
    width: 56px; height: 56px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius);
    transition: transform var(--transition);
}
.hover-card:hover .icon-box { transform: scale(1.08); }

/* --- Buttons --- */
.btn-primary {
    background: var(--gradient); border: none;
    border-radius: var(--radius-sm); font-weight: 600;
    padding: 0.5rem 1.25rem;
    transition: all var(--transition);
    box-shadow: 0 2px 8px rgba(67, 97, 238, 0.25);
}
.btn-primary:hover, .btn-primary:focus {
    background: linear-gradient(135deg, #3651d4, #2d75f0);
    box-shadow: 0 4px 16px rgba(67, 97, 238, 0.35);
    transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }
.btn-outline-primary {
    color: var(--primary); border-color: var(--primary);
    border-radius: var(--radius-sm); font-weight: 500;
}
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); }
.btn-outline-secondary {
    border-radius: var(--radius-sm); font-weight: 500;
    color: var(--text-secondary); border-color: var(--border);
}
.btn-outline-secondary:hover { background: var(--bg); border-color: var(--text-secondary); color: var(--text); }
.btn-success {
    background: var(--success); border: none;
    border-radius: var(--radius-sm); font-weight: 600;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}
.btn-outline-success { color: var(--success); border-color: var(--success); border-radius: var(--radius-sm); }

/* --- Form Controls --- */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    padding: 0.6rem 0.9rem; font-size: 0.9rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}
textarea.form-control { line-height: 1.7; }
textarea.form-control:focus { box-shadow: 0 0 0 3px var(--primary-glow); border-color: var(--primary); }

/* --- Progress Bar --- */
.progress { border-radius: 20px; background: #e9ecef; overflow: hidden; }
.progress-bar { background: var(--gradient); border-radius: 20px; }

/* --- Badges --- */
.badge { font-weight: 500; border-radius: var(--radius-xs); padding: 0.35em 0.65em; }

/* --- Welcome Banner --- */
.welcome-banner {
    background: var(--gradient);
    border-radius: var(--radius);
    padding: 2rem 2.5rem; color: white;
    position: relative; overflow: hidden;
}
.welcome-banner::before {
    content: ''; position: absolute; top: -50%; right: -20%;
    width: 300px; height: 300px;
    background: rgba(255,255,255,0.08); border-radius: 50%;
}
.welcome-banner::after {
    content: ''; position: absolute; bottom: -30%; right: 10%;
    width: 200px; height: 200px;
    background: rgba(255,255,255,0.05); border-radius: 50%;
}
.welcome-banner h4 { font-weight: 700; margin-bottom: 0.5rem; position: relative; z-index: 1; }
.welcome-banner p { opacity: 0.85; margin-bottom: 0; font-size: 0.95rem; position: relative; z-index: 1; }

/* --- Ring Progress --- */
.ring-progress { position: relative; width: 120px; height: 120px; }
.ring-progress svg { transform: rotate(-90deg); }
.ring-progress .ring-bg { fill: none; stroke: #e9ecef; stroke-width: 8; }
.ring-progress .ring-fill { fill: none; stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 0.8s ease; }
.ring-progress .ring-label { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; }
.ring-progress .ring-value { font-size: 1.5rem; font-weight: 700; line-height: 1; }
.ring-progress .ring-text { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }

/* --- Mode Card --- */
.mode-card {
    border: 2px solid var(--border); border-radius: var(--radius);
    padding: 1rem 1.25rem; cursor: pointer;
    transition: all var(--transition); background: white;
}
.mode-card:hover { border-color: var(--primary-light); background: var(--primary-subtle); }
.mode-card.selected { border-color: var(--primary); background: var(--primary-subtle); box-shadow: 0 0 0 3px var(--primary-glow); }
.mode-card .mode-check {
    width: 22px; height: 22px; border-radius: 50%;
    border: 2px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition); flex-shrink: 0;
}
.mode-card.selected .mode-check { background: var(--primary); border-color: var(--primary); color: white; }

/* --- Step Indicator --- */
.step-indicator { display: flex; align-items: center; gap: 0; margin-bottom: 2rem; }
.step-dot {
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; font-weight: 700;
    background: #e9ecef; color: var(--text-muted);
    transition: all var(--transition); flex-shrink: 0;
    position: relative; z-index: 1;
}
.step-dot.active { background: var(--primary); color: white; box-shadow: 0 0 0 4px var(--primary-glow); }
.step-dot.done { background: var(--success); color: white; }
.step-line { flex: 1; height: 3px; background: #e9ecef; transition: background var(--transition); }
.step-line.done { background: var(--success); }
.step-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 6px; text-align: center; white-space: nowrap; }
.step-label.active { color: var(--primary); font-weight: 600; }
.step-label.done { color: var(--success); }

/* --- Outline Chapter --- */
.outline-chapter {
    border: 1.5px solid var(--border); border-radius: var(--radius);
    padding: 1rem 1.25rem; margin-bottom: 0.75rem;
    background: white; transition: all var(--transition);
}
.outline-chapter:hover { border-color: var(--primary); box-shadow: 0 2px 8px var(--primary-glow); }
.outline-sub {
    display: inline-flex; align-items: center;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius-xs); padding: 3px 10px;
    margin: 3px 4px 3px 0; font-size: 0.85rem;
    transition: all var(--transition);
}
.outline-sub:hover { background: var(--primary-subtle); border-color: var(--primary); }
.outline-sub .btn-close { font-size: 0.55rem; margin-left: 6px; opacity: 0.5; }
.outline-sub:hover .btn-close { opacity: 1; }

/* --- Content Display --- */
.content-display {
    white-space: pre-wrap; font-size: 0.9rem; line-height: 1.8;
    padding: 1.25rem; background: var(--bg);
    border-radius: var(--radius); border: 1px solid var(--border); overflow-y: auto;
}

/* --- Typing Cursor --- */
.typing-cursor::after { content: '|'; animation: blink 0.8s infinite; color: var(--primary); font-weight: 300; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* --- Login Page --- */
.login-wrapper { min-height: 100vh; display: flex; }
.login-brand {
    background: var(--gradient); color: white;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    padding: 3rem; position: relative; overflow: hidden;
}
.login-brand::before {
    content: ''; position: absolute; top: -100px; right: -100px;
    width: 400px; height: 400px; background: rgba(255,255,255,0.06); border-radius: 50%;
}
.login-brand::after {
    content: ''; position: absolute; bottom: -80px; left: -80px;
    width: 300px; height: 300px; background: rgba(255,255,255,0.04); border-radius: 50%;
}
.login-brand .brand-icon { font-size: 4rem; margin-bottom: 1.5rem; position: relative; z-index: 1; }
.login-brand h2 { font-weight: 800; font-size: 2rem; margin-bottom: 0.75rem; position: relative; z-index: 1; }
.login-brand p { opacity: 0.8; font-size: 1.05rem; position: relative; z-index: 1; }
.login-brand .feature-list { list-style: none; padding: 0; margin-top: 2rem; position: relative; z-index: 1; }
.login-brand .feature-list li { padding: 0.4rem 0; font-size: 0.95rem; opacity: 0.85; }
.login-brand .feature-list li i { margin-right: 8px; opacity: 0.7; }
.login-form-side { display: flex; align-items: center; justify-content: center; padding: 2rem; background: var(--bg); }
.login-card {
    width: 100%; max-width: 420px; background: white;
    border-radius: 16px; box-shadow: var(--shadow-lg); padding: 2.5rem;
}
.login-card .nav-tabs { border: none; gap: 0.5rem; margin-bottom: 1.5rem; }
.login-card .nav-tabs .nav-link {
    border: none; border-radius: var(--radius-sm);
    padding: 0.5rem 1.25rem; font-weight: 600;
    color: var(--text-secondary); background: var(--bg);
    transition: all var(--transition);
}
.login-card .nav-tabs .nav-link.active { background: var(--primary); color: white; }
.login-card .input-icon-group { position: relative; }
.login-card .input-icon-group i {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); font-size: 0.9rem;
}
.login-card .input-icon-group .form-control { padding-left: 2.5rem; }

/* --- Page Fade In --- */
.container { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* --- History Timeline --- */
.history-item { display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.6rem 0; border-bottom: 1px solid var(--border); }
.history-item:last-child { border-bottom: none; }
.history-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }

/* --- AIGC Detail Tag --- */
.aigc-tag {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 0.4rem 0.75rem; border-radius: var(--radius-sm);
    font-size: 0.8rem; font-weight: 500;
    background: var(--bg); border: 1px solid var(--border); margin: 3px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .login-wrapper { flex-direction: column; }
    .login-brand { padding: 2rem 1.5rem; min-height: auto; }
    .login-brand h2 { font-size: 1.5rem; }
    .login-brand .feature-list { display: none; }
    .login-card { padding: 1.5rem; }
    .welcome-banner { padding: 1.5rem; }
    .ring-progress { width: 100px; height: 100px; }
    .step-label { font-size: 0.65rem; }
}

/* Dropdown menu styles */
.navbar .dropdown-menu {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    padding: 0.5rem;
    min-width: 200px;
}
.navbar .dropdown-item {
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--text);
    transition: background 0.15s;
}
.navbar .dropdown-item:hover {
    background: var(--bg-secondary);
    color: var(--primary);
}
.navbar .dropdown-item i {
    color: var(--text-muted);
}
.navbar .dropdown-item:hover i {
    color: var(--primary);
}
.navbar .dropdown-toggle::after {
    margin-left: 0.35rem;
    vertical-align: 0.15em;
}
