/* assets/css/style.css - Mobile-First Modern Design System */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --secondary: #475569;
  --accent: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius-md: 12px;
  --radius-lg: 16px;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* Dark Mode Variable Overrides */
[data-theme="dark"] {
  --bg-main: #090d16;
  --bg-card: #111827;
  --border-color: #1f2937;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --primary-light: #1e293b;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5);
}

[data-theme="dark"] .site-header,
[data-theme="dark"] .mobile-bottom-nav,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .tool-quick-nav-wrapper,
[data-theme="dark"] .tool-header-card,
[data-theme="dark"] .tool-workspace,
[data-theme="dark"] .tool-card,
[data-theme="dark"] .info-section,
[data-theme="dark"] .tool-quick-search-dropdown {
  background-color: #111827;
  border-color: #1f2937;
}

[data-theme="dark"] .hero-section {
  background: linear-gradient(180deg, #111827 0%, #090d16 100%);
  border-color: #1f2937;
}

[data-theme="dark"] .hero-search-input,
[data-theme="dark"] .tool-quick-search-input,
[data-theme="dark"] .form-control {
  background-color: #1f2937;
  border-color: #374151;
  color: #f8fafc;
}

[data-theme="dark"] .chip-item,
[data-theme="dark"] .tool-category-pill {
  background-color: #1f2937;
  color: #e2e8f0;
  border-color: #374151;
}

[data-theme="dark"] .chip-item:hover,
[data-theme="dark"] .tool-category-pill:hover {
  background-color: #374151;
  color: #ffffff;
}

[data-theme="dark"] .chip-item.active,
[data-theme="dark"] .tool-category-pill.active {
  background-color: var(--primary);
  color: #ffffff;
}

[data-theme="dark"] .result-box,
[data-theme="dark"] .feedback-rating-box {
  background-color: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .tool-search-result-item:hover,
[data-theme="dark"] .tool-search-result-item.focused {
  background-color: #1f2937;
}

[data-theme="dark"] .btn-outline {
  background-color: #1f2937;
  color: #e2e8f0 !important;
  border-color: #374151;
}

[data-theme="dark"] .btn-outline:hover {
  background-color: #374151;
  color: #ffffff !important;
}

/* Theme Switcher Button */
.theme-toggle-btn {
  background: none;
  border: 1px solid var(--border-color);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  cursor: pointer;
  font-size: 1.15rem;
  transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
  background-color: var(--border-color);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 70px; /* Space for mobile bottom bar */
}

@media (min-width: 769px) {
  body {
    padding-bottom: 0;
  }
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s ease;
}

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

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Header & Navbar */
.site-header {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
}

.brand-badge {
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  color: #ffffff;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 1.1rem;
}

.nav-search-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: 30px;
  padding: 8px 16px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.95rem;
  width: 100%;
  max-width: 380px;
  transition: all 0.2s ease;
}

.nav-search-trigger:hover {
  border-color: var(--primary);
  background: #ffffff;
}

.nav-search-trigger kbd {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.75rem;
  margin-left: auto;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff !important;
}

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

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background: var(--bg-main);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.btn-lg {
  padding: 12px 26px;
  font-size: 1.05rem;
  border-radius: 10px;
}

/* Mobile App-Style Bottom Navigation Bar (Q59 requirement) */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: #ffffff;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 1000;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  gap: 4px;
  flex: 1;
  height: 100%;
}

.mobile-nav-item i {
  font-size: 1.25rem;
}

.mobile-nav-item.active {
  color: var(--primary);
}

@media (min-width: 769px) {
  .mobile-bottom-nav {
    display: none !important;
  }
}

/* Hero Section */
.hero-section {
  background: linear-gradient(180deg, #ffffff 0%, var(--bg-main) 100%);
  padding: 3rem 0 2rem;
  text-align: center;
  border-bottom: 1px solid var(--border-color);
}

.hero-title {
  font-size: 2.3rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
  margin-bottom: 0.8rem;
}

.hero-title span {
  color: var(--primary);
}

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

.hero-search-box {
  max-width: 650px;
  margin: 0 auto;
  position: relative;
}

.hero-search-input {
  width: 100%;
  padding: 16px 20px 16px 52px;
  font-size: 1.1rem;
  border: 2px solid var(--border-color);
  border-radius: 40px;
  outline: none;
  background: #ffffff;
  box-shadow: var(--shadow-md);
  transition: all 0.2s ease;
}

.hero-search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.hero-search-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.25rem;
}

/* Category Filter Chips */
.category-chips-wrapper {
  margin: 1.5rem 0;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 8px 0;
  scrollbar-width: none;
}

.category-chips-wrapper::-webkit-scrollbar {
  display: none;
}

.chip-item {
  white-space: nowrap;
  padding: 8px 18px;
  border-radius: 30px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

.chip-item:hover, .chip-item.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* Tool Grid Cards */
.tools-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin: 1.5rem 0 3rem;
}

@media (min-width: 640px) {
  .tools-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .tools-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.tool-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: #bfdbfe;
}

.tool-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.tool-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.fav-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px;
  transition: color 0.15s ease;
}

.fav-btn:hover, .fav-btn.active {
  color: #ef4444;
}

.tool-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.tool-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  line-height: 1.5;
  flex-grow: 1;
}

.tool-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.rating-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #d97706;
  font-weight: 600;
}

