/* =============================================
   TATTVAM — Component Library
   Reusable UI Components
   ============================================= */

/* ——— Navigation ——— */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(255, 248, 237, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--color-border-light);
  z-index: var(--z-sticky);
  transition: all var(--transition-base);
}

.nav.scrolled {
  box-shadow: var(--shadow-sm);
  background: rgba(255, 248, 237, 0.95);
}

.nav-inner {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 0 var(--space-6);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--color-text-dark);
  letter-spacing: 0.08em;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.nav-logo .logo-mark {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--color-gold), var(--color-bronze));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sanskrit);
  font-size: 1.1rem;
  color: var(--color-cream);
  font-style: normal;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.nav-link {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.nav-link:hover {
  color: var(--color-text-dark);
  background: rgba(207, 166, 107, 0.08);
}

.nav-link.active {
  color: var(--color-text-dark);
  background: rgba(207, 166, 107, 0.12);
}

.nav-cta {
  padding: var(--space-2) var(--space-5);
  background: var(--color-text-dark);
  color: var(--color-cream);
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--radius-full);
  transition: all var(--transition-base);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.nav-cta:hover {
  background: var(--color-gold);
  color: var(--color-cream);
  box-shadow: var(--shadow-gold);
}

/* Mobile nav */
.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  background: none;
  border: none;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text-dark);
  border-radius: 2px;
  transition: all var(--transition-fast);
}

.nav-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

.mobile-menu {
  display: none;
  position: fixed;
  top: var(--nav-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--color-cream);
  z-index: var(--z-overlay);
  padding: var(--space-8);
  flex-direction: column;
  gap: var(--space-2);
}

.mobile-menu.open {
  display: flex;
}

.mobile-menu .nav-link {
  font-size: var(--text-lg);
  padding: var(--space-4);
}

@media (max-width: 1024px) {
  .nav-links {
    display: none;
  }
  .nav-toggle {
    display: flex;
  }
}

/* ——— Buttons ——— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.04em;
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  line-height: 1.5;
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-text-dark);
  color: var(--color-cream);
  border-color: var(--color-text-dark);
}

.btn-primary:hover {
  background: var(--color-gold);
  border-color: var(--color-gold);
  color: var(--color-cream);
  box-shadow: var(--shadow-gold);
  transform: translateY(-1px);
}

.btn-gold {
  background: linear-gradient(135deg, var(--color-gold), var(--color-bronze));
  color: var(--color-cream);
}

.btn-gold:hover {
  box-shadow: var(--shadow-gold);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--color-ivory);
  color: var(--color-text-dark);
  border-color: var(--color-border-medium);
}

.btn-secondary:hover {
  background: var(--color-champagne);
  border-color: var(--color-sandstone);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  border-color: var(--color-border-light);
}

.btn-ghost:hover {
  color: var(--color-text-dark);
  border-color: var(--color-sandstone);
  background: rgba(207, 166, 107, 0.06);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
  border-radius: var(--radius-lg);
}

.btn-xl {
  padding: var(--space-5) var(--space-10);
  font-size: var(--text-md);
  border-radius: var(--radius-lg);
}

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-md);
}

.btn-round {
  border-radius: var(--radius-full);
}

/* ——— Cards ——— */
.card {
  background: var(--color-warm-white);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  transition: all var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  border-color: var(--color-champagne);
}

.card-manuscript {
  background-color: var(--color-parchment);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(210, 180, 140, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(210, 180, 140, 0.08) 0%, transparent 40%),
    radial-gradient(ellipse at 60% 80%, rgba(194, 164, 128, 0.1) 0%, transparent 45%);
  border: 1px solid var(--color-champagne);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  box-shadow: var(--shadow-inner), var(--shadow-sm);
  position: relative;
}

.card-elevated {
  background: var(--color-warm-white);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  box-shadow: var(--shadow-md);
}

.card-elevated:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

.card-glass {
  background: rgba(255, 252, 245, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(226, 201, 165, 0.4);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
}

.card-ornate {
  position: relative;
  background: var(--color-warm-white);
  border: 1px solid var(--color-champagne);
  border-radius: var(--radius-lg);
  padding: var(--space-10);
}

.card-ornate::before,
.card-ornate::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
  border-color: var(--color-gold);
  border-style: solid;
  opacity: 0.6;
}

.card-ornate::before {
  top: 12px;
  left: 12px;
  border-width: 2px 0 0 2px;
}

.card-ornate::after {
  bottom: 12px;
  right: 12px;
  border-width: 0 2px 2px 0;
}

.card-feature {
  background: var(--color-warm-white);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.card-feature::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-gold), var(--color-champagne), var(--color-gold));
  opacity: 0;
  transition: opacity var(--transition-base);
}

