/**
 * Bead Calculator Styles
 * 
 * Clean, professional design for SEO-optimized calculator tools
 * Mobile-first responsive design
 */

/* === CSS Variables === */
:root {
  --calc-primary: #2a6ff3;
  --calc-primary-dark: #1e5dd4;
  --calc-primary-light: #e8f0fe;
  --calc-secondary: #10b981;
  --calc-text: #1f2937;
  --calc-text-light: #6b7280;
  --calc-bg: #f8fafc;
  --calc-white: #ffffff;
  --calc-border: #e5e7eb;
  --calc-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --calc-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --calc-radius: 12px;
  --calc-radius-sm: 8px;
  --calc-font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* === Reset & Base === */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--calc-font);
  background: var(--calc-bg);
  color: var(--calc-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* === Header === */
.calc-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--calc-white);
  box-shadow: var(--calc-shadow);
}

.calc-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.calc-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.calc-logo-icon {
  width: 40px;
  height: 40px;
}

.calc-logo-full {
  display: none;
  height: 40px;
  width: auto;
}

@media (min-width: 640px) {
  .calc-logo-icon {
    display: none;
  }

  .calc-logo-full {
    display: block;
  }
}

.calc-header-cta {
  background: var(--calc-primary);
  color: white;
  padding: 10px 20px;
  border-radius: var(--calc-radius-sm);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.calc-header-cta:hover {
  background: var(--calc-primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--calc-shadow);
}

/* === Main Content === */
.calc-main {
  min-height: calc(100vh - 64px);
}

.calc-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px;
}

/* === Hero Section === */
.calc-hero {
  background: linear-gradient(135deg, var(--calc-primary) 0%, #1e40af 100%);
  padding: 48px 16px;
  text-align: center;
  color: white;
}

.calc-hero h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 1.2;
}

.calc-hero-subtitle {
  font-size: 1.1rem;
  opacity: 0.95;
  max-width: 600px;
  margin: 0 auto 20px;
}

.calc-hero-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.calc-badge {
  background: rgba(255, 255, 255, 0.2);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  backdrop-filter: blur(4px);
}

@media (min-width: 640px) {
  .calc-hero {
    padding: 64px 24px;
  }

  .calc-hero h1 {
    font-size: 2.75rem;
  }

  .calc-hero-subtitle {
    font-size: 1.25rem;
  }
}

/* === Calculator Section === */
.calc-section {
  padding: 32px 0;
  margin-top: -24px;
}

/* === Tabs === */
.calc-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  background: var(--calc-white);
  padding: 6px;
  border-radius: var(--calc-radius);
  box-shadow: var(--calc-shadow);
}

.calc-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 16px;
  border: none;
  background: transparent;
  color: var(--calc-text-light);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--calc-radius-sm);
  transition: all 0.2s ease;
}

.calc-tab:hover {
  background: var(--calc-bg);
  color: var(--calc-text);
}

.calc-tab.active {
  background: var(--calc-primary);
  color: white;
}

.calc-tab-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

@media (max-width: 500px) {
  .calc-tab {
    flex-direction: column;
    font-size: 12px;
    padding: 10px 8px;
    gap: 4px;
  }
}

/* === Calculator Panel === */
.calc-panel {
  display: none;
}

.calc-panel.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* === Calculator Card === */
.calc-card {
  background: var(--calc-white);
  border-radius: var(--calc-radius);
  box-shadow: var(--calc-shadow-lg);
  overflow: hidden;
}

.calc-card-header {
  padding: 24px 24px 0;
}

.calc-card-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--calc-text);
  margin-bottom: 8px;
}

.calc-card-header p {
  color: var(--calc-text-light);
  font-size: 15px;
}

/* === Form === */
.calc-form {
  padding: 24px;
}

.calc-form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.calc-form-row.single {
  grid-template-columns: 1fr;
}

@media (min-width: 500px) {
  .calc-form-row {
    grid-template-columns: 1fr 1fr;
  }

  .calc-form-row.single {
    grid-template-columns: 1fr;
    max-width: 50%;
  }
}

.calc-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.calc-form-group label {
  font-size: 14px;
  font-weight: 600;
  color: var(--calc-text);
}

.calc-form-group .unit-label,
.calc-form-group .thread-unit-label {
  font-weight: 400;
  color: var(--calc-text-light);
}

.calc-form-group select,
.calc-form-group input {
  padding: 12px 16px;
  border: 2px solid var(--calc-border);
  border-radius: var(--calc-radius-sm);
  font-size: 15px;
  color: var(--calc-text);
  background: var(--calc-white);
  transition: all 0.2s ease;
  width: 100%;
}

/* Custom select styling for better arrow spacing */
.calc-form-group select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 16px;
  padding-right: 48px;
  cursor: pointer;
}

