/* ==========================================================================
   FileToolKit - Base Styles & Typography
   ========================================================================== */

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

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography Hierarchy */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2rem, 4vw + 1rem, 3.25rem);
  font-weight: var(--font-weight-extrabold);
  margin-bottom: var(--space-4);
}

h2 {
  font-size: clamp(1.5rem, 2.5vw + 0.5rem, 2.25rem);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-3);
}

h3 {
  font-size: clamp(1.25rem, 1.5vw + 0.25rem, 1.5rem);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-2);
}

h4 {
  font-size: 1.125rem;
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-2);
}

p {
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
  margin-bottom: var(--space-4);
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--emerald-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--emerald-hover);
}

strong, b {
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
}

code, pre, kbd {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

code {
  padding: 0.15em 0.4em;
  background-color: var(--bg-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  color: var(--emerald-primary);
}

/* Container */
.container {
  width: 100%;
  max-width: var(--container-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

@media (min-width: 768px) {
  .container {
    padding-left: var(--space-6);
    padding-right: var(--space-6);
  }
}

@media (min-width: 1200px) {
  .container {
    padding-left: var(--space-8);
    padding-right: var(--space-8);
  }
}

.container-narrow {
  max-width: 900px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  transition: all var(--transition-fast);
}

.btn:disabled, .btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background-color: var(--emerald-primary);
  color: var(--text-inverse);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--emerald-hover);
  color: var(--text-inverse);
  box-shadow: var(--shadow-emerald);
  transform: translateY(-1px);
}

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

.btn-secondary {
  background-color: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-color);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--bg-muted);
  border-color: var(--emerald-border);
  color: var(--emerald-primary);
  transform: translateY(-1px);
}

.btn-ghost {
  background-color: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background-color: var(--bg-muted);
  color: var(--text-primary);
}

.btn-emerald-tint {
  background-color: var(--emerald-tint);
  color: var(--emerald-dark);
  border-color: var(--emerald-border);
}

.btn-emerald-tint:hover:not(:disabled) {
  background-color: var(--emerald-primary);
  color: var(--text-inverse);
}

.btn-lg {
  font-size: var(--font-size-base);
  padding: 0.95rem 1.75rem;
  border-radius: var(--radius-lg);
}

.btn-sm {
  font-size: var(--font-size-xs);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
}

.btn-icon {
  padding: 0.65rem;
  border-radius: var(--radius-md);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  line-height: 1;
}

.badge-emerald {
  background-color: var(--emerald-tint);
  color: var(--emerald-dark);
  border: 1px solid var(--emerald-border);
}

[data-theme="dark"] .badge-emerald {
  color: var(--emerald-hover);
}

.badge-privacy, .badge-free {
  background-color: var(--emerald-tint);
  color: var(--emerald-dark);
  border: 1px solid var(--emerald-border);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

[data-theme="dark"] .badge-privacy,
[data-theme="dark"] .badge-free {
  background-color: rgba(22, 163, 106, 0.15);
  color: #4ADE80;
  border-color: rgba(22, 163, 106, 0.35);
}

.badge-server {
  background-color: #FEF3C7;
  color: #92400E;
  border: 1px solid #FDE68A;
}

[data-theme="dark"] .badge-server {
  background-color: #451A03;
  color: #FCD34D;
  border-color: #78350F;
}

.badge-popular {
  background-color: #FEF6E9;
  color: var(--status-warning);
  border: 1px solid #FCD34D;
}

.badge-new {
  background-color: #EFF6FF;
  color: var(--status-info);
  border: 1px solid #BFDBFE;
}

/* Form Elements */
.input, .select, .textarea {
  width: 100%;
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--emerald-glow);
}

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

.form-label {
  display: block;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Accessibility & Utility */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

:focus-visible {
  outline: 2px solid var(--emerald-primary);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Flex & Grid Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-emerald { color: var(--emerald-primary); }
.text-muted { color: var(--text-secondary); }
