/* sotools - 公共样式 - 现代简约 + 科技感设计 */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* CSS Variables - 主题色 */
:root {
  --primary-color: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: #eef2ff;
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --bg-color: #0f172a;
  --bg-secondary: #1e293b;
  --card-bg: rgba(30, 41, 59, 0.8);
  --card-bg-solid: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --border-color: #334155;
  --success-color: #22c55e;
  --error-color: #ef4444;
  --warning-color: #f59e0b;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 16px;
  --glass-blur: 20px;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-color);
  background-image: 
    radial-gradient(ellipse at top left, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(118, 75, 162, 0.15) 0%, transparent 50%);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
  z-index: 0;
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* Header */
.header {
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: all 0.3s ease;
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1.375rem;
  letter-spacing: -0.02em;
  transition: all 0.3s ease;
}

.logo:hover {
  transform: translateY(-2px);
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: var(--primary-gradient);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
  position: relative;
  overflow: hidden;
}

.logo-icon::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.2) 50%, transparent 70%);
  transform: rotate(45deg);
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%) rotate(45deg); }
  100% { transform: translateX(100%) rotate(45deg); }
}

.nav-back {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.nav-back:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateX(-4px);
}

/* Main Content */
.main {
  padding: 48px 0;
  animation: fadeInUp 0.8s ease;
}

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

/* Page Title */
.page-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #f1f5f9 0%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-desc {
  color: var(--text-secondary);
  font-size: 1.125rem;
  margin-bottom: 32px;
  font-weight: 400;
}

/* Card */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 32px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.5), transparent);
}

/* Form Elements */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.75rem;
}

.form-textarea,
.form-input {
  width: 100%;
  padding: 16px 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-family: 'JetBrains Mono', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
  line-height: 1.7;
  transition: all 0.3s ease;
  resize: vertical;
  background: rgba(15, 23, 42, 0.6);
  color: var(--text-primary);
}

.form-textarea:focus,
.form-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2), 0 0 20px rgba(99, 102, 241, 0.1);
  background: rgba(15, 23, 42, 0.8);
}

.form-textarea::placeholder,
.form-input::placeholder {
  color: rgba(148, 163, 184, 0.5);
}

.form-textarea {
  min-height: 240px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  letter-spacing: 0.01em;
  position: relative;
  overflow: hidden;
}

.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.5s ease;
}

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

.btn-primary {
  background: var(--primary-gradient);
  color: white;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(34, 197, 94, 0.3);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(34, 197, 94, 0.4);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.8125rem;
}

.btn-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Tool Grid */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.tool-card {
  background: var(--card-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: flex-start;
  gap: 20px;
  position: relative;
  overflow: hidden;
}

.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--primary-gradient);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.tool-card:hover {
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(99, 102, 241, 0.2);
  transform: translateY(-8px) scale(1.02);
}

.tool-card:hover::before {
  opacity: 0.08;
}

.tool-icon {
  width: 64px;
  height: 64px;
  background: var(--primary-gradient);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  flex-shrink: 0;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
  position: relative;
  z-index: 1;
  transition: all 0.4s ease;
}

.tool-card:hover .tool-icon {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 12px 32px rgba(99, 102, 241, 0.4);
}

.tool-info {
  position: relative;
  z-index: 1;
}

.tool-info h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.tool-info p {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Alert/Error */
.alert {
  padding: 16px 20px;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  margin-bottom: 20px;
  display: none;
  border: 1px solid;
  font-weight: 500;
}

.alert.show {
  display: block;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
}

.alert-success {
  background: rgba(34, 197, 94, 0.1);
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.3);
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  padding: 16px 32px;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 600;
  animation: toastIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.toast-success {
  background: rgba(34, 197, 94, 0.9);
  color: white;
  border: 1px solid rgba(34, 197, 94, 0.5);
}

.toast-error {
  background: rgba(239, 68, 68, 0.9);
  color: white;
  border: 1px solid rgba(239, 68, 68, 0.5);
}

/* Footer */
.footer {
  text-align: center;
  padding: 48px 0;
  color: var(--text-secondary);
  font-size: 0.875rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 64px;
  position: relative;
  z-index: 1;
}

.footer p {
  opacity: 0.8;
}

/* ==================== 广告位样式 ==================== */

.ad-container {
  position: relative;
  background: var(--card-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin: 32px 0;
  min-height: 120px;
  transition: all 0.3s ease;
}

.ad-container::before {
  content: '广告';
  position: absolute;
  top: 12px;
  right: 48px;
  font-size: 0.625rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.08);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ad-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-secondary);
  opacity: 0.7;
  transition: all 0.3s ease;
}

.ad-close-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
  transform: rotate(90deg);
}

.ad-banner-top {
  margin-bottom: 32px;
  min-height: 100px;
}

.ad-banner-bottom {
  margin-top: 40px;
  min-height: 100px;
}

.ad-sidebar {
  margin-top: 32px;
  min-height: 280px;
}

.ad-tool-bottom {
  margin-top: 32px;
  min-height: 100px;
}

.ad-container:not(.ad-loaded) {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.03) 25%, rgba(255, 255, 255, 0.08) 50%, rgba(255, 255, 255, 0.03) 75%);
  background-size: 200% 100%;
  animation: adLoading 1.5s infinite;
}

@keyframes adLoading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.ad-container iframe,
.ad-container ins.adsbygoogle,
.ad-container #carbonads {
  display: block;
  margin: 0 auto;
  max-width: 100%;
}

#carbonads {
  font-family: inherit;
}

#carbonads a {
  color: var(--text-primary);
  text-decoration: none;
}

#carbonads .carbon-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}

#carbonads .carbon-img img {
  border-radius: var(--radius);
}

#carbonads .carbon-text {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text-primary);
}

#carbonads .carbon-poweredby {
  display: block;
  font-size: 0.6875rem;
  color: var(--text-secondary);
  margin-top: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

@media (max-width: 640px) {
  .ad-container {
    padding: 16px;
    margin: 24px 0;
    min-height: 100px;
  }
  
  .ad-container::before {
    font-size: 0.5625rem;
    padding: 3px 8px;
  }
  
  .ad-sidebar {
    min-height: 220px;
  }
}

/* ==================== 广告样式结束 ==================== */

/* Responsive */
@media (max-width: 768px) {
  .page-title {
    font-size: 2rem;
  }
  
  .card {
    padding: 24px;
  }
  
  .tool-grid {
    grid-template-columns: 1fr;
  }
  
  .tool-card {
    padding: 24px;
  }
  
  .tool-icon {
    width: 56px;
    height: 56px;
    font-size: 28px;
  }
  
  .form-textarea {
    min-height: 200px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }
  
  .page-title {
    font-size: 1.75rem;
  }
  
  .page-desc {
    font-size: 1rem;
  }
  
  .btn {
    padding: 10px 20px;
    font-size: 0.875rem;
  }
}

/* Syntax Highlighting for JSON */
.json-key {
  color: #a78bfa;
}

.json-string {
  color: #34d399;
}

.json-number {
  color: #fbbf24;
}

.json-boolean {
  color: #60a5fa;
}

.json-null {
  color: #f87171;
}
