/* =========================================================
   A-Z Super Utility - premium glass UI, dark/light, mobile-first
   ========================================================= */

:root {
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-tamil: "Meera Inimai", sans-serif;

  --display-xl: 56px; --display-xl-weight: 700; --display-xl-tracking: -0.02em;
  --display-lg: 44px; --display-lg-weight: 700; --display-lg-tracking: -0.02em;
  --display-md: 36px; --display-md-weight: 600; --display-md-tracking: -0.02em;

  --h1: 28px; --h1-weight: 700; --h1-tracking: -0.01em;
  --h2: 22px; --h2-weight: 600; --h2-tracking: -0.01em;
  --h3: 18px; --h3-weight: 500; --h3-tracking: -0.01em;
  --h4: 16px; --h4-weight: 600; --h4-tracking:  0.08em;
  --h5: 14px; --h5-weight: 600; --h5-tracking:  0.08em;
  --h6: 12px; --h6-weight: 500; --h6-tracking:  0.10em;

  --body-lg: 16px; --body-lg-weight: 400;
  --body-md: 15px; --body-md-weight: 400;
  --body-sm: 13px; --body-sm-weight: 400;
  --caption:  11px; --caption-weight: 300;
  --mono:     14px; --mono-weight:    400;

  --brand: #0f172a;
  --brand-2: #f97316;
  --brand-3: #fbbf24;

  --chart-1: #10b981;
  --chart-2: #f59e0b;

  --bg: #f8fafc;
  --bg-grad: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  --surface: #ffffff;
  --surface-2: #ffffffcc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-muted: #64748b;
  --shadow-sm: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow-md: 0 10px 25px -12px rgba(15,23,42,.12), 0 4px 10px -6px rgba(15,23,42,.06);
  --shadow-lg: 0 20px 40px -16px rgba(15,23,42,.15);
  --glass-bg: rgba(255,255,255,0.65);
  --glass-border: rgba(255,255,255,0.6);
  --radius: 16px;
  --radius-sm: 10px;
}

html[data-bs-theme="dark"] {
  --bg: #0c0f17;
  --bg-grad: linear-gradient(180deg, #0c0f17 0%, #131722 100%);
  --surface: #1a1f2e;
  --surface-2: rgba(26,31,46,0.7);
  --border: #4a5168;
  --border-strong: #5a6180;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --brand: #f1f5f9;
  --glass-bg: rgba(26,31,46,0.55);
  --glass-border: rgba(255,255,255,0.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.2);
  --shadow-md: 0 10px 30px rgba(0,0,0,.35), 0 4px 10px rgba(0,0,0,.2);
  --shadow-lg: 0 20px 45px rgba(0,0,0,.45);
  --chart-1: #34d399;
  --chart-2: #fbbf24;
}

* { -webkit-tap-highlight-color: transparent; }
html, body { background: var(--bg); color: var(--text); }
body {
  font-family: var(--font-primary);
  -webkit-font-smoothing: antialiased;
  background-image: var(--bg-grad);
  background-attachment: fixed;
  min-height: 100vh;
  padding-bottom: 110px;
  font-size: var(--body-md);
  font-weight: var(--body-md-weight);
  line-height: 1.55;
}
@media (min-width: 992px) {
  body { padding-bottom: 24px; }
}
body :lang(ta), .ta, .tamil { font-family: var(--font-tamil); }

/* Typography scale */
h1 { font-size: var(--h1); font-weight: var(--h1-weight); letter-spacing: var(--h1-tracking); }
h2 { font-size: var(--h2); font-weight: var(--h2-weight); letter-spacing: var(--h2-tracking); }
h3 { font-size: var(--h3); font-weight: var(--h3-weight); letter-spacing: var(--h3-tracking); }
h4 { font-size: var(--h4); font-weight: var(--h4-weight); letter-spacing: var(--h4-tracking); }
h5 { font-size: var(--h5); font-weight: var(--h5-weight); letter-spacing: var(--h5-tracking); }
h6 { font-size: var(--h6); font-weight: var(--h6-weight); letter-spacing: var(--h6-tracking); }
.display, .brand-name { font-family: var(--font-primary); letter-spacing: -0.01em; }

a { transition: color .15s ease; color: var(--brand-2); }
a:hover { color: #d4620e; }

/* ======================= Layout ======================= */
.app-main > .container,
.app-main > .container-fluid {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}
.app-main { padding-top: 12px; }

/* ======================= Header ======================= */
.app-header {
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  background: var(--glass-bg);
  border-bottom: 1px solid var(--glass-border);
  transition: padding .2s ease, box-shadow .2s ease;
  z-index: 1030;
}
.app-header.shrink { box-shadow: var(--shadow-md); }
.app-header .navbar { padding: .55rem 0; }
.brand-logo {
  width: 36px; height: 36px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-3));
  color: #fff; font-size: 18px;
  box-shadow: 0 6px 14px rgba(17,17,17,.2);
}
.brand-text { display: flex; gap: 4px; align-items: baseline; }
.brand-name { font-weight: 700; color: var(--text); font-size: var(--h4); letter-spacing: var(--h4-tracking); }
.brand-dot  { color: var(--brand); font-weight: 700; }
.brand-sub  { color: var(--text-muted); font-size: var(--body-sm); }
.btn-rounded { border-radius: 14px; padding: .55rem 1rem; font-weight:600; min-height: 46px; }

