/* ========================================
   小新拾光 - 全局样式
   ======================================== */

/* CSS Variables */
:root {
  --bg-primary: #0d0d0d;
  --bg-secondary: #1a1a1a;
  --bg-tertiary: #242424;
  --bg-card: #1e1e1e;
  --bg-input: #2a2a2a;
  
  --text-primary: #ffffff;
  --text-secondary: #a0a0a0;
  --text-muted: #666666;
  
  --accent-primary: #ff6b35;
  --accent-secondary: #ff8c5a;
  --accent-gradient: linear-gradient(135deg, #ff6b35 0%, #ff8c5a 100%);
  
  --border-color: #333333;
  --border-light: #444444;
  
  --sidebar-width: 200px;
  --header-height: 60px;
  --history-width: 320px;
  
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
}

input, textarea {
  font-family: inherit;
  border: none;
  outline: none;
}

ul, ol {
  list-style: none;
}

/* ========================================
   Layout Structure
   ======================================== */

.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
}

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

.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--accent-gradient);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 16px;
  color: white;
}

.logo-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  margin-bottom: 4px;
}

.nav-item:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.nav-item.active {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border-color);
}

.sidebar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.sidebar-btn.primary {
  background: var(--accent-gradient);
  color: white;
}

.sidebar-btn.primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.sidebar-btn.secondary {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.sidebar-btn.secondary:hover {
  background-color: var(--bg-input);
}

/* Main Content Area */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header */
.header {
  height: var(--header-height);
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-icon {
  width: 36px;
  height: 36px;
  background: var(--accent-gradient);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-icon svg {
  width: 20px;
  height: 20px;
  color: white;
}

.header-title {
  font-size: 16px;
  font-weight: 600;
}

.header-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-btn {
  width: 36px;
  height: 36px;
  background-color: transparent;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.header-btn:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.credits-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background-color: var(--bg-tertiary);
  border-radius: 20px;
  font-size: 13px;
}

.credits-badge .dot {
  width: 8px;
  height: 8px;
  background-color: #4ade80;
  border-radius: 50%;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

/* Content Area */
.content-area {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.content-main {
  flex: 1;
  padding: 24px;
  padding-bottom: 80px;
  overflow-y: auto;
}

/* History Panel */
.history-panel {
  width: var(--history-width);
  background-color: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.history-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.history-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
}

.history-count {
  color: var(--text-muted);
  font-size: 13px;
}

.history-tabs {
  display: flex;
  padding: 12px 16px;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
}

.history-tab {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-secondary);
  background-color: transparent;
  transition: all var(--transition-fast);
}

.history-tab:hover {
  background-color: var(--bg-tertiary);
}

.history-tab.active {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.history-content {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}

.history-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  text-align: center;
}

.history-empty svg {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.history-empty p {
  font-size: 13px;
}

/* ========================================
   Components
   ======================================== */

/* Warning Banner */
.warning-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background-color: rgba(255, 107, 53, 0.1);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  font-size: 13px;
}

.warning-banner svg {
  width: 18px;
  height: 18px;
  color: var(--accent-primary);
}

.warning-banner .highlight {
  color: var(--accent-primary);
  font-weight: 600;
}

.warning-banner .danger {
  color: #ef4444;
  font-weight: 600;
}

/* Input Card */
.input-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.input-area {
  padding: 20px;
  min-height: 150px;
}

.input-placeholder {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: var(--text-muted);
}

.input-placeholder svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}

.input-textarea {
  width: 100%;
  min-height: 120px;
  background-color: transparent;
  color: var(--text-primary);
  font-size: 14px;
  resize: none;
}

.input-textarea::placeholder {
  color: var(--text-muted);
}

.clear-btn {
  position: absolute;
  right: 16px;
  top: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background-color: transparent;
  color: var(--text-muted);
  font-size: 13px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.clear-btn:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.input-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-tertiary);
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background-color: var(--bg-input);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.toolbar-btn:hover {
  background-color: var(--bg-card);
  color: var(--text-primary);
}

.toolbar-select {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background-color: var(--bg-input);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.toolbar-select:hover {
  background-color: var(--bg-card);
}

.toolbar-select svg {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cost-info {
  font-size: 13px;
  color: var(--text-muted);
}

.cost-info span {
  color: var(--text-primary);
  font-weight: 500;
}

.type-toggle {
  display: flex;
  background-color: var(--bg-input);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.type-btn {
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  background-color: transparent;
  transition: all var(--transition-fast);
}

.type-btn:hover {
  color: var(--text-primary);
}

.type-btn.active {
  background-color: var(--accent-primary);
  color: white;
}

.generate-btn {
  padding: 8px 24px;
  background: var(--accent-gradient);
  color: white;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.generate-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* ========================================
   Homepage Specific Styles
   ======================================== */

.hero-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--header-height) - 100px);
  text-align: center;
  padding: 60px 20px;
}

.hero-logo {
  width: 120px;
  height: 120px;
  background: var(--accent-gradient);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  font-weight: bold;
  color: white;
  margin-bottom: 32px;
  box-shadow: var(--shadow-lg);
}

.hero-title {
  font-size: 48px;
  font-weight: 700;
  margin-bottom: 16px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 20px;
  color: var(--text-secondary);
  margin-bottom: 48px;
}

.hero-cta {
  display: flex;
  gap: 16px;
}

.cta-btn {
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 500;
  border-radius: var(--radius-lg);
  transition: all var(--transition-normal);
}

.cta-btn.primary {
  background: var(--accent-gradient);
  color: white;
}

.cta-btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(255, 107, 53, 0.4);
}

.cta-btn.secondary {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.cta-btn.secondary:hover {
  background-color: var(--bg-input);
  border-color: var(--border-light);
}

/* Features Section */
.features-section {
  padding: 80px 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.section-title {
  font-size: 32px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 48px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.feature-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  transition: all var(--transition-normal);
}

.feature-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-md);
}

.feature-icon {
  width: 64px;
  height: 64px;
  background: var(--accent-gradient);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.feature-icon svg {
  width: 32px;
  height: 32px;
  color: white;
}

.feature-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
}

.feature-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ========================================
   Engine Page Styles
   ======================================== */

.engine-hero {
  text-align: center;
  padding: 60px 20px;
  max-width: 800px;
  margin: 0 auto;
}

.engine-title {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 16px;
}

.engine-desc {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.8;
}

.engine-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  padding: 40px 20px;
  max-width: 1000px;
  margin: 0 auto;
}

.stat-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
}

.stat-value {
  font-size: 36px;
  font-weight: 700;
  color: var(--accent-primary);
  margin-bottom: 8px;
}

.stat-label {
  font-size: 14px;
  color: var(--text-secondary);
}

.tech-section {
  padding: 60px 20px;
  max-width: 1000px;
  margin: 0 auto;
}

.tech-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.tech-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.tech-card h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tech-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ========================================
   Footer
   ======================================== */

.footer {
  padding: 20px;
  text-align: center;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  position: fixed;
  bottom: 0;
  left: var(--sidebar-width);
  right: 0;
  z-index: 100;
}

.footer-text {
  font-size: 12px;
  color: var(--text-muted);
}

.footer-text a {
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.footer-text a:hover {
  color: var(--accent-primary);
}

/* ========================================
   Utility Classes
   ======================================== */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.hidden { display: none; }
.visible { display: block; }

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