.card-feature:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-6px);
  border-color: var(--color-champagne);
}

.card-feature:hover::before {
  opacity: 1;
}

.card-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, rgba(207, 166, 107, 0.15), rgba(207, 166, 107, 0.05));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: var(--space-5);
}

.card-title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text-dark);
  margin-bottom: var(--space-3);
}

.card-desc {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  line-height: 1.7;
}

/* ——— Inputs ——— */
.input-group {
  position: relative;
  width: 100%;
}

.input {
  width: 100%;
  padding: var(--space-4) var(--space-5);
  background: var(--color-warm-white);
  border: 1.5px solid var(--color-border-light);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-size: var(--text-base);
  transition: all var(--transition-fast);
  outline: none;
}

.input:focus {
  border-color: var(--color-gold);
  box-shadow: 0 0 0 3px rgba(207, 166, 107, 0.1);
}

.input::placeholder {
  color: var(--color-text-muted);
}

.input-lg {
  padding: var(--space-5) var(--space-6);
  font-size: var(--text-md);
  border-radius: var(--radius-lg);
}

.textarea {
  width: 100%;
  padding: var(--space-5);
  background: var(--color-warm-white);
  border: 1.5px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  color: var(--color-text-primary);
  font-size: var(--text-base);
  transition: all var(--transition-fast);
  outline: none;
  resize: vertical;
  min-height: 120px;
  line-height: 1.7;
  font-family: var(--font-body);
}

.textarea:focus {
  border-color: var(--color-gold);
  box-shadow: 0 0 0 3px rgba(207, 166, 107, 0.1);
}

/* ——— Chat Bubbles ——— */
.chat-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding: var(--space-6);
}

.chat-bubble {
  max-width: 80%;
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-lg);
  line-height: 1.7;
  font-size: var(--text-sm);
}

.chat-bubble-user {
  align-self: flex-end;
  background: var(--color-text-dark);
  color: var(--color-cream);
  border-bottom-right-radius: var(--radius-sm);
}

.chat-bubble-ai {
  align-self: flex-start;
  background: var(--color-warm-white);
  border: 1px solid var(--color-border-light);
  color: var(--color-text-primary);
  border-bottom-left-radius: var(--radius-sm);
}

.chat-bubble-ai .shloka-inline {
  background: var(--color-parchment);
  border-left: 3px solid var(--color-gold);
  padding: var(--space-3) var(--space-4);
  margin: var(--space-3) 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-family: var(--font-sanskrit);
  font-style: italic;
  color: var(--color-text-dark);
}

.chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  background: var(--color-warm-white);
  border-top: 1px solid var(--color-border-light);
}

.chat-input {
  flex: 1;
  padding: var(--space-3) var(--space-5);
  background: var(--color-cream);
  border: 1.5px solid var(--color-border-light);
  border-radius: var(--radius-full);
  outline: none;
  font-size: var(--text-sm);
  transition: all var(--transition-fast);
}

.chat-input:focus {
  border-color: var(--color-gold);
}

.chat-send-btn {
  width: 44px;
  height: 44px;
  background: var(--color-text-dark);
  color: var(--color-cream);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.chat-send-btn:hover {
  background: var(--color-gold);
  box-shadow: var(--shadow-gold);
}

/* ——— Badges ——— */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 500;
  border-radius: var(--radius-full);
  letter-spacing: 0.04em;
}

.badge-gold {
  background: rgba(207, 166, 107, 0.15);
  color: var(--color-bronze);
}

.badge-saffron {
  background: rgba(212, 148, 58, 0.12);
  color: var(--color-saffron);
}

.badge-sandstone {
  background: rgba(203, 180, 157, 0.2);
  color: var(--color-text-secondary);
}

/* ——— Progress ——— */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--color-linen);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-gold), var(--color-saffron));
  border-radius: var(--radius-full);
  transition: width 0.8s var(--ease-out-expo);
}

/* ——— Verse Display ——— */
.verse-block {
  background: var(--color-parchment);
  border: 1px solid var(--color-champagne);
  border-radius: var(--radius-lg);
  padding: var(--space-8) var(--space-10);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.verse-block::before {
  content: '"';
  position: absolute;
  top: -10px;
  left: 20px;
  font-family: var(--font-heading);
  font-size: 8rem;
  color: rgba(207, 166, 107, 0.1);
  line-height: 1;
}

.verse-sanskrit {
  font-family: var(--font-sanskrit);
  font-size: var(--text-xl);
  color: var(--color-text-dark);
  line-height: 1.8;
  margin-bottom: var(--space-6);
}

.verse-transliteration {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-6);
  letter-spacing: 0.02em;
}