/* ======================= Search ======================= */
.search-wrap { max-width: 720px; }
.search-box { position: relative; }
.search-input {
  height: 46px; border-radius: 14px; padding-left: 44px; padding-right: 44px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); box-shadow: var(--shadow-sm);
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { box-shadow: 0 0 0 4px hsla(20,100%,54%,.2); border-color: var(--brand); }
.search-icon { position:absolute; left:14px; top:50%; transform: translateY(-50%); color: var(--text-muted); }
.search-kbd {
  position:absolute; right:12px; top:50%; transform: translateY(-50%);
  font-size:.75rem; background: var(--border); color: var(--text-muted);
  padding: 2px 8px; border-radius: 6px;
}
.search-suggest {
  position:absolute; left:0; right:0; top: calc(100% + 8px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-md);
  overflow: hidden; display: none; max-height: 60vh; overflow-y: auto; z-index: 1050;
}
.search-suggest.show { display: block; }
.suggest-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; cursor: pointer; color: var(--text); }
.suggest-item:hover, .suggest-item.active { background: rgba(17,17,17,.06); }
.suggest-item .si-ic { width: 34px; height: 34px; border-radius: 10px; display:inline-flex; align-items:center; justify-content:center; color:#fff; font-size: 16px; flex-shrink:0;}
.suggest-item small { color: var(--text-muted); }
.suggest-item mark { background: hsla(20,100%,54%,.15); color: inherit; padding: 0 2px; border-radius: 4px;}
.suggest-empty { padding: 14px; color: var(--text-muted); text-align: center; }

/* ======================= Page header ======================= */
.page-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 0 8px;
}
.page-header h1 {
  font-size: var(--h2); font-weight: var(--h2-weight); margin: 0;
  display: flex; align-items: center; gap: 10px;
}
.page-header h1 i { font-size: 1.3rem; }
.page-desc {
  color: var(--text-muted); font-size: var(--body-lg);
  margin-bottom: 18px; line-height: 1.5;
}

/* ======================= Cards ======================= */
.card-soft {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color .25s ease, box-shadow .35s ease;
}
.card-soft:hover { border-color: var(--border-strong); }
.card-soft .card-body { padding: 20px; }
.card-soft .card-title { font-weight: var(--h4-weight); font-size: var(--h4); color: var(--text); margin-bottom: 0.5rem; }

/* ======================= Tool grid + cards ======================= */
.tool-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 576px) { .tool-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 768px) { .tool-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; } }
@media (min-width: 992px) { .tool-grid { grid-template-columns: repeat(6, 1fr); } }

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 16px 18px;
  text-align: left;
  color: var(--text);
  text-decoration: none;
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
  transition: transform .15s ease, box-shadow .25s ease, border-color .2s ease;
  position: relative; overflow: hidden;
  animation: fadeSlideIn .4s ease both;
}
.tool-card:nth-child(2) { animation-delay: .04s; }
.tool-card:nth-child(3) { animation-delay: .08s; }
.tool-card:nth-child(4) { animation-delay: .12s; }
.tool-card:nth-child(5) { animation-delay: .16s; }
.tool-card:nth-child(6) { animation-delay: .2s; }
.tool-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: hsla(20,100%,54%,.3); color: var(--text);}
.tool-card .tc-icon {
  width: 46px; height: 46px; border-radius: 13px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 21px;
  box-shadow: 0 6px 14px rgba(0,0,0,.10);
}
.tool-card .tc-name { font-weight: var(--body-lg-weight); font-size: var(--body-lg); line-height: 1.2; }
.tool-card .tc-sub,
.tool-card .tc-desc,
.tool-card .tc-purpose {
  font-size: var(--body-sm); color: var(--text-muted); line-height: 1.35; margin-top: 2px;
}
.tool-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(var(--brand), var(--brand-3));
  opacity: 0; transition: opacity .2s ease;
}
.tool-card:hover::before { opacity: 1; }

