/*
 文件名: app.css
 路径: /assets/css/app.css
 上次版本号: v0.1.6
 本次版本号: v2.0.0
 升级时间: 2026-01-06
*/

:root {
  /* Colors */
  --primary-color: #007aff;
  --primary-hover: #005bb5;
  --primary-light: rgba(0, 122, 255, 0.1);
  --success-color: #34c759;
  --error-color: #ff3b30;
  --text-main: #1d1d1f;
  --text-secondary: #86868b;
  --bg-body: #f5f5f7;
  --bg-card: #ffffff;
  --border-color: #d2d2d7;
  --border-light: #e5e5ea;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);

  /* Spacing & Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;

  /* Layout */
  --max-width: 100%;
}

/* Base */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  margin: 0;
  padding: 0;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Header */
header {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

header h1 {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

header nav a {
  color: var(--primary-color);
  font-weight: 500;
  text-decoration: none;
  font-size: 14px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

header nav a:hover {
  background: var(--primary-light);
}

/* Layout Containers */
.container,
section.filters,
section.results,
section.home-banner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--spacing-md);
}

/* Home Banner */
section.home-banner .home-banner-inner {
  background: white;
  border-left: 4px solid var(--primary-color);
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  color: var(--text-main);
  font-size: 15px;
  line-height: 1.6;
}

/* Forms & Filters */
section.filters form {
  background: var(--bg-card);
  padding: var(--spacing-lg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--spacing-md);
}

.filter-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-row label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Generic Form Elements (applies to Admin too) */
input[type="text"],
input[type="password"],
input[type="email"],
select,
textarea,
.filter-row input {
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 15px;
  transition: all 0.2s ease;
  background: var(--bg-card);
  color: var(--text-main);
  box-sizing: border-box;
  max-width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.filter-row .hint {
  font-size: 12px;
  color: var(--text-secondary);
}

.filter-row .error {
  font-size: 12px;
  color: var(--error-color);
}

/* Filter Actions */
.filter-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 12px;
  margin-top: 10px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
  flex-wrap: wrap;
}

button {
  cursor: pointer;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  border: none;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

button:active {
  transform: scale(0.98);
}

button[type="submit"] {
  background: var(--primary-color);
  color: white;
  box-shadow: 0 2px 4px rgba(0, 122, 255, 0.3);
}

button[type="submit"]:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 8px rgba(0, 122, 255, 0.4);
}

button[type="button"] {
  background: #f2f2f7;
  color: var(--text-main);
}

button[type="button"]:hover {
  background: #e5e5ea;
}

#btnClearConditions {
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border-color);
}

#btnClearConditions:hover {
  border-color: var(--text-secondary);
  color: var(--text-main);
}

/* Results & Table */
section.results {
  padding-top: 0;
}

.share-tools {
  background: var(--bg-card);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 10px;
}

.share-tools select {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-size: 14px;
}

/* Column Settings Panel */
.col-settings {
  margin-bottom: 16px;
}

.col-settings-btn {
  color: var(--primary-color) !important;
  border-color: var(--primary-color) !important;
  background: transparent !important;
}

.col-settings-btn:hover {
  background: var(--primary-light) !important;
}

.col-settings-panel {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-lg);
}

/* Admin Specific */
.columns {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.columns label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  padding: 8px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.2s;
}

.columns label:hover {
  border-color: var(--primary-color);
}

.tab-nav {
  list-style: none;
  padding: 0;
  margin: 20px 0;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.tab-item {
  padding: 10px 20px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-weight: 500;
}

.tab-item:hover {
  color: var(--primary-color);
  background: rgba(0, 0, 0, 0.02);
}

.tab-item.active {
  border-bottom-color: var(--primary-color);
  color: var(--primary-color);
  font-weight: 600;
}

.tab-pane {
  display: none;
  padding: 20px 0;
  animation: fadeIn 0.3s ease;
}

.tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Table styling */
table.result-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
}

table.result-table thead {
  background: #f9f9fb;
}

table.result-table th {
  padding: 14px 16px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

table.result-table td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
}

table.result-table tr:last-child td {
  border-bottom: none;
}

table.result-table tr:hover {
  background-color: #f9f9f9;
}

.num-green {
  color: var(--success-color);
  font-family: "SF Mono", "Roboto Mono", monospace;
  font-weight: 600;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 24px;
}

.pagination a {
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-main);
  font-size: 14px;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.pagination a:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  transform: translateY(-1px);
}

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

/* Algo Notes */
.algo-notes {
  margin-top: 32px;
  padding: 24px;
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border-color);
}

.algo-notes h3 {
  margin-top: 0;
  font-size: 16px;
  color: var(--text-main);
}

.algo-notes-inner {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  header nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .filter-actions {
    flex-direction: column;
  }

  .filter-actions button {
    width: 100%;
  }

  table.result-table {
    display: block;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
  }

  table.result-table thead {
    display: none;
  }

  table.result-table tbody {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  table.result-table tr {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
  }

  table.result-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f0f0f5;
    padding: 10px 0;
  }

  table.result-table td:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-top: 8px;
  }

  table.result-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
  }

  /* Specific mobile button tweak */
  .btn-share {
    width: 100%;
    margin-top: 5px;
  }
}

/* Dark Mode Support (Basic) */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-body: #000000;
    --bg-card: #1c1c1e;
    --text-main: #f5f5f7;
    --text-secondary: #86868b;
    --border-color: #38383a;
    --border-light: #2c2c2e;
    --primary-light: rgba(10, 132, 255, 0.2);
  }

  header {
    background: rgba(28, 28, 30, 0.85);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  section.home-banner .home-banner-inner {
    background: #2c2500;
    border-left-color: #ffd60a;
    color: #ffd60a;
  }

  .filter-row input {
    background: #2c2c2e;
    border-color: #38383a;
    color: white;
  }

  table.result-table thead {
    background: #2c2c2e;
  }

  table.result-table tr:hover {
    background-color: #2c2c2e;
  }

  button[type="button"] {
    background: #2c2c2e;
    color: white;
  }

  button[type="button"]:hover {
    background: #3a3a3c;
  }
}