.calc-form-group select:hover {
  border-color: var(--calc-text-light);
}

.calc-form-group select:focus,
.calc-form-group input:focus {
  outline: none;
  border-color: var(--calc-primary);
  box-shadow: 0 0 0 3px var(--calc-primary-light);
}

/* Remove default arrow in IE */
.calc-form-group select::-ms-expand {
  display: none;
}

.calc-form-group input[type="number"] {
  -moz-appearance: textfield;
}

.calc-form-group input::-webkit-outer-spin-button,
.calc-form-group input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.calc-help-text {
  font-size: 12px;
  color: var(--calc-text-light);
  margin-top: 2px;
}

/* === Submit Button === */
.calc-submit-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 24px;
  margin-top: 8px;
  background: var(--calc-primary);
  color: white;
  border: none;
  border-radius: var(--calc-radius-sm);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.calc-submit-btn:hover {
  background: var(--calc-primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--calc-shadow);
}

.calc-btn-icon {
  width: 22px;
  height: 22px;
}

/* === Results === */
.calc-results {
  padding: 24px;
  background: var(--calc-bg);
  border-top: 1px solid var(--calc-border);
}

.calc-results.hidden {
  display: none;
}

.calc-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.calc-results-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--calc-text);
}

.calc-reset-btn {
  padding: 8px 16px;
  background: transparent;
  border: 2px solid var(--calc-border);
  border-radius: var(--calc-radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--calc-text-light);
  cursor: pointer;
  transition: all 0.2s ease;
}

.calc-reset-btn:hover {
  border-color: var(--calc-text-light);
  color: var(--calc-text);
}

/* === Results Grid === */
.calc-results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

@media (min-width: 600px) {
  .calc-results-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.calc-result-card {
  background: var(--calc-white);
  padding: 16px;
  border-radius: var(--calc-radius-sm);
  text-align: center;
  border: 1px solid var(--calc-border);
}

.calc-result-card.primary {
  background: var(--calc-primary);
  color: white;
  border: none;
  grid-column: span 2;
}

@media (min-width: 600px) {
  .calc-result-card.primary {
    grid-column: span 1;
  }
}

.calc-result-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  opacity: 0.8;
}

.calc-result-card.primary .calc-result-label {
  opacity: 0.9;
}

.calc-result-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
}

.calc-result-note {
  display: block;
  font-size: 11px;
  margin-top: 4px;
  opacity: 0.7;
}

/* === Results Summary === */
.calc-results-summary {
  background: var(--calc-white);
  padding: 16px;
  border-radius: var(--calc-radius-sm);
  border: 1px solid var(--calc-border);
  margin-bottom: 20px;
}

.calc-results-summary h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--calc-text);
}

.calc-results-summary p {
  font-size: 14px;
  color: var(--calc-text-light);
  line-height: 1.6;
}

/* === Results Tips === */
.calc-results-tips {
  background: #fef3c7;
  padding: 16px;
  border-radius: var(--calc-radius-sm);
  margin-bottom: 20px;
}

.calc-results-tips h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
  color: #92400e;
}

.calc-results-tips ul {
  margin: 0;
  padding-left: 20px;
}

.calc-results-tips li {
  font-size: 13px;
  color: #92400e;
  margin-bottom: 6px;
}

.calc-results-tips li:last-child {
  margin-bottom: 0;
}

/* === CTA Section === */
.calc-cta-section {
  background: linear-gradient(135deg, var(--calc-primary-light) 0%, #dbeafe 100%);
  padding: 24px;
  border-radius: var(--calc-radius-sm);
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  text-align: center;
}

@media (min-width: 600px) {
  .calc-cta-section {
    flex-direction: row;
    text-align: left;
  }
}

.calc-cta-content {
  flex: 1;
}

.calc-cta-content h4 {
  font-size: 18px;
  font-weight: 700;
  color: var(--calc-text);
  margin-bottom: 4px;
}

.calc-cta-content p {
  font-size: 14px;
  color: var(--calc-text-light);
  margin: 0;
}

.calc-cta-btn {
  display: inline-flex;
  align-items: center;
  padding: 14px 28px;
  background: var(--calc-primary);
  color: white;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--calc-radius-sm);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.calc-cta-btn:hover {
  background: var(--calc-primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--calc-shadow-lg);
}

/* === Info Section === */
.calc-info-section {
  padding: 48px 0;
  background: var(--calc-white);
}

.calc-info-section h2 {
  font-size: 1.75rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 32px;
}

.calc-info-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  margin-bottom: 40px;
}

@media (min-width: 640px) {
  .calc-info-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.calc-info-card {
  background: var(--calc-bg);
  padding: 24px;
  border-radius: var(--calc-radius);
  border: 1px solid var(--calc-border);
}

.calc-info-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.calc-info-card h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--calc-text);
}