/* ======================= Hero ======================= */
.hero {
  position: relative; border-radius: 24px;
  padding: 28px 24px;
  background: linear-gradient(135deg, var(--brand-3), #ffe680);
  color: var(--text); overflow: hidden;
  box-shadow: 0 18px 40px -12px hsla(20,100%,54%,.3);
}
.hero-alt {
  background: linear-gradient(135deg, var(--brand), rgba(99,102,241,.85));
  color: #fff;
  box-shadow: 0 18px 40px -12px rgba(99,102,241,.5);
}
.hero-alt h1 { color: #fff; }
.hero-alt p { color: rgba(255,255,255,.9); }
.hero-alt .btn-light {
  background: rgba(255,255,255,.15);
  color: #fff; border: 1px solid rgba(255,255,255,.2);
}
.hero-alt .btn-light:hover { background: rgba(255,255,255,.25); color: #fff; }
.hero-alt .btn-outline-light {
  border-color: rgba(255,255,255,.35);
  color: #fff;
}
.hero-alt .btn-outline-light:hover { background: rgba(255,255,255,.15); color: #fff; }
.hero h1 { font-weight: var(--display-lg-weight); font-size: var(--display-lg); letter-spacing: var(--display-lg-tracking); margin-bottom: 6px; }
.hero p { opacity: .9; margin: 0; font-size: var(--body-lg); }
.hero .hero-cta { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.hero .hero-cta .btn { border-radius: 14px; }
.hero::after {
  content: ""; position:absolute; right:-60px; top:-60px; width: 220px; height: 220px;
  background: radial-gradient(closest-side, hsla(20,100%,54%,.15), transparent);
  border-radius: 50%;
}
.hero::before {
  content:""; position:absolute; left:-40px; bottom:-60px; width: 180px; height:180px;
  background: radial-gradient(closest-side, hsla(20,100%,54%,.1), transparent);
  border-radius: 50%;
}

/* ======================= Category / feature chips ======================= */
.cat-row { display: flex; gap: 10px; overflow-x: auto; padding: 6px 2px 12px; scrollbar-width: none;}
.cat-row::-webkit-scrollbar{display:none}
.cat-chip {
  flex-shrink: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 8px 14px; display: inline-flex; align-items: center; gap: 8px;
  color: var(--text); font-weight: 500; font-size: var(--body-sm); text-decoration: none;
}
.cat-chip i { color: var(--brand); }
.cat-chip:hover { border-color: var(--brand); color: var(--text); }

.feat-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 12px; scrollbar-width: none; flex-wrap: wrap; }
.feat-row::-webkit-scrollbar{display:none}
.feat-chip {
  flex-shrink: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 12px; display: inline-flex; align-items: center; gap: 6px;
  color: var(--text); font-weight: 400; font-size: var(--caption); text-decoration: none;
}
.feat-chip i { font-size: .75rem; opacity: .7; }
.feat-chip:hover { border-color: var(--brand); color: var(--text); }
.feat-chip.border-primary { border-color: var(--brand) !important; background: hsla(20,100%,54%,.08); }

/* ======================= Kural widget ======================= */
.kural-card {
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(220,38,38,.95), rgba(245,158,11,.9));
  color: #fff; padding: 22px; box-shadow: var(--shadow-md);
  position: relative; overflow: hidden;
}
.kural-card .kc-label { font-size:.8rem; opacity:.9; letter-spacing:.06em; text-transform: uppercase; }
.kural-card .kc-text  { font-family: var(--font-tamil); white-space: pre-line; font-size: 1.05rem; line-height: 1.55; margin: 8px 0 10px; }
.kural-card .kc-en    { font-size: .9rem; opacity: .95; }
.kural-card .kc-meta  { font-size: .78rem; opacity: .85; margin-top: 10px; }

/* ======================= Section title ======================= */
.section-title {
  display:flex; align-items: baseline; justify-content: space-between;
  margin: 28px 0 14px;
}
.section-title h2 { font-size: var(--h3); font-weight: var(--h3-weight); margin: 0; letter-spacing: var(--h3-tracking); }
.section-title a { font-size: var(--body-sm); font-weight: 500; color: var(--brand-2); }
.section-title a:hover { text-decoration: underline; }

/* ======================= Buttons ======================= */
.btn {
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: all .2s ease;
  cursor: pointer;
  position: relative; overflow: hidden;
  white-space: nowrap;
  min-height: 46px;
  line-height: 1.4;
}
.btn:active { transform: scale(.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--brand-2), #fd8a3e);
  border: none;
  box-shadow: 0 4px 14px hsla(20,100%,54%,.2);
  color: #fff;
}
.btn-primary:hover {
  filter: brightness(1.05);
  box-shadow: 0 6px 20px hsla(20,100%,54%,.25);
  transform: translateY(-1px);
  color: #fff;
}
.btn-primary:active { filter: brightness(.94); transform: scale(.97); }

.btn-outline-primary {
  border: 1.5px solid var(--brand-2);
  color: var(--brand-2);
  background: transparent;
}
.btn-outline-primary:hover {
  background: var(--brand-2);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px hsla(20,100%,54%,.2);
}

.btn-outline-secondary {
  border: 1.5px solid var(--border);
  color: var(--text);
}
.btn-outline-secondary:hover {
  border-color: var(--brand-2);
  background: hsla(20,100%,54%,.08);
  transform: translateY(-1px);
}

.btn-light {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-light:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.btn-sm {
  min-height: 38px;
  font-size: .85rem;
  padding: .35rem .85rem;
}

.btn-ghost {
  background: transparent; border: none;
  color: var(--text-muted); padding: 8px 14px; border-radius: 12px;
  min-height: 46px;
}
.btn-ghost:hover { background: rgba(17,17,17,.06); color: var(--brand); }

.btn-group-pills .btn {
  border-radius: 999px !important;
  margin: 0 2px;
}

/* Ripple effect (via JS) */
.btn-ripple {
  position: absolute; border-radius: 50%;
  background: rgba(255,255,255,.35);
  transform: scale(0); animation: rippleAnim .5s ease-out;
  pointer-events: none;
}
@keyframes rippleAnim { to { transform: scale(4); opacity: 0; } }

/* ======================= Icon buttons ======================= */
.btn-icon {
  width: 46px; height: 46px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text);
  transition: all .2s ease;
  flex-shrink: 0; cursor: pointer;
}
.btn-icon:hover {
  border-color: var(--brand-2);
  color: var(--brand-2);
  transform: translateY(-1px);
}
.btn-icon:active { transform: scale(.92); }

.btn-icon-sm {
  width: 36px; height: 36px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text);
  transition: all .2s ease;
  flex-shrink: 0; font-size: .85rem; cursor: pointer;
}
.btn-icon-sm:hover {
  border-color: var(--brand-2);
  color: var(--brand-2);
  transform: translateY(-1px);
}
.btn-icon-sm:active { transform: scale(.92); }

/* ======================= Forms ======================= */
.form-control, .form-select {
  border: 1.5px solid #222;
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  font-size: var(--body-md);
  height: 48px;
  transition: border-color .2s ease, box-shadow .25s ease, background .2s ease;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand-2);
  background: var(--surface);
  box-shadow: 0 0 0 4px hsla(20,100%,54%,.1);
}
.form-control:hover:not(:focus):not(:disabled):not([readonly]),
.form-select:hover:not(:focus):not(:disabled) {
  border-color: var(--border-strong);
}
.form-control::placeholder { color: var(--text-muted); opacity: .55; }

textarea.form-control { min-height: 100px; resize: vertical; }
textarea.form-control:focus { min-height: 140px; }
textarea.form-control.auto-grow { overflow: hidden; resize: none; }

input[type="number"].form-control { -moz-appearance: textfield; }
input[type="number"].form-control::-webkit-inner-spin-button,
input[type="number"].form-control::-webkit-outer-spin-button {
  -webkit-appearance: none; margin: 0;
}

input[type="file"].form-control { padding: .38rem .7rem; cursor: pointer; }
input[type="file"].form-control::file-selector-button {
  border-radius: 8px; padding: .35rem .8rem; margin-right: .65rem;
  background: linear-gradient(135deg, var(--brand-2), #fd8a3e);
  border: none; color: #fff; font-weight: 600; font-size: .82rem;
  transition: filter .2s ease, transform .1s ease; cursor: pointer;
}
input[type="file"].form-control::file-selector-button:hover { filter: brightness(1.06); transform: translateY(-1px); }
input[type="file"].form-control::file-selector-button:active { transform: scale(.96); }

.form-control:disabled, .form-select:disabled { opacity: .55; cursor: not-allowed; }
.form-control[readonly] { background: rgba(17,17,17,.03); cursor: default; }

.form-label { font-weight: 600; font-size: var(--body-sm); margin-bottom: 6px; color: var(--text); }
.form-text { color: var(--text-muted); font-size: var(--body-sm); margin-top: 4px; }
.form-group { margin-bottom: 18px; }

.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .25s ease;
}
.form-card:focus-within { box-shadow: var(--shadow-md); }

.form-inline-enhanced .form-control,
.form-inline-enhanced .form-select {
  height: 44px;
}

/* Floating label */
.fl-input { position: relative; margin-bottom: 6px; }
.fl-input .form-control, .fl-input .form-select { height: 54px; padding-top: 22px; padding-bottom: 6px; }
.fl-input label {
  position: absolute; left: 14px; top: 16px;
  font-size: .82rem; color: var(--text-muted);
  pointer-events: none; transition: all .15s ease;
  background: transparent; padding: 0 4px; z-index: 1;
}
.fl-input .form-control:focus ~ label,
.fl-input .form-control:not(:placeholder-shown) ~ label,
.fl-input .form-select:focus ~ label,
.fl-input .form-select:has(option:not([value=""]):checked) ~ label {
  top: 5px; font-size: .68rem; color: var(--brand);
}

/* Glass input */
.form-glass {
  background: var(--glass-bg) !important;
  backdrop-filter: blur(8px);
  border-color: var(--glass-border) !important;
}

/* Input with icon */
.input-icon { position: relative; }
.input-icon i, .input-icon .bi {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 1.1rem; z-index: 2;
  transition: color .2s ease;
}
.input-icon:focus-within i, .input-icon:focus-within .bi { color: var(--brand); }
.input-icon .form-control { padding-left: 40px; }
.input-icon-suffix .form-control { padding-right: 40px; }
.input-icon-suffix i, .input-icon-suffix .bi {
  left: auto; right: 14px;
}

/* Checkbox & radio */
.form-check-input {
  width: 20px; height: 20px; margin-top: 0;
  border-color: var(--border); background: var(--surface);
  cursor: pointer; transition: all .15s ease;
}
.form-check-input:checked {
  background: var(--brand-2);
  border-color: var(--brand-2);
  box-shadow: 0 2px 8px hsla(20,100%,54%,.25);
}
.form-check-input:focus { box-shadow: 0 0 0 3px hsla(20,100%,54%,.2); }

/* Toggle switch */
.form-switch .form-check-input {
  width: 44px; height: 24px;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%2364748b'/%3e%3c/svg%3e");
  background-position: left center;
  transition: background-position .15s ease, background-color .2s ease;
}
.form-switch .form-check-input:checked {
  background-position: right center;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
}

/* Validation */
.form-control.is-valid, .form-select.is-valid {
  border-color: #22c55e;
  box-shadow: 0 0 0 4px rgba(34,197,94,.12);
}
.form-control.is-valid:focus {
  box-shadow: 0 0 0 4px rgba(34,197,94,.12), 0 4px 12px rgba(34,197,94,.08);
}
.form-control.is-invalid, .form-select.is-invalid {
  border-color: #ef4444;
  box-shadow: 0 0 0 4px rgba(239,68,68,.12);
}
.form-control.is-invalid:focus {
  box-shadow: 0 0 0 4px rgba(239,68,68,.12), 0 4px 12px rgba(239,68,68,.08);
}
.invalid-feedback, .valid-feedback { animation: fadeSlideIn .2s ease; }
.form-control.is-valid:not(:focus) { animation: validPulse .4s ease; }

/* Range slider */
input[type="range"].form-range {
  height: 6px;
  background: linear-gradient(90deg, var(--border), var(--brand-2));
  border-radius: 3px;
  outline: none;
  transition: background .2s ease;
  cursor: pointer;
}
input[type="range"].form-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px;
  background: linear-gradient(135deg, var(--brand-2), #fd8a3e);
  box-shadow: 0 2px 8px hsla(20,100%,54%,.25);
  cursor: pointer; border: 2px solid #fff; border-radius: 50%;
  transition: transform .15s ease;
}
input[type="range"].form-range::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type="range"].form-range::-moz-range-thumb {
  width: 22px; height: 22px;
  background: linear-gradient(135deg, var(--brand-2), #fd8a3e);
  border: 2px solid #fff; cursor: pointer; border-radius: 50%;
}

/* Input group */
.input-group .form-control:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group > .btn { border-radius: var(--radius-sm); }
.input-group > .btn:first-child { border-top-right-radius: var(--radius-sm); border-bottom-right-radius: 0; border-right: 0; }

/* Tag input */
.tag-input {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 6px 10px; min-height: 44px;
  cursor: text; transition: border-color .2s ease, box-shadow .2s ease;
}
.tag-input:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px hsla(20,100%,54%,.2); }
.tag-input .tag {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(17,17,17,.08); color: var(--brand);
  padding: 2px 10px; border-radius: 999px; font-size: .82rem;
}
.tag-input .tag .tag-close {
  cursor: pointer; font-size: 1.1rem; line-height: 1; opacity: .6;
}
.tag-input .tag .tag-close:hover { opacity: 1; }
.tag-input input {
  border: none; outline: none; background: transparent;
  flex: 1; min-width: 80px; color: var(--text); padding: 4px 0;
}

