/* assets/css/components.css — buttons, cards, forms, nav, footer, alerts, modal */

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 44px; padding: 0 var(--space-5);
  border-radius: var(--radius-md);
  font-weight: 600; font-size: var(--text-body);
  border: 1px solid transparent; cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
  text-decoration: none;
}
.btn--primary { background: var(--color-primary); color: #fff; }
.btn--primary:hover { background: color-mix(in srgb, var(--color-primary) 85%, black); }
.btn--secondary { background: transparent; border-color: var(--color-border); color: var(--color-text); }
.btn--secondary:hover { border-color: var(--color-primary); color: var(--color-primary); }
.btn--ghost { background: transparent; color: var(--color-primary); height: auto; padding: var(--space-1) var(--space-2); }

/* Header / Nav */
.site-header { background: var(--color-surface); border-bottom: 1px solid var(--color-border); position: sticky; top: 0; z-index: 40; box-shadow: 0 1px 3px rgba(20,24,30,0.04); }
.site-header__inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; gap: var(--space-6); padding: var(--space-4) var(--space-5); min-height: 72px; }
.site-header__logo { font-weight: 800; font-size: 24px; letter-spacing: -0.01em; color: var(--color-primary); display: flex; align-items: center; flex-shrink: 0; }
.site-header__logo-img { max-height: 48px; width: auto; display: block; }
.site-header__nav { display: flex; align-items: center; gap: var(--space-2); flex: 1; }
.site-header__nav a {
  color: var(--color-text);
  font-weight: 600;
  font-size: 15px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.site-header__nav a:hover { background: var(--color-bg-alt); color: var(--color-primary); }
.site-header__menu-toggle { display: none; background: none; border: none; font-size: 22px; cursor: pointer; }

@media (max-width: 768px) {
  .site-header__nav { display: none; }
  .site-header__nav--open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
    padding: var(--space-3) var(--space-4);
    gap: 2px;
  }
  .site-header__nav--open a { padding: 12px 14px; }
  .site-header__menu-toggle { display: block; }
  .site-header__inner { min-height: 60px; position: relative; }
  .site-header__logo { font-size: 20px; }
  .site-header__logo-img { max-height: 38px; }
}