/* Individual Tool Page View */
.tool-page-container {
  padding: 2rem 0 4rem;
}

/* PC-Friendly Tool Page Top Search & Categories Navigation */
.tool-quick-nav-wrapper {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.tool-quick-search-row {
  position: relative;
  margin-bottom: 0.85rem;
}

.tool-search-input-group {
  position: relative;
  width: 100%;
}

.tool-search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 1.15rem;
  pointer-events: none;
}

.tool-quick-search-input {
  width: 100%;
  padding: 12px 110px 12px 46px;
  font-size: 0.98rem;
  border: 1.5px solid var(--border-color);
  border-radius: 30px;
  background: #f8fafc;
  outline: none;
  transition: all 0.2s ease;
  font-family: inherit;
}

.tool-quick-search-input:focus {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.tool-search-badge {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  background: #e2e8f0;
  padding: 3px 8px;
  border-radius: 6px;
  pointer-events: none;
}

.tool-quick-search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  max-height: 360px;
  overflow-y: auto;
  z-index: 1050;
  padding: 6px;
}

.tool-search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-main);
  transition: background 0.15s ease;
}

.tool-search-result-item:hover, .tool-search-result-item.focused {
  background: #f1f5f9;
}

.tool-search-result-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #eff6ff;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.tool-categories-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-top: 4px;
}

.tool-categories-strip::-webkit-scrollbar {
  display: none;
}

.tool-category-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #475569;
  background: #f1f5f9;
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.tool-category-pill:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.tool-category-pill.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.tool-header-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.tool-workspace {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
}

/* Tool Form Controls */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  background: #ffffff;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Result Box */
.result-box {
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-top: 1.5rem;
  text-align: center;
}

.result-value {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--primary);
  margin: 0.5rem 0;
}

.result-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 1rem;
}

/* Guide & Formula Sections */
.info-section {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.info-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
}

/* Rating & Feedback Section */
.feedback-rating-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
}

.star-rating {
  display: inline-flex;
  flex-direction: row-reverse;
  gap: 4px;
}

.star-rating input {
  display: none;
}

.star-rating label {
  color: #cbd5e1;
  font-size: 1.6rem;
  cursor: pointer;
  transition: color 0.15s;
}

.star-rating label:hover,
.star-rating label:hover ~ label,
.star-rating input:checked ~ label {
  color: #f59e0b;
}

/* Ad Placeholders */
.ad-placeholder {
  background: #f1f5f9;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  padding: 15px;
  margin: 1.5rem 0;
  text-align: center;
  position: relative;
}

.ad-tag {
  position: absolute;
  top: 4px;
  left: 10px;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #94a3b8;
  font-weight: bold;
}

.ad-box {
  font-size: 0.85rem;
  color: #64748b;
  padding: 15px 0;
}

/* Modal Dialog */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 550px;
  width: 100%;
  padding: 2rem;
  position: relative;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
}

/* Footer */
.site-footer {
  background: #0f172a;
  color: #94a3b8;
  padding: 3rem 0 2rem;
  margin-top: auto;
}

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

@media (min-width: 640px) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr 1fr;
  }
}

.footer-col h4 {
  color: #ffffff;
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.footer-col ul {
  list-style: none;
}

.footer-col ul li {
  margin-bottom: 0.6rem;
}

.footer-col ul li a {
  color: #94a3b8;
}

.footer-col ul li a:hover {
  color: #ffffff;
}

.footer-bottom {
  border-top: 1px solid #334155;
  padding-top: 1.5rem;
  text-align: center;
  font-size: 0.85rem;
}

/* Print / PDF Export Styles */
@media print {
  .site-header,
  .mobile-bottom-nav,
  .site-footer,
  .ad-container,
  .ad-placeholder,
  .tool-quick-nav-wrapper,
  .modal,
  #global-toast,
  .feedback-rating-box,
  .fav-btn,
  .open-feedback-btn,
  #btn-share-tool,
  button[onclick="window.print();"] {
    display: none !important;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
    padding: 0 !important;
  }

  .tool-workspace, .tool-header-card, .info-section {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
  }
}

/* Universal FAQ Accordion Styles */
.tool-faq-section {
  margin-top: 1.5rem;
}

.faq-accordion {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 1rem;
}

.faq-item {
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--card-bg, #ffffff);
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

[data-theme="dark"] .faq-item {
  background: #1e293b;
  border-color: #334155;
}

.faq-item.active {
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.08);
}

.faq-question {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: transparent;
  border: none;
  text-align: left;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  gap: 1rem;
  font-family: inherit;
  transition: color 0.15s ease;
}

.faq-question:hover {
  color: var(--primary);
}

.faq-icon {
  font-size: 0.9rem;
  color: #94a3b8;
  transition: transform 0.25s ease, color 0.2s ease;
  flex-shrink: 0;
}

.faq-item.active .faq-icon {
  transform: rotate(180deg);
  color: var(--primary);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0, 1, 0, 1), padding 0.25s ease;
  padding: 0 20px;
  color: #475569;
  font-size: 0.92rem;
  line-height: 1.7;
}

[data-theme="dark"] .faq-answer {
  color: #cbd5e1;
}

.faq-item.active .faq-answer {
  max-height: 1000px;
  transition: max-height 0.35s ease-in-out, padding 0.25s ease;
  padding: 0 20px 18px 20px;
}

