/* Shared styles for all tools */
:root {
  --bg: #fafafa;
  --text: #222222;
  --primary: #005286;
  --secondary: #e4f0f7;
  --accent: #0084a8;
}

::selection {
  color: white;
  background: salmon;
}

body {
  font-family: "Inter", sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

html {
  scroll-behavior: smooth;
}

section {
  scroll-margin-top: 80px;
}

.firm-name {
  color: var(--primary);
  font-family: "Playfair Display", serif;
}

.highlight {
  color: var(--accent);
  font-weight: 600;
}

.glass {
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(255, 255, 255, 0.8);
}

@media (max-width: 768px) {
  .glass {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(255, 255, 255, 0.95);
  }
}

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s ease, transform 0.8s ease;
  will-change: transform, opacity;
}

.reveal.in {
  opacity: 1;
  transform: translateY(0);
}

.link-underline {
  position: relative;
}

.link-underline:after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  height: 2px;
  width: 0;
  background: var(--accent);
  transition: width 0.25s ease;
}

.link-underline:hover:after {
  width: 100%;
}

.chinmay-link {
  background: linear-gradient(90deg, #a855f7, #ec4899, #fbbf24);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  background-size: 200% auto;
  transition: background-position 0.5s ease;
}

.chinmay-link:hover {
  background-position: right center;
}

/* Tool specific styles */
.tool-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.calculator-card {
  background: white;
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.input-group {
  margin-bottom: 1.5rem;
}

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

.input-field {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-field:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 132, 168, 0.1);
}

.input-field:disabled {
  background: #f3f4f6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: white;
  padding: 0.875rem 2rem;
  border-radius: 0.75rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

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

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: white;
  color: var(--primary);
  padding: 0.875rem 2rem;
  border-radius: 0.75rem;
  font-weight: 600;
  border: 2px solid var(--primary);
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-secondary:hover {
  background: var(--secondary);
}

.result-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: white;
  padding: 2rem;
  border-radius: 1rem;
  margin-top: 2rem;
  box-shadow: 0 10px 15px -3px rgba(0, 82, 134, 0.3);
}

.result-value {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0.5rem 0;
}

.result-label {
  font-size: 0.875rem;
  opacity: 0.9;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.info-box {
  background: var(--secondary);
  border-left: 4px solid var(--accent);
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  margin: 1.5rem 0;
}

.info-box-icon {
  color: var(--accent);
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

.step-box {
  background: white;
  border: 2px solid var(--secondary);
  border-radius: 1rem;
  padding: 1.5rem;
  transition: all 0.3s;
}

.step-box:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 82, 134, 0.1);
}

.step-number {
  background: var(--primary);
  color: white;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.25rem;
}

.tag-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--secondary);
  color: var(--primary);
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
}

/* Performance optimizations */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Loading state */
.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.6;
}

.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1.5rem;
  height: 1.5rem;
  margin: -0.75rem 0 0 -0.75rem;
  border: 2px solid var(--primary);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* Responsive table */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

.data-table th {
  background: var(--secondary);
  color: var(--primary);
  padding: 0.75rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.875rem;
}

.data-table td {
  padding: 0.75rem;
  border-bottom: 1px solid #e5e7eb;
}

.data-table tr:hover {
  background: var(--secondary);
}

/* Modal styles */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
  backdrop-filter: blur(4px);
}

.modal-content {
  background: white;
  border-radius: 1rem;
  padding: 2rem;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: #6b7280;
  transition: color 0.2s;
}

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

/* Print styles */
@media print {
  .no-print {
    display: none !important;
  }
  
  body {
    background: white;
  }
  
  .glass {
    background: white;
    border: 1px solid #e5e7eb;
  }
}