/* Search box */
.search-box { display: flex; gap: var(--space-2); }
.search-box__label { position: absolute; left: -9999px; }
.search-box__input {
  height: 44px; padding: 0 var(--space-4); border-radius: var(--radius-md);
  border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text);
  min-width: 220px;
}
.search-box__submit { height: 44px; padding: 0 var(--space-4); border-radius: var(--radius-md); border: none; background: var(--color-primary); color: #fff; cursor: pointer; }
.search-box--compact { max-width: 280px; }

/* Alternating section background — breaks up long stretches of plain white */
.section--alt { background: var(--color-bg-alt); }

/* Breadcrumb navigation (tool/guide/category pages) */
.breadcrumb-nav {
  font-size: var(--text-small);
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}
.breadcrumb-nav a { color: var(--color-text-muted); font-weight: 500; }
.breadcrumb-nav a:hover { color: var(--color-primary); text-decoration: underline; }

/* Tool page header + widget card + content sections */
.tool-page__icon { font-size: 32px; margin-right: 4px; }
.tool-page__lede { font-size: 17px; color: var(--color-text-muted); max-width: 640px; }

.tool-interface, .tool-box {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin: var(--space-4) 0;
  box-shadow: var(--shadow-sm);
}

.tool-section {
  margin-top: var(--space-5);
  padding: var(--space-4) var(--space-5);
  background: var(--color-bg-alt);
  border-radius: var(--radius-lg);
}
.tool-section h2 { font-size: 19px; margin-bottom: var(--space-2); }
.tool-section p { color: var(--color-text); margin-bottom: 0; }

/* Generic styling for bare form controls used inside tool widgets (they
   don't go through .form-group, since each tool's markup is minimal) —
   this single rule upgrades the look of every tool's inputs/selects at once. */
.tool-interface input[type="text"],
.tool-interface input[type="number"],
.tool-interface input[type="email"],
.tool-interface input[type="password"],
.tool-interface input[type="search"],
.tool-interface input[type="tel"],
.tool-interface input[type="url"],
.tool-interface input[type="date"],
.tool-interface select,
.tool-interface textarea,
.tool-box input[type="text"],
.tool-box input[type="number"],
.tool-box input[type="email"],
.tool-box input[type="search"],
.tool-box input[type="date"],
.tool-box select,
.tool-box textarea {
  height: 44px;
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: var(--text-body);
  font-family: var(--font-sans);
}
.tool-interface textarea, .tool-box textarea { height: auto; padding: var(--space-3); min-height: 120px; }
.tool-interface input:focus, .tool-interface select:focus, .tool-interface textarea:focus,
.tool-box input:focus, .tool-box select:focus, .tool-box textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 15%, transparent);
}
.tool-interface button, .tool-box button {
  height: 44px;
  padding: 0 var(--space-5);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.tool-interface button:hover, .tool-box button:hover { background: color-mix(in srgb, var(--color-primary) 85%, black); }

.related-section, .faq { margin-top: var(--space-6); }

/* Cards */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-4); }
.card {
  display: flex; flex-direction: column; gap: var(--space-2);
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); padding: var(--space-4);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
  color: var(--color-text);
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); text-decoration: none; }
.card__icon { font-size: 28px; }
.card__icon.card__icon--badge {
  display: flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; font-size: 26px;
  line-height: 1;
  border-radius: 50%;
  background: linear-gradient(135deg, color-mix(in srgb, var(--color-primary) 16%, transparent), color-mix(in srgb, var(--color-secondary) 16%, transparent));
  flex-shrink: 0;
}
.card--category { align-items: center; text-align: center; }
.card--category:hover .card__icon--badge { transform: scale(1.08); }
.card__title { font-weight: 700; font-size: 16px; }
.card__desc { color: var(--color-text-muted); font-size: var(--text-small); }
.card__cta { color: var(--color-primary); font-weight: 600; font-size: var(--text-small); margin-top: auto; }
.card__image { border-radius: var(--radius-md); margin-bottom: var(--space-2); }
.card__category { font-size: var(--text-small); color: var(--color-secondary); font-weight: 600; }
.card__meta { font-size: var(--text-small); color: var(--color-text-muted); }

/* Forms */
.form-group { margin-bottom: var(--space-4); }
.form-group label { display: block; font-weight: 600; margin-bottom: var(--space-1); }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  background: var(--color-surface); color: var(--color-text); font-size: var(--text-body);
}

/* Alerts */
.alert { padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); margin-bottom: var(--space-4); font-size: var(--text-small); }
.alert--success { background: color-mix(in srgb, var(--color-success) 12%, white); color: var(--color-success); }
.alert--warning { background: color-mix(in srgb, var(--color-warning) 12%, white); color: var(--color-warning); }
.alert--error   { background: color-mix(in srgb, var(--color-error) 12%, white); color: var(--color-error); }
.alert--info    { background: color-mix(in srgb, var(--color-primary) 8%, white); color: var(--color-primary); }

/* FAQ */
.faq__item { border-bottom: 1px solid var(--color-border); padding: var(--space-3) 0; }
.faq__question { cursor: pointer; font-weight: 600; }
.faq__answer { color: var(--color-text-muted); margin-top: var(--space-2); }

/* Ad slots */
.ad-slot { margin: var(--space-5) 0; text-align: center; }

/* Modal */
.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal__panel { background: var(--color-surface); border-radius: var(--radius-lg); padding: var(--space-6); max-width: 480px; width: 90%; position: relative; }
.modal__close { position: absolute; top: var(--space-3); right: var(--space-3); background: none; border: none; font-size: 22px; cursor: pointer; }