.calc-info-card p {
  font-size: 14px;
  color: var(--calc-text-light);
  margin-bottom: 16px;
  line-height: 1.6;
}

.calc-info-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.calc-info-card li {
  font-size: 14px;
  color: var(--calc-text);
  padding-left: 20px;
  position: relative;
  margin-bottom: 8px;
}

.calc-info-card li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--calc-secondary);
  font-weight: bold;
}

/* === Reference Table === */
.calc-reference-section {
  margin-top: 40px;
}

.calc-reference-section h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 16px;
  text-align: center;
}

.calc-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.calc-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--calc-white);
  border-radius: var(--calc-radius-sm);
  overflow: hidden;
  box-shadow: var(--calc-shadow);
}

.calc-table th,
.calc-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--calc-border);
}

.calc-table th {
  background: var(--calc-primary);
  color: white;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.calc-table td {
  font-size: 14px;
  color: var(--calc-text);
}

.calc-table tbody tr:nth-child(even) {
  background: var(--calc-bg);
}

.calc-table tbody tr:hover {
  background: var(--calc-primary-light);
}

/* === FAQ Section === */
.calc-faq-section {
  padding: 48px 0;
  background: var(--calc-bg);
}

.calc-faq-section h2 {
  font-size: 1.75rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 32px;
}

.calc-faq-list {
  max-width: 700px;
  margin: 0 auto;
}

.calc-faq-item {
  background: var(--calc-white);
  border-radius: var(--calc-radius-sm);
  margin-bottom: 12px;
  box-shadow: var(--calc-shadow);
  overflow: hidden;
}

.calc-faq-item summary {
  padding: 16px 20px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s ease;
}

.calc-faq-item summary::-webkit-details-marker {
  display: none;
}

.calc-faq-item summary::after {
  content: "+";
  font-size: 1.5rem;
  font-weight: 300;
  color: var(--calc-primary);
  transition: transform 0.2s ease;
}

.calc-faq-item[open] summary::after {
  transform: rotate(45deg);
}

.calc-faq-item summary:hover {
  background: var(--calc-bg);
}

.calc-faq-item p {
  padding: 0 20px 16px;
  font-size: 14px;
  color: var(--calc-text-light);
  line-height: 1.7;
}

/* === Final CTA === */
.calc-final-cta {
  padding: 64px 16px;
  background: linear-gradient(135deg, var(--calc-primary) 0%, #1e40af 100%);
  text-align: center;
  color: white;
}

.calc-final-cta-content {
  max-width: 600px;
  margin: 0 auto;
}

.calc-final-cta h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.calc-final-cta p {
  font-size: 1.1rem;
  opacity: 0.95;
  margin-bottom: 24px;
}

.calc-final-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-bottom: 32px;
  font-size: 14px;
}

.calc-final-cta-btn {
  display: inline-flex;
  align-items: center;
  padding: 18px 36px;
  background: white;
  color: var(--calc-primary);
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
  border-radius: var(--calc-radius);
  transition: all 0.2s ease;
}

.calc-final-cta-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

/* === Sticky CTA Bar === */
.calc-sticky-cta {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--calc-white);
  border-top: 1px solid var(--calc-border);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  padding: 12px 16px;
  z-index: 90;
  display: none;
}

.calc-sticky-cta.visible {
  display: block;
}

.calc-sticky-cta-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

@media (min-width: 640px) {
  .calc-sticky-cta-inner {
    flex-direction: row;
    justify-content: space-between;
  }
}

.calc-sticky-cta-text {
  font-size: 14px;
  color: var(--calc-text);
  text-align: center;
}

.calc-sticky-cta-text strong {
  color: var(--calc-text);
}

.calc-sticky-cta-text span {
  color: var(--calc-text-light);
  display: none;
}

@media (min-width: 640px) {
  .calc-sticky-cta-text span {
    display: inline;
  }
}

.calc-sticky-cta-btn {
  display: inline-flex;
  align-items: center;
  padding: 12px 24px;
  background: var(--calc-primary);
  color: white;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--calc-radius-sm);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.calc-sticky-cta-btn:hover {
  background: var(--calc-primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--calc-shadow);
}

/* === Footer === */
.calc-footer {
  background: var(--calc-text);
  padding: 24px 16px;
  padding-bottom: 100px; /* Space for sticky CTA bar */
}

@media (min-width: 640px) {
  .calc-footer {
    padding-bottom: 80px;
  }
}

.calc-footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

@media (min-width: 640px) {
  .calc-footer-content {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}

.calc-footer p {
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  margin: 0;
}

.calc-footer-links {
  display: flex;
  gap: 24px;
}

.calc-footer-links a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s ease;
}

.calc-footer-links a:hover {
  color: white;
}
