/* ========================================
   河道运维AI调度系统 - 全局共享样式 v2.1
   ======================================== */

:root {
  --bg-dark: #0a0e1a;
  --bg-card: #111827;
  --bg-card-hover: #1a2332;
  --bg-input: rgba(255,255,255,0.04);
  --border: #1e293b;
  --border-light: #334155;
  --primary: #06b6d4;
  --primary-glow: rgba(6, 182, 212, 0.15);
  --primary-dim: #0891b2;
  --accent-green: #10b981;
  --accent-yellow: #f59e0b;
  --accent-red: #ef4444;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-orange: #f97316;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-dim: #64748b;
  --river-blue: #0ea5e9;
  --water-gradient: linear-gradient(135deg, #0c4a6e, #0e7490, #06b6d4);
  --glass: rgba(17, 24, 39, 0.85);
  --glass-border: rgba(255,255,255,0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
}

/* === Page Transitions === */
.page-enter {
  animation: pageIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === Shared Header === */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  background: linear-gradient(90deg, #0a0e1a 0%, #0f172a 100%);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.app-header .logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}
.app-header .logo-icon {
  width: 34px; height: 34px;
  background: var(--water-gradient);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.3);
  transition: transform 0.3s;
  overflow: hidden;
}
.app-header .logo-icon img {
  width: 28px; height: 28px;
}
.app-header .logo-area:hover .logo-icon { transform: rotate(-10deg) scale(1.05); }
.app-header .logo-text {
  font-size: 15px;
  font-weight: 600;
  background: linear-gradient(90deg, var(--text-primary), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.app-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
}
.app-nav a {
  padding: 7px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 7px;
  transition: all 0.25s;
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}
.app-nav a:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.app-nav a.active {
  background: var(--primary-glow);
  color: var(--primary);
  font-weight: 500;
}
.app-nav a .badge {
  position: absolute;
  top: 2px; right: 4px;
  width: 16px; height: 16px;
  background: var(--accent-red);
  border-radius: 50%;
  font-size: 9px;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-weight: 600;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}
.header-weather {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 12px;
  background: rgba(14, 165, 233, 0.08);
  border: 1px solid rgba(14, 165, 233, 0.15);
  border-radius: 20px;
  font-size: 12px;
  color: var(--river-blue);
}
.header-time {
  font-size: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.header-bell {
  position: relative; cursor: pointer;
  font-size: 15px; color: var(--text-secondary);
  transition: color 0.2s;
}
.header-bell:hover { color: var(--accent-yellow); }
.header-bell .dot {
  position: absolute; top: -2px; right: -2px;
  width: 7px; height: 7px;
  background: var(--accent-red);
  border-radius: 50%;
  border: 2px solid var(--bg-dark);
}
.header-user {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}
.header-user:hover { background: rgba(255,255,255,0.05); }
.header-user .avatar {
  width: 30px; height: 30px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--primary), var(--accent-purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.header-user .name { font-size: 12px; color: var(--text-secondary); }
.header-user .role { font-size: 10px; color: var(--text-dim); }

/* === Card Animations === */
.card-stagger > * {
  opacity: 0;
  animation: cardIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.card-stagger > *:nth-child(1) { animation-delay: 0.05s; }
.card-stagger > *:nth-child(2) { animation-delay: 0.1s; }
.card-stagger > *:nth-child(3) { animation-delay: 0.15s; }
.card-stagger > *:nth-child(4) { animation-delay: 0.2s; }
.card-stagger > *:nth-child(5) { animation-delay: 0.25s; }
.card-stagger > *:nth-child(6) { animation-delay: 0.3s; }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* === Hover Lift === */
.hover-lift {
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s;
}
.hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

/* === Glow Border on Hover === */
.glow-border {
  transition: border-color 0.3s, box-shadow 0.3s;
}
.glow-border:hover {
  border-color: rgba(6, 182, 212, 0.3);
  box-shadow: 0 0 0 1px rgba(6, 182, 212, 0.1), 0 0 20px rgba(6, 182, 212, 0.05);
}

/* === Button Styles === */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.25s;
  text-decoration: none;
}
.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover {
  background: var(--primary-dim);
  box-shadow: 0 0 24px rgba(6, 182, 212, 0.35);
  transform: translateY(-1px);
}
.btn-secondary {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-secondary:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
  border-color: var(--border-light);
}
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 6px 10px;
}
.btn-ghost:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }
.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--accent-red);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.2); }
.btn-success {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: var(--accent-green);
}
.btn-success:hover { background: rgba(16, 185, 129, 0.2); }
.btn-sm { padding: 5px 10px; font-size: 11px; }
.btn-lg { padding: 12px 24px; font-size: 14px; }
.btn-icon {
  width: 32px; height: 32px;
  padding: 0;
  border-radius: 8px;
  justify-content: center;
}

/* === Form Controls === */
.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
}
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
}
.form-input::placeholder { color: var(--text-dim); }
.form-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}
.form-select:focus { border-color: var(--primary); }
.form-select option { background: var(--bg-card); }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-group { margin-bottom: 16px; }
.form-hint {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* === Toggle Switch === */
.toggle {
  width: 40px; height: 22px;
  background: rgba(255,255,255,0.1);
  border-radius: 11px;
  position: relative;
  cursor: pointer;
  transition: background 0.3s;
  flex-shrink: 0;
}
.toggle.on { background: var(--primary); }
.toggle::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: white;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.toggle.on::after { transform: translateX(18px); }

/* === Table === */
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 12px 14px;
  font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  transition: background 0.2s;
}
.data-table tr:hover td { background: rgba(255,255,255,0.02); }