/* Footer */
.site-footer { background: var(--color-surface); border-top: 1px solid var(--color-border); margin-top: var(--space-8); }
.site-footer__inner { max-width: 1200px; margin: 0 auto; padding: var(--space-6) var(--space-4); text-align: center; }
.site-footer__links { display: flex; gap: var(--space-4); justify-content: center; flex-wrap: wrap; margin: var(--space-4) 0; }
.site-footer__copyright { color: var(--color-text-muted); font-size: var(--text-small); }

/* Pagination */
.pagination { display: flex; gap: var(--space-2); justify-content: center; margin: var(--space-6) 0; }
.pagination__link { padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); border: 1px solid var(--color-border); }
.pagination__link--current { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* Homepage hero — premium gradient band, kept subtle (no loud colors) */
.hero {
  background: linear-gradient(135deg, var(--color-primary) 0%, color-mix(in srgb, var(--color-primary) 70%, var(--color-secondary)) 100%);
  color: #fff;
  padding: var(--space-8) 0 var(--space-7);
  text-align: center;
  min-height: 460px;
  display: flex;
  align-items: center;
}
.hero > .container { width: 100%; }
.hero h1 { color: #fff; font-size: 38px; line-height: 1.2; margin-bottom: var(--space-3); }
.hero p.hero__subtitle { color: rgba(255,255,255,0.9); font-size: 18px; max-width: 560px; margin: 0 auto var(--space-5); }
.hero .search-box { max-width: 680px; margin: 0 auto; box-shadow: var(--shadow-md); border-radius: var(--radius-lg); }
.hero .search-box__input { border: none; flex: 1; height: 58px; font-size: 17px; padding: 0 var(--space-5); }
.hero .search-box__submit { height: 58px; padding: 0 var(--space-6); font-size: 17px; border-radius: 0 var(--radius-lg) var(--radius-lg) 0; }
.hero__chips { margin-top: var(--space-4); display: flex; gap: var(--space-2); justify-content: center; flex-wrap: wrap; }
.hero__chips a { background: rgba(255,255,255,0.15); color: #fff; padding: 6px 14px; border-radius: 999px; font-size: 13px; text-decoration: none; }
.hero__chips a:hover { background: rgba(255,255,255,0.28); }

@media (max-width: 480px) {
  .hero h1 { font-size: 26px; }
  .hero { padding: var(--space-6) 0 var(--space-5); }
}

/* Stats bar — trust signals under the hero */
.stats-bar { display: flex; justify-content: center; gap: var(--space-8); flex-wrap: wrap; padding: var(--space-5) 0; background: var(--color-surface); border-bottom: 1px solid var(--color-border); }
.stats-bar__item { text-align: center; }
.stats-bar__num { font-size: 28px; font-weight: 800; color: var(--color-primary); display: block; }
.stats-bar__label { font-size: var(--text-small); color: var(--color-text-muted); }

/* Section heading with an accent underline */
.section-heading { text-align: center; margin-bottom: var(--space-5); }
.section-heading h2 { display: inline-block; position: relative; padding-bottom: var(--space-2); }
.section-heading h2::after { content: ""; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: 48px; height: 3px; background: var(--color-secondary); border-radius: 2px; }
.section-heading p { color: var(--color-text-muted); max-width: 560px; margin: 0 auto; }

/* Newsletter box */
.newsletter-box { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: var(--space-6); text-align: center; max-width: 480px; margin: 0 auto; }
.newsletter-box form { display: flex; gap: var(--space-2); margin-top: var(--space-3); }
.newsletter-box input[type="email"] { flex: 1; height: 44px; padding: 0 var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-md); }

/* ---------------------------------------------------------------------
   Animated, eye-catching polish (Phase 12) — kept tasteful: short
   durations, subtle motion, no flashing or scroll-jacking.
   --------------------------------------------------------------------- */

/* Scroll-reveal */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.reveal--visible { opacity: 1; transform: translateY(0); }

/* Animated gradient hero — slow, subtle shift, not distracting */
.hero {
  background: linear-gradient(120deg,
    var(--color-primary) 0%,
    color-mix(in srgb, var(--color-primary) 60%, var(--color-secondary)) 50%,
    var(--color-secondary) 100%);
  background-size: 200% 200%;
  animation: heroGradientShift 12s ease infinite;
  position: relative;
  overflow: hidden;
}
@keyframes heroGradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
/* Soft decorative blobs behind the hero content — pure CSS, no images */
.hero::before, .hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  z-index: 0;
}
.hero::before { width: 260px; height: 260px; top: -80px; left: -60px; }
.hero::after { width: 200px; height: 200px; bottom: -70px; right: -40px; }
.hero .container { position: relative; z-index: 1; }

/* Card hover: lift + subtle glow, smoother than the base card transition */
.card {
  transition: box-shadow var(--transition-base), transform var(--transition-base), border-color var(--transition-base);
}
.card:hover {
  box-shadow: 0 10px 24px rgba(31,58,95,0.14);
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--color-primary) 30%, var(--color-border));
}

