/* UI Components - SmartPaisa.in */

/* Sticky Header & Navbar */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--white);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.logo {
  display: flex;
  align-items: center;
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  gap: 8px;
}

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

.nav-links {
  display: flex;
  gap: 24px;
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.95rem;
}

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

/* Header Search Engine */
.search-wrapper {
  position: relative;
  width: 280px;
}

.search-input {
  width: 100%;
  padding: 8px 16px 8px 36px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s, background-color var(--transition-speed);
}

.search-input:focus {
  border-color: var(--primary);
  background: var(--white);
}

.search-icon-svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  fill: var(--text-muted);
  pointer-events: none;
}

.search-results-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 300px;
  overflow-y: auto;
  z-index: 110;
  display: none;
}

.search-result-item {
  display: block;
  padding: 10px 16px;
  font-size: 0.85rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.2s;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background-color: var(--bg-subtle);
  color: var(--primary);
}

/* Theme Toggle Button */
.theme-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s, color 0.2s;
}

.theme-toggle-btn:hover {
  background-color: var(--bg-subtle);
  color: var(--primary);
}

.theme-toggle-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* Category Tabs navigation */
.category-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 0;
  margin-bottom: 24px;
  scrollbar-width: none; /* Hide scrollbar for Firefox */
}

.category-tabs::-webkit-scrollbar {
  display: none; /* Hide scrollbar for Chrome/Safari */
}

.tab-btn {
  background: var(--white);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 10px 20px;
  font-weight: 500;
  font-family: var(--font-body);
  font-size: 0.9rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.tab-btn:hover,
.tab-btn.active {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

/* Common Card layouts */
.card {
  background-color: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s, background-color var(--transition-speed), border-color var(--transition-speed);
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
}

/* Standard Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  gap: 8px;
}

.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--bg-subtle); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-outline { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-whatsapp { background: #25D366; color: white; }
.btn-whatsapp:hover { background: #128C7E; }

/* Breadcrumb Navigation */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 16px 0;
}

.breadcrumb a {
  color: var(--text-secondary);
}

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

.breadcrumb span.separator {
  color: var(--text-muted);
}

.breadcrumb span.current {
  color: var(--text-primary);
  font-weight: 500;
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text-primary);
  color: var(--white);
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 1000;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 80px;
  right: 24px;
  background: var(--primary);
  color: var(--white);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  z-index: 90;
  border: none;
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

/* Ad Slots */
.ad-slot {
  display: none !important; /* Hidden for Auto Ads */
  background: var(--bg-subtle);
  border: 1px dashed var(--border);
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  margin: 20px 0;
  text-align: center;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

#ad-header { height: 90px; width: 100%; max-width: 728px; margin: 20px auto; }
#ad-sidebar { height: 600px; width: 300px; margin: 0 auto; position: sticky; top: 92px; }
#ad-below-result { height: 90px; width: 100%; max-width: 728px; margin: 30px auto; }
#ad-footer { height: 90px; width: 100%; max-width: 970px; margin: 30px auto; }

/* Tables (Amortization/SCSS/PPF charts) */
.table-wrapper {
  overflow-x: auto;
  margin: 20px 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.data-table th {
  background-color: var(--bg-subtle);
  color: var(--text-primary);
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-heading);
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background-color: var(--bg-light);
}

/* Footer styling */
footer {
  background-color: var(--white);
  border-top: 1px solid var(--border);
  padding: 64px 0 24px;
  margin-top: 64px;
  transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(4, 1fr);
  gap: 32px;
  margin-bottom: 48px;
}

.footer-col h4 {
  font-size: 0.95rem;
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-primary);
}

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

.footer-col ul li {
  margin-bottom: 12px;
}

.footer-col ul li a {
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.footer-col ul li a:hover {
  color: var(--primary);
}

.footer-about p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 16px;
  max-width: 320px;
}

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

.footer-bottom-links {
  display: flex;
  gap: 20px;
}

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

.footer-bottom-links a:hover {
  color: var(--primary);
}

/* Bottom Navigation (Mobile Only) */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background-color: var(--white);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
  display: none;
  justify-content: space-around;
  align-items: center;
  z-index: 99;
  padding-bottom: env(safe-area-inset-bottom);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 500;
  text-decoration: none;
  flex: 1;
  height: 100%;
}

.mobile-nav-item svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  margin-bottom: 2px;
}

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

/* Printable items default resets */
@media print {
  body {
    background-color: white !important;
    color: black !important;
  }
  header, footer, .mobile-bottom-nav, .ad-slot, .back-to-top, .breadcrumb, .no-print,
  .btn, .input-slider, .theme-toggle-btn, .category-tabs {
    display: none !important;
  }
  .container {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .card {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  .print-only {
    display: block !important;
  }
}
