/*
Theme Name: CalcHub
Theme URI: https://calchub.com
Author: CalcHub Team
Author URI: https://calchub.com
Description: Modern dark calculator hub theme with 20+ fully working calculators, keyword search, and responsive design for all devices.
Version: 1.0.0
Requires at least: 5.5
Tested up to: 6.5
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: calchub
Tags: dark, calculator, responsive, custom-menu, custom-logo, featured-images, full-width-template
*/

/* =============================================
   CALCHUB WORDPRESS THEME - MAIN STYLESHEET
   ============================================= */

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

:root {
  --bg:        #0a0a0f;
  --surface:   #13131a;
  --surface2:  #1c1c27;
  --border:    #2a2a3a;
  --accent:    #6c63ff;
  --accent2:   #ff6584;
  --accent3:   #43e97b;
  --accent4:   #ffa94d;
  --text:      #f0f0ff;
  --muted:     #8888aa;
  --radius:    14px;
  --font-head: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --max-w:     1200px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { opacity: .85; }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }

/* =============================================
   SITE HEADER / NAVBAR
   ============================================= */

#site-header {
  position: sticky;
  top: 0;
  z-index: 900;
  background: rgba(10,10,15,.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

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

/* Logo */
.site-logo {
  font-family: var(--font-head);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -1px;
  background: linear-gradient(135deg, #fff 30%, #6c63ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}
.site-logo span {
  background: linear-gradient(135deg, #6c63ff, #ff6584);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Nav Menu */
#primary-navigation ul {
  display: flex;
  align-items: center;
  gap: 6px;
}
#primary-navigation ul li a {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 50px;
  transition: color .2s, background .2s;
}
#primary-navigation ul li a:hover,
#primary-navigation ul li.current-menu-item a {
  color: var(--text);
  background: var(--surface2);
}

/* Mobile hamburger */
.nav-toggle {
  display: none;
  background: none;
  border: 1.5px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 10px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

/* =============================================
   HERO SECTION
   ============================================= */

.ch-hero {
  text-align: center;
  padding: 72px 20px 48px;
  position: relative;
  overflow: hidden;
}

.ch-hero::before {
  content: '';
  position: absolute;
  top: -120px;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, rgba(108,99,255,.16) 0%, transparent 70%);
  pointer-events: none;
}

.ch-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(108,99,255,.15);
  border: 1px solid rgba(108,99,255,.3);
  border-radius: 50px;
  padding: 6px 16px;
  font-size: 12px;
  color: #a5a0ff;
  font-weight: 500;
  margin-bottom: 22px;
  letter-spacing: .4px;
}

.ch-hero-title {
  font-family: var(--font-head);
  font-size: clamp(36px, 8vw, 76px);
  font-weight: 800;
  letter-spacing: -2.5px;
  line-height: 1.05;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #ffffff 40%, #8b85ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.ch-hero-sub {
  color: var(--muted);
  font-size: clamp(15px, 2.5vw, 19px);
  max-width: 520px;
  margin: 0 auto 36px;
  font-weight: 300;
}

/* =============================================
   SEARCH BAR
   ============================================= */

.ch-search-wrap {
  max-width: 640px;
  margin: 0 auto;
  position: relative;
}

.ch-search-input {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 50px;
  padding: 17px 60px 17px 24px;
  font-size: 16px;
  color: var(--text);
  font-family: var(--font-body);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.ch-search-input::placeholder { color: var(--muted); }
.ch-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(108,99,255,.15);
}

.ch-search-icon {
  position: absolute;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  pointer-events: none;
}

.ch-search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  z-index: 200;
  display: none;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.ch-search-results.show { display: block; }

.sr-item {
  padding: 13px 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  transition: background .15s;
  border-bottom: 1px solid rgba(42,42,58,.5);
}
.sr-item:last-child { border-bottom: none; }
.sr-item:hover { background: var(--surface2); }
.sr-icon { font-size: 20px; width: 30px; text-align: center; }
.sr-cat {
  font-size: 11px;
  color: var(--muted);
  margin-left: auto;
  white-space: nowrap;
  background: var(--surface2);
  padding: 3px 9px;
  border-radius: 50px;
}
.sr-empty { padding: 20px; text-align: center; color: var(--muted); font-size: 14px; }

/* =============================================
   STATS BAR
   ============================================= */

.ch-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
  padding: 36px 20px 0;
}
.ch-stat {
  text-align: center;
}
.ch-stat-num {
  font-family: var(--font-head);
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
}
.ch-stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* =============================================
   CATEGORY NAV TABS
   ============================================= */

.ch-cat-nav {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 36px 20px 0;
}