.verse-translation {
  font-size: var(--text-md);
  color: var(--color-text-primary);
  line-height: 1.8;
  max-width: 600px;
  margin: 0 auto;
}

.verse-reference {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-top: var(--space-6);
}

/* ——— Quote Block ——— */
.quote-block {
  border-left: 3px solid var(--color-gold);
  padding: var(--space-4) var(--space-6);
  background: rgba(207, 166, 107, 0.04);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.quote-block p {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-style: italic;
  color: var(--color-text-dark);
  line-height: 1.6;
}

/* ——— Modal ——— */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(47, 42, 38, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--color-cream);
  border-radius: var(--radius-xl);
  padding: var(--space-10);
  max-width: 560px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  position: relative;
}

.modal-close {
  position: absolute;
  top: var(--space-5);
  right: var(--space-5);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--color-linen);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  font-size: 1.1rem;
}

.modal-close:hover {
  background: var(--color-champagne);
  color: var(--color-text-dark);
}

/* ——— Tabs ——— */
.tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--color-border-light);
  padding-bottom: 0;
}

.tab {
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  border: none;
  background: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab:hover {
  color: var(--color-text-dark);
}

.tab.active {
  color: var(--color-text-dark);
  border-bottom-color: var(--color-gold);
}

/* ——— Chip / Tag ——— */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--color-ivory);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.chip:hover {
  background: var(--color-champagne);
  color: var(--color-text-dark);
  border-color: var(--color-sandstone);
}

.chip.active {
  background: var(--color-text-dark);
  color: var(--color-cream);
  border-color: var(--color-text-dark);
}

/* ——— Dividers ——— */
.divider {
  width: 100%;
  height: 1px;
  background: var(--color-border-light);
  margin: var(--space-8) 0;
}

.divider-temple {
  width: 100%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--color-champagne) 20%,
    var(--color-gold) 50%,
    var(--color-champagne) 80%,
    transparent 100%
  );
  position: relative;
  margin: var(--space-12) 0;
}

.divider-temple::before {
  content: '◆';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--color-gold);
  font-size: 10px;
  background: var(--color-cream);
  padding: 0 var(--space-4);
}

.divider-lotus {
  width: 100%;
  text-align: center;
  margin: var(--space-12) 0;
  position: relative;
}

.divider-lotus::before {
  content: '✦';
  font-size: 1.2rem;
  color: var(--color-gold);
  position: relative;
}

.divider-lotus::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--color-champagne) 30%,
    transparent 48%,
    transparent 52%,
    var(--color-champagne) 70%,
    transparent
  );
}

/* ——— Tooltip ——— */
.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: var(--space-2) var(--space-3);
  background: var(--color-text-dark);
  color: var(--color-cream);
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-fast);
}

.tooltip:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ——— Footer ——— */
.footer {
  background: var(--color-text-dark);
  color: var(--color-sandstone);
  padding: var(--space-16) 0 var(--space-8);
}

.footer a {
  color: var(--color-sandstone);
  transition: color var(--transition-fast);
}

.footer a:hover {
  color: var(--color-gold);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: var(--space-10);
  margin-bottom: var(--space-12);
}

.footer-brand {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  color: var(--color-cream);
  margin-bottom: var(--space-4);
  letter-spacing: 0.06em;
}

.footer-desc {
  color: var(--color-sandstone);
  font-size: var(--text-sm);
  line-height: 1.7;
  max-width: 300px;
}

.footer-heading {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--color-text-light);
  margin-bottom: var(--space-5);
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.footer-links a {
  font-size: var(--text-sm);
}

.footer-bottom {
  border-top: 1px solid rgba(203, 180, 157, 0.2);
  padding-top: var(--space-8);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-xs);
  color: var(--color-text-light);
}

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }
}

/* ——— Page Header ——— */
.page-header {
  padding-top: calc(var(--nav-height) + var(--space-16));
  padding-bottom: var(--space-12);
  text-align: center;
}

.page-header .text-label {
  margin-bottom: var(--space-4);
  display: block;
}

.page-header h1 {
  margin-bottom: var(--space-4);
}

.page-header p {
  color: var(--color-text-secondary);
  font-size: var(--text-md);
  max-width: 600px;
  margin: 0 auto;
}

/* ——— Suggested Chips ——— */
.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: center;
}

/* ——— Loading Spinner ——— */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-border-light);
  border-top-color: var(--color-gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.loading-dots span {
  width: 6px;
  height: 6px;
  background: var(--color-sandstone);
  border-radius: 50%;
  animation: dotPulse 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* ——— Empty State ——— */
.empty-state {
  text-align: center;
  padding: var(--space-16) var(--space-8);
  color: var(--color-text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
  opacity: 0.5;
}

.empty-state-title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-3);
}
