/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0f0e0c;
  --bg-card: #1a1916;
  --bg-input: #252320;
  --border: #2a2825;
  --text: #e8e6e1;
  --text-muted: #9a9790;
  --accent: #e8c547;
  --accent-hover: #f0d06a;
  --accent-dim: rgba(232, 197, 71, 0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  --transition: 0.2s ease;
  --max-width: 1200px;
  --header-height: 70px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

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

img {
  max-width: 100%;
  display: block;
}

/* ===== HEADER ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 14, 12, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: var(--header-height);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
}

.logo span {
  color: var(--accent);
}

/* Desktop nav */
.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}

.nav-links > li {
  position: relative;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  white-space: nowrap;
  display: block;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
  background: var(--accent-dim);
}

/* Hide tool links on desktop — only show Home + Tools dropdown */
.nav-links > li.nav-tool {
  display: none;
}

/* Tools dropdown trigger */
.nav-dropdown {
  position: relative;
}

.nav-dropdown > .dropdown-toggle {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-dropdown > .dropdown-toggle:hover {
  color: var(--accent);
  background: var(--accent-dim);
}

.nav-dropdown > .dropdown-toggle i.fa-chevron-down {
  font-size: 0.65rem;
  transition: transform var(--transition);
}

.nav-dropdown.open > .dropdown-toggle i.fa-chevron-down {
  transform: rotate(180deg);
}

/* Dropdown panel */
.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  min-width: 520px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  z-index: 200;
  display: none;
}

.nav-dropdown.open .dropdown-menu {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 2px;
}

.dropdown-menu a {
  padding: 8px 12px;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
}

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 8px;
}

/* ===== MAIN ===== */
main {
  flex: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 24px;
  width: 100%;
}

/* ===== HERO (homepage) ===== */
.hero {
  text-align: center;
  padding: 60px 0 40px;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 16px;
}

.hero h1 span {
  color: var(--accent);
}

.hero p {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto;
}

/* ===== TOOL GRID (homepage) ===== */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 40px;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tool-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow), 0 0 0 1px var(--accent);
}

.tool-card .icon {
  font-size: 1.5rem;
  color: var(--accent);
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-dim);
  border-radius: var(--radius-sm);
}

.tool-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.tool-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  flex: 1;
}

.tool-card .card-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tool-card .card-link::after {
  content: '\2192';
  transition: transform var(--transition);
}

.tool-card:hover .card-link::after {
  transform: translateX(4px);
}

/* ===== TOOL PAGE LAYOUT ===== */
.tool-page {
  max-width: 720px;
  margin: 0 auto;
}

.tool-page h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.tool-page .tool-desc {
  color: var(--text-muted);
  margin-bottom: 32px;
}

.tool-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}

/* ===== FORM ELEMENTS ===== */
label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 8px;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
textarea,
select {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color var(--transition);
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
}

textarea {
  resize: vertical;
  min-height: 140px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-primary {
  background: var(--accent);
  color: #0f0e0c;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

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

/* ===== RESULT BOX ===== */
.result-box {
  margin-top: 24px;
  padding: 20px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: none;
}

.result-box.visible {
  display: block;
}

.result-box h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.result-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

.result-detail {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Stats row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.stat-item {
  text-align: center;
  padding: 16px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.stat-item .stat-num {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-item .stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===== RANGE / SLIDER ===== */
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  outline: none;
  margin: 12px 0;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
}

/* ===== CHECKBOX / TOGGLE ===== */
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 12px 0;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 0;
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

/* ===== PASSWORD DISPLAY ===== */
.password-display {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 16px;
}

.password-display .pw-text {
  flex: 1;
  font-family: 'DM Sans', monospace;
  font-size: 1.2rem;
  font-weight: 600;
  word-break: break-all;
  color: var(--accent);
}

.password-display .copy-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.password-display .copy-btn:hover {
  color: var(--accent);
  background: var(--accent-dim);
}

/* Strength meter */
.strength-meter {
  height: 4px;
  background: var(--bg-input);
  border-radius: 2px;
  margin-top: 12px;
  overflow: hidden;
}

.strength-meter .fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease, background 0.4s ease;
}

/* ===== QR OUTPUT ===== */
.qr-output {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-top: 24px;
}

.qr-output canvas {
  border-radius: var(--radius-sm);
}

/* ===== DROP ZONE ===== */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.drop-zone .drop-icon {
  font-size: 2.5rem;
  color: var(--accent);
  margin-bottom: 12px;
}

.drop-zone p {
  color: var(--text-muted);
  margin: 0;
}

.drop-zone .drop-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 8px;
  display: block;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  text-decoration: underline;
  padding: 0;
}

/* ===== PROGRESS BAR ===== */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-input);
  border-radius: 4px;
  margin-top: 16px;
  overflow: hidden;
  display: none;
}

.progress-bar.active {
  display: block;
}