.ch-cat-btn {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 50px;
  padding: 10px 22px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
  font-family: var(--font-body);
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.ch-cat-btn:hover,
.ch-cat-btn.active {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(108,99,255,.12);
}
.ch-cat-btn.active { color: #fff; }

/* =============================================
   MAIN CONTENT AREA
   ============================================= */

#ch-main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 40px 20px 80px;
}

/* Section headings */
.ch-section-title {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}
.ch-section-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Color accents per category */
.acc-financial .ch-section-dot { background: var(--accent3); }
.acc-health    .ch-section-dot { background: var(--accent2); }
.acc-math      .ch-section-dot { background: var(--accent); }
.acc-other     .ch-section-dot { background: var(--accent4); }

.acc-financial .calc-card:hover { border-color: var(--accent3); box-shadow: 0 8px 30px rgba(67,233,123,.12); }
.acc-health    .calc-card:hover { border-color: var(--accent2); box-shadow: 0 8px 30px rgba(255,101,132,.12); }
.acc-math      .calc-card:hover { border-color: var(--accent);  box-shadow: 0 8px 30px rgba(108,99,255,.15); }
.acc-other     .calc-card:hover { border-color: var(--accent4); box-shadow: 0 8px 30px rgba(255,169,77,.12); }

/* =============================================
   CALCULATOR CARDS GRID
   ============================================= */

.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
  margin-bottom: 48px;
}

.calc-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  cursor: pointer;
  transition: border-color .22s, transform .22s, box-shadow .22s;
  position: relative;
  overflow: hidden;
}
.calc-card:hover { transform: translateY(-3px); }
.calc-card:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.cc-icon {
  font-size: 28px;
  margin-bottom: 12px;
  display: block;
  line-height: 1;
}
.cc-name {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.cc-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.cc-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 10px;
  padding: 3px 9px;
  border-radius: 50px;
  background: rgba(108,99,255,.15);
  color: #a5a0ff;
  font-weight: 500;
  text-transform: capitalize;
}

/* Empty state */
.ch-empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--muted);
}
.ch-empty-icon { font-size: 52px; margin-bottom: 16px; }
.ch-empty p { font-size: 15px; line-height: 1.6; }

/* =============================================
   MODAL
   ============================================= */

.ch-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.ch-modal-overlay.show { display: flex; }

.ch-modal {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  width: 100%;
  max-width: 680px;
  max-height: 92vh;
  overflow-y: auto;
  position: relative;
  animation: chModalIn .25s cubic-bezier(.22,1,.36,1);
}
@keyframes chModalIn {
  from { opacity:0; transform: scale(.94) translateY(24px); }
  to   { opacity:1; transform: none; }
}

.ch-modal-head {
  padding: 26px 26px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 2;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.ch-modal-title {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.ch-modal-close {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color .15s, background .15s;
  line-height: 1;
}
.ch-modal-close:hover {
  color: var(--text);
  background: var(--border);
}

.ch-modal-body {
  padding: 22px 26px 30px;
}

/* =============================================
   FORM FIELDS (inside modal)
   ============================================= */

.field-row { margin-bottom: 16px; }

.field-row.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 7px;
  display: block;
  font-weight: 500;
  letter-spacing: .2px;
}

.field-input {
  width: 100%;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px 15px;
  font-size: 15px;
  color: var(--text);
  font-family: var(--font-body);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none;
  appearance: none;
}
.field-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108,99,255,.15);
}
.field-input::placeholder { color: var(--muted); }

select.field-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238888aa' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}
select.field-input option { background: #1c1c27; color: var(--text); }

textarea.field-input {
  resize: vertical;
  min-height: 90px;
}

/* Checkbox rows */
.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}
.check-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* CALCULATE BUTTON */
.calc-btn {
  width: 100%;
  background: var(--accent);
  border: none;
  color: #fff;
  border-radius: 12px;
  padding: 15px;
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-head);
  cursor: pointer;
  transition: opacity .15s, transform .15s;
  margin-top: 8px;
  letter-spacing: .3px;
}
.calc-btn:hover  { opacity: .88; }
.calc-btn:active { transform: scale(.99); }

/* ADD ROW button (GPA) */
.add-row-btn {
  background: none;
  border: 1.5px dashed var(--border);
  color: var(--muted);
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  margin-bottom: 10px;
  font-family: var(--font-body);
  font-size: 13px;
  transition: border-color .2s, color .2s;
}
.add-row-btn:hover { border-color: var(--accent); color: var(--accent); }

/* =============================================
   RESULT BOX
   ============================================= */

.result-box {
  margin-top: 22px;
  background: var(--surface2);
  border-radius: 14px;
  padding: 22px;
  display: none;
  border: 1px solid rgba(108,99,255,.15);
}
.result-box.show { display: block; }

.result-main {
  font-family: var(--font-head);
  font-size: clamp(30px, 6vw, 46px);
  font-weight: 800;
  color: var(--accent);
  text-align: center;
  margin-bottom: 6px;
  line-height: 1.1;
}
.result-main .unit {
  font-size: 18px;
  color: var(--muted);
  font-weight: 400;
}
.result-label {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 2px;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}
.result-item {
  background: var(--bg);
  border-radius: 10px;
  padding: 13px;
  text-align: center;
}
.ri-val {
  font-family: var(--font-head);
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  word-break: break-all;
}
.ri-key {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.3;
}

