/* ==================================================
   GHOSTERN – TOOLS SHARED STYLES
   ================================================== */

/* ---------- CSS RESET & BASE ---------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Colors – matches your homepage dark theme */
  --bg-dark: #0f0a19;
  --bg-card: rgba(30, 27, 75, 0.85);
  --bg-input: rgba(0, 0, 0, 0.5);
  --border: #2d2a45;
  --border-light: #3e3a5e;
  --primary: #be123c;
  --primary-dark: #9f1239;
  --secondary: #00ffff;
  --accent-gold: #c5a059;
  --accent-gold-dim: #8a6e36;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dark: #cbd5e1;
  --success: #22c55e;

  /* Fonts */
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'Fira Code', 'Courier New', monospace;
  --font-display: 'Impact', 'Arial Black', sans-serif;

  /* Spacing */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
  background: var(--bg-dark);
  background-image: radial-gradient(circle at 50% 0%, #2a0845 0%, #0a041c 70%);
  color: var(--text);
  font-family: var(--font-main);
  line-height: 1.6;
  padding: 2rem;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Subtle scanline effect */
body::after {
  content: " ";
  display: block;
  position: fixed;
  top: 0; left: 0; bottom: 0; right: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%),
              linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
  z-index: 999;
  background-size: 100% 4px, 6px 100%;
  pointer-events: none;
}

/* ---------- TYPOGRAPHY ---------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 1px;
  line-height: 1.2;
  color: var(--text);
}

h1 {
  font-size: clamp(1.8rem, 5vw, 3rem);
  margin-bottom: 0.5rem;
}

h2 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  margin-bottom: 1rem;
}

h3 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

p {
  margin-bottom: 1rem;
  color: var(--text-muted);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease;
}
a:hover {
  color: var(--secondary);
}

/* ---------- LAYOUT & CONTAINERS ---------- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.tool-wrapper {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
}

/* ---------- CARDS / PANELS ---------- */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 30px -10px rgba(0, 0, 0, 0.3);
}

.card-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--primary);
}
.card-body {
  flex: 1;
}

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  background: transparent;
  color: var(--text);
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 10px rgba(190, 18, 60, 0.3);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(190, 18, 60, 0.4);
}
.btn-secondary {
  border: 1px solid var(--primary);
  color: var(--primary);
  background: transparent;
}
.btn-secondary:hover {
  background: rgba(190, 18, 60, 0.1);
  transform: translateY(-2px);
}
.btn-copy {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
}
.btn-copy:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-copy.copied {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.btn-download {
  background: var(--accent-gold);
  color: #000;
  font-weight: 700;
}
.btn-download:hover {
  background: var(--accent-gold-dim);
  transform: translateY(-2px);
}

/* ---------- FORM ELEMENTS ---------- */
input, textarea, select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font-main);
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(190, 18, 60, 0.2);
}
label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}
textarea {
  resize: vertical;
  min-height: 80px;
}
input[type="range"] {
  padding: 0;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  -webkit-appearance: none;
}
input[type="range"]:focus {
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 4px var(--primary);
}
input[type="color"] {
  width: 48px;
  height: 48px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: transparent;
  cursor: pointer;
}
input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}
input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: var(--radius-sm);
}

/* ---------- RESULT ITEMS (for lists of copyable things) ---------- */
.result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
}
.result-item:hover {
  border-color: var(--primary);
  transform: translateX(4px);
}
.result-text {
  font-family: var(--font-mono);
  font-size: 1rem;
  word-break: break-all;
}
.copy-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.result-item.copied {
  border-color: var(--success);
  background: rgba(34, 197, 94, 0.1);
}

/* ---------- TOAST NOTIFICATION ---------- */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--primary);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 2rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 1px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 10000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- RESPONSIVE GRID UTILITIES ---------- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
}

/* ---------- FLEX HELPERS ---------- */
.flex {
  display: flex;
}
.flex-col {
  flex-direction: column;
}
.items-center {
  align-items: center;
}
.justify-between {
  justify-content: space-between;
}
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }
.gap-4 { gap: 1.5rem; }

/* ---------- MARGIN & PADDING ---------- */
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }

/* ---------- TEXT UTILITIES ---------- */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-gold { color: var(--accent-gold); }

/* ---------- CANVAS CONTAINER (for image tools) ---------- */
.canvas-container {
  background: #000;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  padding: 1rem;
}
canvas {
  max-width: 100%;
  height: auto;
  display: block;
  box-shadow: var(--shadow-md);
}

/* ---------- STICKY FOOTER (optional) ---------- */
footer {
  text-align: center;
  margin-top: 3rem;
  padding: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ---------- RESPONSIVE OVERRIDES ---------- */
@media (max-width: 768px) {
  body {
    padding: 1rem;
  }
  .card {
    padding: 1rem;
  }
  .btn {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
  }
}