/* Button ripple */
.btn { position: relative; overflow: hidden; }
.btn__ripple {
  position: absolute;
  width: 10px; height: 10px;
  background: rgba(255,255,255,0.6);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  animation: btnRipple 0.6s ease-out;
  pointer-events: none;
}
@keyframes btnRipple {
  to { transform: translate(-50%, -50%) scale(18); opacity: 0; }
}

/* Stats bar numbers get a little emphasis on their reveal */
.stats-bar__num { transition: color var(--transition-base); }

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  .reveal, .hero, .card, .btn__ripple { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* Dark-mode toggle button */
.theme-toggle {
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  width: 40px; height: 40px;
  font-size: 16px;
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast);
}
.theme-toggle:hover { background: var(--color-bg); transform: rotate(15deg); }

/* ---------------------------------------------------------------------
   Hero illustration + floating animations (Phase 13 — images & motion)
   --------------------------------------------------------------------- */

.hero__media {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
  opacity: 0.28;
}
.hero-illustration { width: 640px; max-width: 90%; height: auto; display: block; }

@media (max-width: 768px) {
  .hero__media { opacity: 0.16; }
}

@keyframes floatSlow {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-10px) rotate(6deg); }
}
@keyframes floatMedium {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}
@keyframes floatFast {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(-4deg); }
}
@keyframes twinkle {
  0%, 100% { opacity: 0.3; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.15); }
}

.float-slow   { animation: floatSlow 6s ease-in-out infinite; }
.float-medium { animation: floatMedium 4.5s ease-in-out infinite; }
.float-fast   { animation: floatFast 3.5s ease-in-out infinite; }
.twinkle      { animation: twinkle 2.2s ease-in-out infinite; }

/* Category & tool card icons get a small lift + wiggle on hover — playful
   but brief, not distracting while scrolling */
.card__icon { display: inline-block; transition: transform 0.3s ease; }
.card:hover .card__icon { transform: translateY(-3px) rotate(-6deg) scale(1.1); }

/* ---------------------------------------------------------------------
   Basic content-copy deterrents (Phase 21 — anti-scraping, casual copy)
   Scoped ONLY to published article/guide bodies — never applied to tool
   inputs/outputs or forms, since users legitimately need to select and
   copy tool results (passwords, converted text, etc.). This raises the
   bar for casual copy-paste; it is not, and cannot be, a real barrier —
   view-source and browser dev tools always see the full page HTML.
   --------------------------------------------------------------------- */
.guide-content {
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
}
.guide-content img { pointer-events: none; } /* blocks easy drag-to-save */

/* Empty-state illustration (404, no search results) */
.empty-state-illustration { width: 220px; height: auto; margin: 0 auto var(--space-4); display: block; }

.error-page {
  max-width: 560px;
  margin: 0 auto;
  padding: 64px 24px 80px;
  text-align: center;
}
.error-page h1 { margin-bottom: 8px; }
.error-page p { color: var(--color-text-muted, #6b7280); margin-bottom: 24px; }
.error-page__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: 32px;
}

@media (prefers-reduced-motion: reduce) {
  .float-slow, .float-medium, .float-fast, .twinkle { animation: none !important; }
}
