/* --- Two-column layout for calculator --- */

/* Base Items */
.base-items {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.item-card {
  background: #ffffff;
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.25rem;
}

.item-name {
  font-weight: 600;
  font-size: 1.05rem;
  color: #333;
}

.item-price {
  font-weight: 600;
  color: #18bc9c;
}

.item-desc {
  font-size: 0.9rem;
  color: #666;
}

/* Optional Items */
.optional-items {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.category-block {
  border-top: 2px solid #eee;
  padding-top: 1rem;
}

.category-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: #18bc9c;
}

.option-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: #fdfdfd;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.option-card:hover {
  background: #f9f9f9;
  border-color: #18bc9c;
  box-shadow: 0 1px 6px rgba(24, 188, 156, 0.15);
}

.option-card input[type="radio"] {
  margin-top: 0.4rem;
  accent-color: #18bc9c;
}

.option-content {
  flex: 1;
}

.option-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.option-name {
  font-weight: 600;
  font-size: 1.05rem;
}

.option-price {
  font-weight: 600;
  color: #18bc9c;
}

.option-desc {
  font-size: 0.9rem;
  color: #666;
  margin-top: 0.2rem;
}

/* Highlight selected optional cards */
.option-card.active {
  border-color: #18bc9c;
  background-color: #e6f7f2; /* light teal background */
  box-shadow: 0 2px 8px rgba(24, 188, 156, 0.2);
}

/* Step Navigation */
.step {
  display: none;
  transition: opacity 0.3s ease;
}

.step.active {
  display: block;
}

.step-nav {
  margin-top: 1rem;
  display: flex;
  justify-content: space-between;
}

.btn-nav {
  background: var(--primary, #007bff);
  border: none;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 0.4rem;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}

.btn-nav:hover {
  background: #0056b3;
}

.step-indicator {
  text-align: center;
  font-size: 0.9rem;
  color: #666;
  margin-top: 0.5rem;
}

/* Category description */
.category-desc {
  font-size: 0.95rem;
  color: #6c757d;
  font-style: italic;
  margin-top: 0.75rem;
  margin-bottom: 2rem;
  line-height: 1.4;
}

/* Layout: Two-column main area */
.quote-calculator {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 2rem;
  width: 100%;
}

/* Left content area takes remaining space */
.calculator-left {
  flex: 1 1 auto;
  min-width: 0; /* prevents content overflow */
}

/* Right summary panel (responsive width) */
.calculator-right {
  flex: 0 0 25%;
  max-width: 340px;
  background: #f8f9fa;
  border: 1px solid #ddd;
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  font-size: 0.9rem;
}

/* Ensure summary list formatting looks good */
.summary-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.summary-list li {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.35rem;
  border-bottom: 1px solid #eee;
  padding-bottom: 0.25rem;
}

.summary-total {
  text-align: right;
}

/* RESPONSIVE ADJUSTMENTS */
@media (max-width: 992px) {
  .quote-calculator {
    flex-direction: column;
  }

  .calculator-right {
    flex: none;
    width: 100%;
    max-width: 100%;
    margin-top: 2rem;
  }
}

@media (min-width: 992px) {
  .calculator-right {
    position: sticky;
    top: 1rem;
    align-self: flex-start;
  }
}

/* --- Ensure the calculator fills available space and allows scrolling --- */
section.quote-calculator {
  min-height: 100vh; /* ensures full viewport height */
  display: block;
}

.quote-calculator.d-flex {
  align-items: flex-start;
  overflow: visible;
}

.calculator-left {
  overflow: visible;
}

html, body {
  overflow-x: hidden; /* just in case */
}

.step-header {
  position: sticky;
  top: 0;
  background: #fff;
  padding: 0.5rem 0;
  z-index: 2;
  border-bottom: 1px solid #eee;
}

/* Tighten the page header spacing */
.quote-header-section {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
    padding-top: 0; /* ensure no extra padding */
}

.quote-header-section h1 {
    margin-top: 0.25rem; /* reduce default h1 gap */
    margin-bottom: 0.25rem;
    line-height: 1.1;
}

.quote-header-section {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* Reduce top spacing for the calculator area (if any left) */
.quote-calculator {
    margin-top: 0.2rem; /* small gap to separate from header */
}

/* Remove the forced full-viewport height which causes vertical overflow */
section.quote-calculator {
    margin-top: 0.8rem !important;
    padding-top: 0.8rem !important;
}

/* If you want the calculator to appear as close to the header as possible:
   override any Bootstrap utility that still applies */
.quote-calculator.d-flex {
    margin-top: 0;
    margin-bottom: 0;
}

.option-examples a {
    color: var(--bs-primary);
    text-decoration: none;
}

.option-examples a:hover {
    text-decoration: underline;
}

.option-examples a {
    color: #0d6efd; /* Bootstrap primary blue */
    text-decoration: none;
    font-weight: 500;
}

.option-examples a:hover {
    text-decoration: underline;
}

/* --- MOBILE: place summary under calculator and make it full width --- */
@media (max-width: 992px) {
    .quote-calculator {
        flex-direction: column !important; /* ensure column layout on small screens */
        gap: 1rem; /* small gap between sections */
    }

    .calculator-left {
        order: 1; /* left column first */
        width: 100%;
    }

    .calculator-right {
        order: 2; /* summary after left column */
        flex: none;
        width: 100% !important;
        max-width: 100% !important;
        margin-top: 0.75rem;
        padding: 1rem;
    }
}

/* Stack/expand step-nav buttons on small screens for better touch targets */
@media (max-width: 576px) {
    .step-nav {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
    }

        .step-nav .btn-nav,
        .step-header .btn-nav {
            width: 100%;
            display: block;
        }
    /* If you use two step-nav blocks per step (top and bottom), ensure spacing is consistent */
    .step-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
}

@media (max-width: 576px) {
    .quote-header-section {
        padding-bottom: 0.25rem;
        margin-bottom: 0.25rem !important;
    }

    .quote-calculator {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }
}

@media (max-width: 992px) {
    .step-header {
        position: static;
    }
}

/* Prevent text overflow and allow wrapping inside option cards */
.option-card {
    align-items: flex-start; /* keep content aligned to top */
    min-width: 0; /* allow flex children to shrink properly */
}

.option-content {
    min-width: 0; /* important for flex items to prevent overflow */
    overflow-wrap: break-word;
    word-break: break-word;
}

.option-name {
    white-space: normal; /* allow wrapping of long names */
    word-wrap: break-word;
}

.option-desc,
.option-examples {
    white-space: normal;
    word-wrap: break-word;
}

/* Keep price from squashing into name; allow price to shrink but not wrap awkwardly */
.option-price {
    flex-shrink: 0;
    margin-left: 0.5rem;
    white-space: nowrap;
}

#extra-project-block {
    display: none;
}
#summary-extra-list {
    display: none;
}

.section .total,
.section .text-muted.small {
    text-align: center;
}