.progress-bar .progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.3s ease;
  width: 0%;
}

/* ===== FILE INFO ===== */
.file-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  margin-top: 16px;
}

.file-info .file-name {
  flex: 1;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-info .file-size {
  color: var(--text-muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.file-info .remove-file {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 4px;
  line-height: 1;
}

.file-info .remove-file:hover {
  color: #e85050;
}

/* ===== FILE LIST ===== */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

/* ===== PREVIEW IMAGE ===== */
.preview-img {
  max-width: 100%;
  max-height: 300px;
  border-radius: var(--radius-sm);
  margin-top: 16px;
  object-fit: contain;
}

/* ===== STATUS MESSAGE ===== */
.status-msg {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-top: 16px;
  display: none;
}

.status-msg.visible {
  display: block;
}

.status-msg.info {
  background: rgba(232, 197, 71, 0.1);
  color: var(--accent);
  border: 1px solid rgba(232, 197, 71, 0.2);
}

.status-msg.success {
  background: rgba(109, 214, 109, 0.1);
  color: #6dd66d;
  border: 1px solid rgba(109, 214, 109, 0.2);
}

.status-msg.error {
  background: rgba(232, 80, 80, 0.1);
  color: #e85050;
  border: 1px solid rgba(232, 80, 80, 0.2);
}

/* ===== AD ADSENSE SLOTS ===== */
.ad-top,
.ad-bottom {
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: center;
}

.ad-top {
  margin-bottom: 32px;
}

.ad-bottom {
  margin-top: 32px;
}

.ad-top::before {
  content: 'Ad Space';
}

.ad-bottom::before {
  content: 'Ad Space';
}

/* ===== ISSUE CARDS (grammar/plagiarism) ===== */
.issue-card {
  padding: 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.issue-card .issue-type {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.issue-card .issue-type.error {
  color: #e85050;
}

.issue-card .issue-type.warning {
  color: var(--accent);
}

.issue-card .issue-type.info {
  color: #5ba8f5;
}

.issue-card .issue-msg {
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 8px;
}

.issue-card .issue-context {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 8px;
}

.issue-card .issue-context mark {
  background: rgba(232, 80, 80, 0.25);
  color: #e85050;
  padding: 1px 4px;
  border-radius: 2px;
}

.issue-card .suggestion-btn {
  display: inline-block;
  padding: 4px 12px;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(232, 197, 71, 0.3);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  margin-right: 6px;
  margin-top: 4px;
  transition: all var(--transition);
}

.issue-card .suggestion-btn:hover {
  background: rgba(232, 197, 71, 0.2);
}

/* ===== TEXT OUTPUT PANEL ===== */
.text-output {
  padding: 20px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  line-height: 1.8;
  white-space: pre-wrap;
  word-wrap: break-word;
  min-height: 100px;
  margin-top: 16px;
}

.text-output .hl-error {
  background: rgba(232, 80, 80, 0.2);
  border-bottom: 2px solid #e85050;
  cursor: help;
}

.text-output .hl-warning {
  background: rgba(232, 197, 71, 0.2);
  border-bottom: 2px solid var(--accent);
  cursor: help;
}

.text-output .hl-match {
  background: rgba(232, 80, 80, 0.2);
  border-radius: 2px;
  padding: 1px 0;
}

/* ===== COMPARE PANELS ===== */
.compare-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

@media (max-width: 768px) {
  .compare-panels {
    grid-template-columns: 1fr;
  }
}

.compare-panel textarea {
  min-height: 200px;
}

/* ===== SUMMARY SENTENCE ===== */
.summary-sentence {
  padding: 12px 16px;
  background: var(--bg-input);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 12px;
  font-size: 0.95rem;
  line-height: 1.7;
}

/* ===== AD PLACEHOLDERS ===== */
.ad-slot {
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 32px 0;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== FOOTER ===== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: auto;
}

.site-footer a {
  color: var(--text-muted);
}

.site-footer a:hover {
  color: var(--accent);
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ===== MOBILE ===== */
@media (max-width: 768px) {
  .menu-toggle {
    display: block;
  }

  /* Hide desktop dropdown on mobile */
  .nav-dropdown {
    display: none;
  }

  /* Show all tool links in mobile menu */
  .nav-links > li.nav-tool {
    display: block;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: rgba(15, 14, 12, 0.97);
    backdrop-filter: blur(12px);
    flex-direction: column;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    gap: 4px;
    max-height: 75vh;
    overflow-y: auto;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    padding: 12px 16px;
    font-size: 1rem;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero {
    padding: 32px 0 24px;
  }

  main {
    padding: 24px 16px;
  }

  .tool-container {
    padding: 20px;
  }

  .tools-grid {
    grid-template-columns: 1fr;
  }

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .stats-row {
    grid-template-columns: 1fr 1fr;
  }

  .btn-group {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }
}