/* === Status Badge === */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
}
.status-badge.online { background: rgba(16,185,129,0.12); color: var(--accent-green); }
.status-badge.warning { background: rgba(245,158,11,0.12); color: var(--accent-yellow); }
.status-badge.offline { background: rgba(100,116,139,0.12); color: var(--text-dim); }
.status-badge.danger { background: rgba(239,68,68,0.12); color: var(--accent-red); }
.status-badge .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* === Modal === */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  z-index: 500;
  align-items: center;
  justify-content: center;
}
.modal-overlay.show {
  display: flex;
  animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
  animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-box-lg { width: 720px; }
.modal-box-sm { width: 360px; }
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close {
  width: 30px; height: 30px;
  border-radius: 7px;
  background: rgba(255,255,255,0.05);
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.modal-close:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
}

/* === Tooltip === */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 5px 10px;
  background: #1e293b;
  color: var(--text-primary);
  font-size: 11px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all 0.2s;
  z-index: 999;
}
[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* === Animations === */
@keyframes pulse {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.8); opacity: 0; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.spin { animation: spin 1s linear infinite; }

/* === Ripple Effect === */
.ripple { position: relative; overflow: hidden; }
.ripple::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), rgba(255,255,255,0.15) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
}
.ripple:hover::after { opacity: 1; }

/* === Skeleton Loading === */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* === Scrollbar === */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

/* === Page layout === */
.page-content {
  padding: 24px;
  max-width: 1600px;
  margin: 0 auto;
}
.page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}
.page-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 18px; font-weight: 600;
}
.page-title .icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--primary-glow);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: var(--primary);
}
.toolbar-actions { display: flex; align-items: center; gap: 8px; }

/* === Search box === */
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  transition: border-color 0.2s;
}
.search-box:focus-within { border-color: var(--primary); }
.search-box i { color: var(--text-dim); font-size: 13px; }
.search-box input {
  background: none; border: none; outline: none;
  color: var(--text-primary); font-size: 13px;
  width: 200px; font-family: inherit;
}
.search-box input::placeholder { color: var(--text-dim); }

/* === Alert / Toast === */
.alert-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
}
.alert-banner.warning {
  background: rgba(245,158,11,0.1);
  border: 1px solid rgba(245,158,11,0.2);
  color: var(--accent-yellow);
}
.alert-banner.danger {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.2);
  color: var(--accent-red);
}
.alert-banner.info {
  background: rgba(6,182,212,0.08);
  border: 1px solid rgba(6,182,212,0.15);
  color: var(--primary);
}

/* === Responsive === */
@media (max-width: 1200px) {
  .app-nav a span { display: none; }
}

@media (max-width: 768px) {
  .app-header { padding: 0 12px; height: 50px; }
  .app-header .logo-text { font-size: 13px; }
  .app-nav { gap: 4px; }
  .app-nav a { padding: 8px 10px; font-size: 12px; }

  .page-content { padding: 12px; }
  .page-title { font-size: 16px; }
  .page-title .icon { width: 30px; height: 30px; font-size: 14px; }

  .modal-box { width: 95% !important; max-width: 95vw; margin: 10px auto; }
  .modal-body { padding: 16px; }

  .toolbar-actions { flex-wrap: wrap; gap: 6px; }
  .search-box input { width: 140px; }
}

@media (max-width: 480px) {
  .app-header .logo-text span { display: none; }
  .app-nav a { padding: 6px 8px; font-size: 11px; }
  .app-nav a i { font-size: 12px; }
  .page-toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .toolbar-actions { justify-content: center; }
  .modal-header h3 { font-size: 14px; }
  .modal-body { padding: 12px; }
  .btn { padding: 8px 12px; font-size: 12px; }
}
