/* ============================================
   RonTools - Global Design System
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap');

/* ── CSS Variables ── */
:root {
  --bg-primary: #0d0e1a;
  --bg-secondary: #12142a;
  --bg-card: rgba(255, 255, 255, 0.05);
  --bg-card-hover: rgba(255, 255, 255, 0.09);
  --border-color: rgba(255, 255, 255, 0.1);
  --border-hover: rgba(139, 92, 246, 0.5);
  --accent-1: #8b5cf6;
  --accent-2: #6366f1;
  --accent-3: #38bdf8;
  --gradient-main: linear-gradient(135deg, #8b5cf6 0%, #6366f1 50%, #38bdf8 100%);
  --gradient-card: linear-gradient(135deg, rgba(139,92,246,0.15) 0%, rgba(99,102,241,0.08) 100%);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-btn: 0 4px 20px rgba(139, 92, 246, 0.4);
  --radius-card: 16px;
  --radius-btn: 10px;
  --radius-input: 10px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Noto Sans SC', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  background-image:
    radial-gradient(ellipse 80% 50% at 20% 0%, rgba(139,92,246,0.15) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(56,189,248,0.1) 0%, transparent 60%);
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--accent-1); border-radius: 3px; }

/* ── Navbar ── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(13, 14, 26, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  padding: 0 2rem;
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-size: 1.25rem;
  font-weight: 700;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-logo svg { flex-shrink: 0; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
}

.nav-links a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
  background: rgba(139, 92, 246, 0.15);
}

.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
  background: none;
  border: none;
}

.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 2px;
  transition: var(--transition);
}

/* ── Page Container ── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ── Page Header ── */
.page-hero {
  text-align: center;
  padding: 4rem 1rem 3rem;
}

.page-hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1rem;
}

.page-hero p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto;
}

/* ── Tool Cards Grid ── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
  padding: 1rem 0 3rem;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 1.75rem;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.tool-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-card);
  opacity: 0;
  transition: var(--transition);
}

.tool-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: var(--shadow-card), 0 0 30px rgba(139,92,246,0.15);
}

.tool-card:hover::before { opacity: 1; }

.tool-icon {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  background: linear-gradient(135deg, rgba(139,92,246,0.25), rgba(99,102,241,0.15));
  border: 1px solid rgba(139,92,246,0.3);
}

.tool-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  position: relative;
}

.tool-card p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
  position: relative;
  flex: 1;
}

.tool-card-arrow {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--accent-1);
  font-weight: 500;
  margin-top: auto;
  transition: var(--transition);
}

.tool-card:hover .tool-card-arrow { gap: 8px; }

/* ── Tool Page Layout ── */
.tool-page {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.tool-page-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.tool-page-header .tool-icon { width: 48px; height: 48px; font-size: 1.5rem; }

.tool-page-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tool-page-header p {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
  transition: var(--transition);
}

.back-link:hover { color: var(--accent-1); }

/* ── Glass Card ── */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
}

/* ── Form Elements ── */
label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

input[type="text"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-input);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
  resize: vertical;
}

input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  border-color: var(--accent-1);
  background: rgba(139,92,246,0.08);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.15);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent-1);
  cursor: pointer;
}

select option { background: #1e2040; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.65rem 1.4rem;
  border: none;
  border-radius: var(--radius-btn);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--gradient-main);
  color: #fff;
  box-shadow: var(--shadow-btn);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(139,92,246,0.6);
}

.btn-secondary {
  background: rgba(139,92,246,0.15);
  color: var(--accent-1);
  border: 1px solid rgba(139,92,246,0.3);
}

.btn-secondary:hover {
  background: rgba(139,92,246,0.25);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-ghost:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ── Output Area ── */
.output-area {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-input);
  padding: 1rem;
  min-height: 80px;
  font-size: 1rem;
  color: var(--text-primary);
  word-break: break-all;
  line-height: 1.7;
}

.output-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

/* ── Form Groups ── */
.form-group { margin-bottom: 1.25rem; }

/* ── Divider ── */
.divider {
  height: 1px;
  background: var(--border-color);
  margin: 1.5rem 0;
}

/* ── Toast Notification ── */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.8rem 1.2rem;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #fff;
  background: rgba(30, 32, 64, 0.95);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-card);
  animation: toastIn 0.3s ease forwards;
  max-width: 320px;
}

.toast.success { border-color: rgba(52,211,153,0.4); }
.toast.error   { border-color: rgba(248,113,113,0.4); }
.toast.hide    { animation: toastOut 0.3s ease forwards; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}

/* ── Drop Zone ── */
.drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-card);
  padding: 3rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent-1);
  background: rgba(139,92,246,0.05);
}

.drop-zone-icon { font-size: 3rem; margin-bottom: 0.5rem; }
.drop-zone p { color: var(--text-secondary); font-size: 0.9rem; }
.drop-zone strong { color: var(--accent-1); }

/* ── Stats Row ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0;
}

.stat-box {
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
}

.stat-box .stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-box .stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* ── Footer ── */
.footer {
  border-top: 1px solid var(--border-color);
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .nav-links { display: none; flex-direction: column; }
  .nav-links.open {
    display: flex;
    position: absolute;
    top: 64px;
    left: 0; right: 0;
    background: rgba(13,14,26,0.98);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem;
    gap: 0.5rem;
  }
  .nav-hamburger { display: flex; }
  .tools-grid { grid-template-columns: 1fr 1fr; }
  .btn-group { flex-direction: column; }
}

@media (max-width: 480px) {
  .tools-grid { grid-template-columns: 1fr; }
  .page-hero { padding: 2.5rem 1rem 2rem; }
}

/* ── Utility ── */
.hidden { display: none !important; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.text-success { color: #34d399; }
.text-error   { color: #f87171; }
.text-accent  { color: var(--accent-1); }
.text-muted   { color: var(--text-muted); }
.fw-bold { font-weight: 700; }