/* ======================= Animations ======================= */
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes validPulse {
  0% { box-shadow: 0 0 0 0 rgba(34,197,94,.3); }
  100% { box-shadow: 0 0 0 12px rgba(34,197,94,0); }
}
@keyframes skel { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

.form-reveal { animation: fadeSlideIn .35s ease both; }
.form-reveal-delay-1 { animation-delay: .05s; }
.form-reveal-delay-2 { animation-delay: .1s; }
.form-reveal-delay-3 { animation-delay: .15s; }

/* ======================= Nav pills ======================= */
.nav-pills .nav-link {
  border-radius: 999px; padding: .5rem 1rem; font-weight: 500;
  transition: all .2s ease; color: var(--text-muted);
}
.nav-pills .nav-link:hover { color: var(--text); background: hsla(0,0%,0%,.03); }
.nav-pills .nav-link.active {
  background: linear-gradient(135deg, var(--brand-2), #fd8a3e);
  color: #fff;
  box-shadow: 0 4px 14px hsla(20,100%,54%,.2);
}

/* ======================= Tables ======================= */
.table { color: var(--text); font-size: var(--body-md); }
.table > :not(caption) > * > * { background: transparent; border-bottom-color: var(--border); padding: .7rem .5rem; }
.table thead th { font-weight: 600; color: var(--text-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }

/* ======================= Badge / Progress / Accordion / Dropdown / Modal / Tooltip / List group ======================= */
.badge { border-radius: 8px; font-weight: 600; padding: .3em .65em; font-size: var(--body-sm); }
.progress { border-radius: 999px; height: 8px; background: var(--border); }
.progress-bar { background: linear-gradient(135deg, var(--brand-2), var(--brand-3)); border-radius: 999px; }

.accordion-button:not(.collapsed) { background: hsla(20,100%,54%,.04); color: var(--brand-2); box-shadow: none; }
.accordion-button:focus { box-shadow: 0 0 0 4px hsla(20,100%,54%,.1); }
.accordion-item { border-radius: var(--radius-sm) !important; overflow: hidden; border-color: var(--border); }

.dropdown-menu {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  padding: 6px;
}
.dropdown-item {
  border-radius: 8px; padding: .5rem .85rem;
  font-size: var(--body-md); transition: background .15s ease;
}
.dropdown-item:hover, .dropdown-item.active { background: hsla(20,100%,54%,.08); }
.dropdown-item.active { color: var(--brand-2); font-weight: 600; }

.modal-content { border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.modal-header { border-bottom: 1px solid var(--border); padding: 1rem 1.25rem; }
.modal-footer { border-top: 1px solid var(--border); padding: 1rem 1.25rem; }

.tooltip-inner {
  border-radius: 8px; padding: .4rem .8rem; font-size: var(--body-sm);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.bs-tooltip-auto[data-popper-placement^=top] .tooltip-arrow::before { border-top-color: var(--border); }

.list-group-item { background: transparent; color: var(--text); border-color: var(--border); }
.list-group-item:hover { background: hsla(0,0%,0%,.02); }

/* ======================= Weather ======================= */
.wx-now { display:flex; align-items:center; gap:16px; }
.wx-temp { font-size: var(--display-xl); font-weight: var(--display-xl-weight); line-height: 1; }
.wx-meta { color: var(--text-muted); font-size: var(--body-lg); }

/* ======================= Calendar today badge ======================= */
.today-badge {
  background: var(--brand); color: #fff; border-radius: 50%;
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.cal-today {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  background: var(--brand); color: #fff;
  border-radius: 50%; font-weight: 700; font-size: .85rem;
}

/* ======================= Skeleton ======================= */
.skel {
  background: linear-gradient(90deg, var(--border) 25%, hsla(0,0%,0%,.02) 50%, var(--border) 75%);
  background-size: 200% 100%; animation: skel 1.4s linear infinite; border-radius: 8px;
}

/* ======================= Misc utilities ======================= */
.text-muted { color: var(--text-muted) !important; }
.text-pink { color: #ec4899 !important; }
.text-sky { color: #0ea5e9 !important; }
.kbd-tip { font-size:.75rem; color: var(--text-muted); }
.copy-input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.spinner-border { border-width: .18em; }
.line-clamp-2 {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; line-height: 1.4; max-height: 2.8em;
}
.no-scrollbar { scrollbar-width: none; }
.no-scrollbar::-webkit-scrollbar { display: none; }

hr, .divider {
  border: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: 24px 0;
}

.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: var(--radius);
}

.display-1,.display-2,.display-3,.display-4,.display-5,.display-6 { font-weight: 700; letter-spacing: -.02em; }
.fs-large { font-size: var(--display-md); font-weight: var(--display-md-weight); line-height: 1.1; }

/* Skeleton height variants */
.skel-h-xs { height: 60px; }
.skel-h-64 { height: 64px; }
.skel-h-80 { height: 80px; }
.skel-h-sm { height: 100px; }
.skel-h-120 { height: 120px; }
.skel-h-140 { height: 140px; }
.skel-h-md { height: 160px; }
.skel-h-lg { height: 200px; }
.skel-h-xl { height: 240px; }
.skel-h-2xl { height: 300px; }

/* Reusable component patterns */
.pre-block {
  white-space: pre-wrap; font-family: inherit;
  background: var(--surface); padding: 16px;
  border-radius: 12px; border: 1px solid var(--border);
}
.code-preview {
  background: var(--surface); padding: 12px;
  border-radius: 8px; border: 1px solid var(--border);
  white-space: pre-wrap;
}
.map-frame { width: 100%; height: 380px; border: 0; border-radius: 14px; margin-top: 14px; }
.map-frame-sm { width: 100%; height: 260px; border: 0; border-radius: 12px; }
.chat-box { height: 400px; overflow-y: auto; background: var(--surface); }
.pre-line { white-space: pre-line; }
.autocomplete-dropdown {
  z-index:1050; display:none; max-height:250px; overflow-y:auto;
  position: absolute; width: 100%; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.autocomplete-dropdown.show { display: block; }
.table-wrap { max-height: 420px; overflow: auto; }
.mono-display { font-variant-numeric: tabular-nums; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }
.blink { animation: blink .8s step-end infinite; }
.preview-thumb { max-height: 250px; object-fit: cover; }

/* ======================= Bottom nav ======================= */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1040;
  background: var(--glass-bg); backdrop-filter: blur(16px);
  border-top: 1px solid var(--glass-border);
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.bn-item { display:flex; flex-direction:column; align-items:center; gap:2px; color: var(--text-muted); font-size: var(--caption); padding: 6px; text-decoration: none; border-radius: 12px;}
.bn-item i { font-size: 20px; }
.bn-item.active, .bn-item:hover { color: var(--brand); }
.bn-center i {
  background: linear-gradient(135deg, var(--brand), var(--brand-3)); color: #fff;
  width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items:center; justify-content:center;
  box-shadow: 0 8px 20px rgba(17,17,17,.2);
  font-size: 20px; margin-top: -16px;
}
.bn-center span { color: var(--text-muted); }

/* ======================= FAB ======================= */
.fab-ai {
  position: fixed; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 1041;
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-3), var(--brand-2));
  color: #fff; display: inline-flex; align-items:center; justify-content:center;
  box-shadow: 0 12px 28px hsla(20,100%,54%,.35);
  font-size: 22px; text-decoration: none;
  transition: transform .15s ease;
  touch-action: manipulation;
}
.fab-ai:hover { transform: scale(1.06); color: #fff; }
@media (min-width: 992px) { .fab-ai { bottom: 24px; } }

.fab-share {
  position: fixed; right: 16px; z-index: 1041;
  bottom: calc(146px + env(safe-area-inset-bottom));
  width: 56px; height: 56px; border-radius: 50%;
  border: none; color: #fff; font-size: 20px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 12px 28px rgba(17,17,17,.2);
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .15s ease;
  touch-action: manipulation;
}
.fab-share:hover { transform: scale(1.06); }
@media (min-width: 992px) { .fab-share { bottom: 90px; } }

/* ======================= Footer ======================= */
.app-footer { color: var(--text-muted); }

/* ======================= Drawer ======================= */
.drawer-list .list-group-item { background: transparent; color: var(--text); border-color: var(--border); }
.drawer-list .list-group-item:hover { background: rgba(17,17,17,.06); }

/* ======================= Scrollbar ======================= */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }

/* ======================= Focus / Selection ======================= */
:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; border-radius: 4px; }
::selection { background: hsla(20,100%,54%,.15); color: inherit; }

/* ======================= Air Datepicker overrides ======================= */
.air-datepicker { --adp-background-color: var(--surface); --adp-border-color: var(--border); --adp-color: var(--text); --adp-color-secondary: var(--text-muted); --adp-accent-color: var(--brand-2); --adp-color-current-date: var(--brand-2); --adp-color-other-month: var(--text-muted); --adp-color-disabled: var(--border); --adp-day-name-color: var(--text-muted); --adp-border-radius: 14px; --adp-border: 1px solid var(--border); box-shadow: var(--shadow-md) !important; border-radius: 14px !important; }
.air-datepicker-cell { border-radius: 10px !important; transition: .12s ease; }
.air-datepicker-cell.-selected- { background: var(--brand-2) !important; box-shadow: 0 4px 12px hsla(20,100%,54%,.25) !important; font-weight: 700; }
.air-datepicker-cell.-current- { color: var(--brand-2); font-weight: 700; }
.air-datepicker-cell.-selected-.-current- { color: #fff; }
.air-datepicker-cell:hover { background: hsla(20,100%,54%,.08) !important; }
.air-datepicker-nav { border-bottom: 1px solid var(--border); padding: 8px 12px; }
.air-datepicker-nav--title:hover { background: hsla(0,0%,0%,.04); border-radius: 8px; }
.air-datepicker-nav--action:hover { background: hsla(0,0%,0%,.04); border-radius: 8px; }
.air-datepicker-body--day-name { font-weight: 600; font-size: .78rem; }
.air-datepicker--content { padding: 8px 12px; }
.air-datepicker--pointer { display: none; }

/* ======================= Calculator UI ======================= */
#calcDisp {
  height: auto;
  max-width: 420px;
  margin: 0 auto 14px;
  padding: 16px 18px;
  font-size: clamp(1.8rem, 5.5vw, 2.4rem);
  font-weight: 600;
  text-align: right;
  letter-spacing: .5px;
  font-variant-numeric: tabular-nums;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
#calcDisp:focus { border-color: var(--border); box-shadow: var(--shadow-sm); }
#calcKeys {
  max-width: 420px;
  margin: 0 auto;
  gap: 10px !important;
}
#calcKeys .btn {
  min-height: 58px;
  padding: 0;
  border-radius: 14px;
  font-size: 1.2rem;
  font-weight: 600;
  border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
}
#calcKeys .btn-outline-secondary {
  background: var(--surface);
  color: var(--text);
}
#calcKeys .btn-outline-secondary:hover {
  background: rgba(17,17,17,.06);
  border-color: var(--brand);
  color: var(--brand);
}
#calcKeys .btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border: none;
  color: #fff;
}
#calcKeys .btn-primary:hover { filter: brightness(1.05); }

/* ======================= Dark mode overrides ======================= */
html[data-bs-theme="dark"] .form-glass {
  background: rgba(18,24,51,0.5) !important;
}
html[data-bs-theme="dark"] .tag-input .tag {
  background: rgba(255,255,255,.12);
}

/* ======================= Responsive - Mobile ======================= */
/* Prevent horizontal scroll */
body { overflow-x: hidden; }

/* Clamp hero decorative blurbs so they don't overflow on small screens */
.hero { overflow: hidden; }

@media (max-width: 576px) {
  .fl-input .form-control, .fl-input .form-select { height: 48px; }
  .fl-input label { top: 14px; font-size: .78rem; }
  .fl-input .form-control:focus ~ label,
  .fl-input .form-control:not(:placeholder-shown) ~ label,
  .fl-input .form-select:focus ~ label { top: 4px; font-size: .64rem; }
  .form-card { padding: 16px; }
  .card-soft .card-body { padding: 16px; }

  /* Scale down display sizes on mobile */
  h1 { font-size: 24px; }
  h2 { font-size: 20px; }
  h3 { font-size: 17px; }
  h5 { font-size: 13px; }

  /* Hero text reduction */
  .hero h1 { font-size: 30px; }
  .hero p { font-size: 14px; }
  .hero { padding: 24px 18px; border-radius: 18px; }

  /* Tighten section spacing */
  .section-title { margin: 22px 0 10px; }
  .section-title h2 { font-size: 17px; }

  /* Page header */
  .page-header { padding: 12px 0 6px; }

  /* Footer spacing */
  .app-footer.py-4 { padding-top: 1.25rem !important; padding-bottom: 1.25rem !important; }

  /* Bottom nav bigger touch targets */
  .bn-item { padding: 8px 4px; min-height: 48px; }

  /* Reduced gap on small screens */
  .tool-grid { gap: 10px; }

  /* Table horizontal scroll on mobile */
  .table-wrap { max-height: 300px; }

  /* Chat box smaller on mobile */
  .chat-box { height: 320px; }

  /* Map frames shorter on mobile */
  .map-frame { height: 260px; }
  .map-frame-sm { height: 200px; }

  /* SEO content tighter */
  .seo-content .row.g-2.mb-3 > .col-6 { width: 100%; }

  /* Trust shields 2-col on mobile */
  .seo-content .row.g-2.mb-3 > .col-md-3 { width: 50%; }

  /* Disable animation on mobile for perf / reduced motion */
  .tool-card { animation: none !important; opacity: 1 !important; transform: none !important; }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  }
}

