/* Modern Calculator Design - Compatible with existing site structure */
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f8f9fa;
  line-height: 1.6;
}

/* Modern Calculator Container - Work within grid system */
.modern-calculator {
  max-width: none !important;
  width: 100%;
  margin: 0;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  /* Remove the transform positioning that breaks the grid */
  /* Let it flow naturally within the left grid area */
}

/* Calculator Header */
.calculator-header {
  background: linear-gradient(135deg, #053b7d 0%, #298bac 100%);
  color: white;
  padding: 30px;
  text-align: center;
}

.calculator-title {
  font-size: 2.2rem;
  font-weight: 700;
  margin: 0 0 10px 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.calculator-subtitle {
  font-size: 1.1rem;
  margin: 0;
  opacity: 0.9;
  font-weight: 300;
}

/* Calculator Content */
.calculator-content {
  padding: 30px;
}

/* Input Section */
.input-section {
  margin-bottom: 30px;
}

.input-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 25px;
  margin-bottom: 25px;
}

.input-column {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.section-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: #053b7d;
  margin: 0 0 15px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid #053b7d;
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  font-weight: 500;
  color: #495057;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e9ecef;
  border-radius: 6px;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  background-color: white;
  box-sizing: border-box;
}

.form-control:focus {
  outline: none;
  border-color: #053b7d;
  box-shadow: 0 0 0 3px rgba(5, 59, 125, 0.1);
}

.form-control:hover {
  border-color: #298bac;
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 25px;
}

.btn {
  padding: 12px 25px;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-primary {
  background: linear-gradient(135deg, #053b7d 0%, #298bac 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(5, 59, 125, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(5, 59, 125, 0.4);
}

.btn-secondary {
  background: #6c757d;
  color: white;
  box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.btn-secondary:hover {
  background: #5a6268;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(108, 117, 125, 0.4);
}

/* Results Section */
.results-section {
  margin-top: 30px;
}

.results-container {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 12px;
  padding: 25px;
  border: 1px solid #dee2e6;
}

.results-title {
  font-size: 1.6rem;
  font-weight: 600;
  color: #053b7d;
  text-align: center;
  margin: 0 0 25px 0;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
}

.result-card {
  background: white;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  border: 1px solid #e9ecef;
  transition: all 0.3s ease;
  text-align: center;
}

.result-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.result-card.highlight {
  background: linear-gradient(135deg, #053b7d 0%, #298bac 100%);
  color: white;
  border: none;
}

.result-card.highlight .result-label,
.result-card.highlight .result-description {
  color: rgba(255, 255, 255, 0.9);
}

.result-icon {
  font-size: 2rem;
  margin-bottom: 10px;
}

.result-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: #6c757d;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.result-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #053b7d;
  margin-bottom: 6px;
}

.result-card.highlight .result-value {
  color: white;
}

.result-description {
  font-size: 0.8rem;
  color: #6c757d;
  line-height: 1.3;
}

/* Error Message */
.alert {
  padding: 15px 20px;
  border-radius: 6px;
  margin-bottom: 20px;
  font-weight: 500;
}

.alert-danger {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .container {
    grid-template-columns: 1fr 280px !important; /* Smaller right column */
  }
  
  .input-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .results-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .container {
    grid-template-areas: "left" "right" "blog-feed" !important;
    grid-template-columns: 1fr !important; /* Single column on mobile */
  }
  
  .calculator-title {
    font-size: 1.8rem;
  }
  
  .calculator-content {
    padding: 20px;
  }
  
  .input-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .action-buttons {
    flex-direction: column;
    align-items: center;
  }
  
  .btn {
    width: 100%;
    max-width: 300px;
  }
  
  .results-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .result-card {
    padding: 15px;
  }
  
  .result-value {
    font-size: 1.3rem;
  }
}

@media (max-width: 480px) {
  .calculator-header {
    padding: 20px;
  }
  
  .calculator-title {
    font-size: 1.6rem;
  }
  
  .calculator-subtitle {
    font-size: 1rem;
  }
  
  .calculator-content {
    padding: 15px;
  }
  
  .input-column {
    padding: 15px;
  }
  
  .result-card {
    padding: 12px;
  }
  
  .result-value {
    font-size: 1.2rem;
  }
}

/* Override sub-container width constraints for modern calculator */
.sub-container {
  max-width: none !important;
  width: 100%;
  overflow: visible;
}

/* Two-column Flex layout (page-specific, robust) */
body .container {
  padding: 10px 20px !important; /* equal padding */
  max-width: 1200px !important;
  margin: 0 auto !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start !important;
  gap: 12px !important;
  flex-wrap: wrap !important; /* allow full-width items like breadcrumb */
}

/* Top full-width breadcrumb */
body .breadcrumb {
  flex: 0 0 100% !important;
  width: 100% !important;
  margin-bottom: 8px !important;
}

/* Left column */
body .left-section {
  order: 1 !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  float: none !important; /* cancel any float fallback */
  margin: 0 !important;
}

/* Right rail blocks stacked on the right */
body .ad-container,
body .blog-feed,
body .extra-section {
  order: 2 !important;
  flex: 0 0 320px !important;
  width: 320px !important;
  align-self: flex-start !important;
  float: none !important; /* cancel any float fallback */
  margin: 0 !important;
}

/* Article formatting inside left column */
body .left-section .content {
  padding: 0 10px !important;
  margin: 0 !important;
}

/* Ensure calculator aligns to top with right rail */
body .left-section .sub-container { 
  margin-top: 0 !important;
}

/* Ensure any stray full-width blocks inside the container go below the columns */
body .scrollable-results {
  order: 3 !important;
  flex: 0 0 100% !important;
  width: 100% !important;
}

/* Mobile/Tablet: stack columns */
@media (max-width: 1024px) {
  body .container {
    display: block !important;
  }
  body .ad-container,
  body .blog-feed,
  body .extra-section,
  body .left-section {
    width: 100% !important;
    flex: 0 0 auto !important;
  }
}

/* Desktop: Force flex layout with maximum specificity */
@media (min-width: 1025px) {
  body .container {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: flex-start !important;
    gap: 12px !important;
    max-width: 1400px !important;
    margin: 0 auto !important;
    padding: 10px 15px !important;
    /* Override any grid properties */
    grid-template-columns: none !important;
    grid-template-rows: none !important;
    grid-template-areas: none !important;
  }
  
  body .left-section {
    flex: 0 1 auto !important;
    max-width: calc(100% - 340px) !important; /* 320px + 20px gap */
    min-width: 0 !important;
    order: 1 !important;
    margin: 0 !important;
    padding: 0 15px !important;
  }
  
  body .right-column-wrapper {
    width: 320px !important;
    flex: 0 0 320px !important;
    order: 2 !important;
    align-self: flex-start !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
  }
  
  body .ad-container,
  body .blog-feed,
  body .extra-section {
    width: 100% !important;
    flex: 0 0 auto !important;
    order: unset !important;
    align-self: stretch !important;
    margin: 0 !important;
    float: none !important;
    clear: none !important;
  }
}

/* Tablet: 768px - 1024px - Stack vertically */
@media (max-width: 1024px) and (min-width: 768px) {
  body .container {
    flex-direction: column !important;
    align-items: center !important;
    padding: 10px 15px !important;
  }
  
  body .left-section {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    margin-bottom: 20px !important;
  }
  
  body .right-column-wrapper {
    width: 100% !important;
    max-width: 600px !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 20px !important;
  }
  
  body .ad-container,
  body .blog-feed,
  body .extra-section {
    flex: 0 0 calc(50% - 10px) !important;
    max-width: 280px !important;
  }
}

/* Mobile: 320px - 767px - Single column, full width */
@media (max-width: 767px) {
  body .container {
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 10px !important;
    max-width: 100% !important;
  }
  
  body .left-section {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    margin-bottom: 20px !important;
  }
  
  body .right-column-wrapper {
    width: 100% !important;
    flex-direction: column !important;
    gap: 15px !important;
  }
  
  body .ad-container,
  body .blog-feed,
  body .extra-section {
    width: 100% !important;
    flex: 0 0 auto !important;
  }
  
  /* Mobile calculator optimizations */
  .modern-calculator .input-grid {
    grid-template-columns: 1fr !important;
    gap: 15px !important;
  }
  
  .modern-calculator .input-column {
    width: 100% !important;
  }
  
  .modern-calculator .results-grid {
    grid-template-columns: 1fr !important;
    gap: 15px !important;
  }
  
  .modern-calculator .result-card {
    padding: 15px !important;
  }
  
  /* Touch-friendly buttons */
  .btn {
    min-height: 44px !important;
    font-size: 16px !important;
    padding: 12px 20px !important;
  }
  
  /* Mobile article content */
  .content {
    padding: 0 !important;
    font-size: 16px !important;
    line-height: 1.6 !important;
  }
  
  .content h2 {
    font-size: 24px !important;
    margin: 20px 0 15px 0 !important;
  }
  
  .content h3 {
    font-size: 20px !important;
    margin: 15px 0 10px 0 !important;
  }
  
  /* Mobile horizontal ads */
  .horizontal_ad {
    margin: 20px 0 !important;
  }
  
  .horizontal_ad ins {
    max-width: 100% !important;
    height: auto !important;
  }
}

/* Ensure article content stays within left grid area */
.content {
  margin: 0 !important;
  max-width: 100% !important;
  width: 100% !important;
  padding: 0 10px !important;
}

/* Copy Widget Section */
.copy-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
}

.disclaimer-text {
    text-align: center;
    font-weight: 600;
    color: #053b7d;
    margin: 20px 0 10px 0;
}


.copy-section h4 {
    margin: 0 0 15px 0;
    color: #053b7d;
    font-size: 1.1rem;
}

.copy-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.copy-button {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.copy-button:hover {
    background: #5a6268;
}