/* Password output */
.pw-item {
  background: var(--bg);
  border-radius: 8px;
  padding: 11px 15px;
  font-family: monospace;
  font-size: 13px;
  color: var(--accent3);
  word-break: break-all;
  cursor: pointer;
  border: 1px solid transparent;
  transition: border-color .2s;
  margin-bottom: 8px;
}
.pw-item:hover { border-color: var(--accent3); }
.pw-copy-hint {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
}

/* Error / warning result */
.result-error {
  color: var(--accent2);
  text-align: center;
  font-weight: 600;
  font-size: 14px;
  padding: 8px 0;
}

/* =============================================
   SCIENTIFIC CALCULATOR (inside modal)
   ============================================= */

.sci-wrap { background: var(--bg); border-radius: 12px; padding: 16px; }
.sci-display {
  text-align: right;
  font-size: 28px;
  color: var(--text);
  min-height: 64px;
  margin-bottom: 14px;
  word-break: break-all;
  padding: 10px 14px;
  background: var(--surface2);
  border-radius: 10px;
  font-family: var(--font-head);
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.sci-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.sci-btn {
  background: var(--surface2);
  border: none;
  color: var(--text);
  border-radius: 8px;
  padding: 13px 4px;
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font-head);
  transition: opacity .15s, background .15s;
}
.sci-btn:hover  { opacity: .8; }
.sci-btn.btn-eq { background: var(--accent); color: #fff; }
.sci-btn.btn-cl { background: rgba(255,101,132,.2); color: var(--accent2); }

/* =============================================
   SITE FOOTER
   ============================================= */

#site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 48px 20px 28px;
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}

.footer-brand .site-logo { font-size: 22px; margin-bottom: 12px; }
.footer-brand p { font-size: 13px; color: var(--muted); line-height: 1.7; max-width: 260px; }

.footer-col h4 {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: .8px;
}
.footer-col ul li { margin-bottom: 9px; }
.footer-col ul li a { font-size: 13px; color: var(--muted); transition: color .15s; }
.footer-col ul li a:hover { color: var(--text); }

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-copy { font-size: 12px; color: var(--muted); }
.footer-links { display: flex; gap: 18px; }
.footer-links a { font-size: 12px; color: var(--muted); }
.footer-links a:hover { color: var(--text); }

/* =============================================
   MOBILE / RESPONSIVE
   ============================================= */

/* Tablet */
@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
  .footer-brand { grid-column: 1 / -1; }
}

/* Mobile */
@media (max-width: 640px) {
  /* Header */
  #primary-navigation { display: none; }
  #primary-navigation.open {
    display: block;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px 16px;
    z-index: 800;
  }
  #primary-navigation.open ul { flex-direction: column; gap: 4px; }
  #primary-navigation.open ul li a { display: block; padding: 11px 16px; border-radius: 10px; }
  .nav-toggle { display: flex; align-items: center; justify-content: center; }

  /* Hero */
  .ch-hero { padding: 48px 16px 32px; }

  /* Stats */
  .ch-stats { gap: 20px; }

  /* Calc grid */
  .calc-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .cc-icon { font-size: 22px; margin-bottom: 8px; }
  .cc-name { font-size: 13px; }
  .cc-desc { display: none; }

  /* Modal */
  .ch-modal { border-radius: 16px 16px 0 0; max-height: 96vh; }
  .ch-modal-overlay { align-items: flex-end; padding: 0; }
  .ch-modal-head { padding: 18px 18px 14px; }
  .ch-modal-body { padding: 16px 18px 28px; }
  .ch-modal-title { font-size: 18px; }

  /* 2-col fields go single col on very small */
  .field-row.two-col { grid-template-columns: 1fr; }

  /* Footer */
  .footer-grid { grid-template-columns: 1fr; gap: 20px; }
  .footer-bottom { flex-direction: column; text-align: center; }
}

/* Extra small */
@media (max-width: 380px) {
  .calc-grid { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr 1fr; }
}

/* =============================================
   WORDPRESS DEFAULT CLASSES (alignment, etc.)
   ============================================= */

.alignleft  { float: left; margin-right: 1.5rem; margin-bottom: 1rem; }
.alignright { float: right; margin-left: 1.5rem; margin-bottom: 1rem; }
.aligncenter { display: block; margin-left: auto; margin-right: auto; margin-bottom: 1rem; }
.wp-caption { max-width: 100%; }
.wp-caption-text { font-size: 12px; color: var(--muted); text-align: center; margin-top: 4px; }

.screen-reader-text {
  border: 0;
  clip: rect(1px,1px,1px,1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  word-wrap: normal !important;
}