@media (max-width: 480px) {
  .tool-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .tool-card { padding: 12px; }
  .tool-card .tc-icon { width: 40px; height: 40px; font-size: 18px; }

  /* Container padding tighter on narrow phones */
  .container, .container-fluid { padding-left: 12px !important; padding-right: 12px !important; }

  /* Hero reduction */
  .hero { padding: 20px 14px; }
  .hero h1 { font-size: 26px; }
  .hero-cta .btn { font-size: 13px; padding: .45rem .8rem; white-space: normal; }

  /* Bottom nav items */
  .bn-item i { font-size: 18px; }
  .bn-center i { width: 40px; height: 40px; font-size: 18px; margin-top: -14px; }
}

@media (max-width: 400px) {
  #calcKeys { gap: 8px !important; }
  #calcKeys .btn { min-height: 52px; font-size: 1.08rem; border-radius: 12px; }
  #calcDisp { font-size: 1.7rem; padding: 14px; }

  .hero h1 { font-size: 22px; }
  .hero p { font-size: 13px; }

  /* Single column cards on very small screens */
  .tool-grid { grid-template-columns: 1fr; }
}

/* AdSense - prevent layout shift */
.ad-slot { min-height: 90px; }

@media (max-width: 360px) {
  h1 { font-size: 21px; }
  h2 { font-size: 18px; }
  .hero h1 { font-size: 20px; }
  .hero { padding: 16px 12px; }
  .container, .container-fluid { padding-left: 10px !important; padding-right: 10px !important; }
  .bn-item span { font-size: 10px; }
}
