/* Base & Layout */
body {
  background: #f4f6f8;
  font-family: 'Segoe UI', Tahoma, sans-serif;
  color: #333;
  margin: 0;
  padding: 0;
}
.container {
  max-width: 600px;
  margin: 2rem auto;
  background: #fff;
  padding: 2rem;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
h1 {
  text-align: center;
  margin-bottom: 1.5rem;
  color: #2c3e50;
}

/* Form Elements */
label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #2c3e50;
}
input,
select,
textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
  transition: border-color 0.2s;
}
input:focus,
select:focus,
textarea:focus {
  border-color: #2980b9;
  outline: none;
}

/* Stepper */
.checkout-stepper {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding: 0;
  list-style: none;
}
.checkout-stepper .step {
  flex: 1;
  position: relative;
  font-size: 0.9rem;
  color: #7f8c8d;
  text-align: center;
}
.checkout-stepper .step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 0;
  width: 100%;
  height: 2px;
  background: #ecf0f1;
  transform: translateY(-50%);
  z-index: -1;
}
.checkout-stepper .step.completed,
.checkout-stepper .step.active {
  color: #2980b9;
}
.checkout-stepper .step.completed::before,
.checkout-stepper .step.active::before {
  content: '✓';
  display: inline-block;
  width: 1.6rem;
  height: 1.6rem;
  line-height: 1.6rem;
  background: #2980b9;
  color: #fff;
  border-radius: 50%;
  margin-bottom: 0.5rem;
}
.checkout-stepper .step:not(.completed):not(.active)::before {
  content: '';
  display: inline-block;
  width: 1.6rem;
  height: 1.6rem;
  border: 2px solid #7f8c8d;
  border-radius: 50%;
  margin-bottom: 0.5rem;
}

/* Stripe Elements */
#stripeContainer {
  margin-bottom: 1.5rem;
}
#cardElement {
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 0.75rem;
}
#cardErrors {
  color: #e74c3c;
  min-height: 1.2rem;
  margin-top: -0.5rem;
  margin-bottom: 1rem;
}

/* Submit Button */
button[type="submit"] {
  background: #2980b9;
  color: #fff;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.3s;
  display: block;
  width: 100%;
}
button[type="submit"]:hover {
  background: #1c5980;
}
/* ––––– Panel Footer ––––– */
.panel-footer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid #ddd;
}
.cart-summary {
  flex: 1;
  font-size: 0.95rem;
}

/* ––––– Buttons ––––– */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.6rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: transform 0.2s, box-shadow 0.2s;
  white-space: normal;
  text-align: center;
}
.btn.small {
  font-size: 0.75rem;
  line-height: 1.2;
}
.btn.primary {
  background: #2980b9;
  color: #fff;
}
.btn.primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.btn.secondary {
  background: #ecf0f1;
  color: #2c3e50;
}
.btn.secondary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.btn-icon {
  background: transparent;
  color: #2c3e50;
  padding: 0.3rem;
  font-size: 1.1rem;
  transition: color 0.2s;
}
.btn-icon:hover {
  color: #2980b9;
}
/* allow <br> in .btn-text to wrap */
.btn-text { display: inline-block; line-height: 1.2; }

/* ––––– Modal ––––– */
/* Base modal container */
.modal {
  position: fixed;
  inset: 0; /* top:0; right:0; bottom:0; left:0 */
  display: none;            /* hidden by default */
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

/* Visible state (toggle this via JS) */
.modal.show {
  display: flex;
}

/* Optional helper if your JS uses .hidden */
.modal.hidden {
  display: none !important;
}

/* Dimmed backdrop */
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

/* Modal content wrapper */
.modal-content {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #fff;           /* white canvas behind the PDF */
  width: min(1200px, 96vw);
  height: min(92vh, 1000px);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  overflow: hidden;           /* keep iframe clipped inside */
  z-index: 1;                 /* above backdrop */
}

/* Header */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: #f7f7f8;
  border-bottom: 1px solid #e6e6e6;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.modal-actions {
  display: inline-flex;
  gap: 8px;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 32px;
  border: 1px solid #d8d8d8;
  background: #fff;
  color: #333;
  border-radius: 6px;
  cursor: pointer;
}

.btn-icon:hover { background: #f1f1f1; }

/* Screen-reader only text */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,1px,1px);
  white-space: nowrap; border: 0;
}

/* Body with the PDF iframe */
.modal-body {
  position: relative;
  flex: 1 1 auto;
  background: #fff;
  display: flex;
}

#pdfFrame {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;           /* ensures PDF renders on white, not black */
}

/* Responsive: on very small screens, give more height */
@media (max-width: 480px) {
  .modal-content {
    width: 98vw;
    height: 92vh;
    border-radius: 0;
  }
}

/* Optional: body scroll lock when modal open */
body.modal-open {
  overflow: hidden;
}

/* ------------------------------
   PDF‐Modal overrides
   Must load after Bootstrap’s CSS
   ------------------------------ */

/* 1) Force our modal to use flex so centering & sizing works */
#pdfModal.modal.show {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

/* 2) Give the backdrop its semi-transparent black */
#pdfModal .modal-backdrop {
  background: rgba(0, 0, 0, 0.5);
}

/* 3) Constrain & size the white canvas */
#pdfModal .modal-content {
  /* max width & height
*/
  width: min(1200px, 96vw) !important;
  height: min(92vh, 1000px) !important;
  /* ensure flex flow (header + body) */
  display: flex;
  flex-direction: column;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  border-radius: 8px;
}

/* 4) Make the iframe fill its parent */
#pdfModal #pdfFrame {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}

/* PDF preview modal always on top */
#pdfModal.modal.show {
  z-index: 2000 !important;
}


/* Ensure the modal-content—and its close button—sit above the backdrop */
#pdfModal .modal-backdrop { z-index: 0; pointer-events: auto; }
#pdfModal .modal-content  { z-index: 1; }
#closePdfModal            { z-index: 2; }

.modal-content {
  resize: both;
  overflow: auto;
  max-width: 96vw;
  max-height: 92vh;
}

/* Custom dropdown wrapper */
.custom-dropdown {
  position: relative;
  margin-bottom: 1.5rem;
}

/* Trigger */
.custom-select {
  position: relative;
  cursor: pointer;
}
.custom-select .select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid #ccc;
  padding: 0.5rem;
  border-radius: 3px;
}
.custom-select .select-trigger .trigger-icon {
  width: 20px;
  height: auto;
  margin-right: 0.5rem;
}
.custom-select .select-trigger .arrow {
  margin-left: auto;
  font-size: 0.8rem;
  transition: transform 0.2s;
}
.custom-select.open .arrow {
  transform: rotate(180deg);
}

/* Options list */
.custom-select .options {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 3px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  max-height: 200px;
  overflow-y: auto;
  display: none;
  z-index: 10;
}
.custom-select.open .options {
  display: block;
}
.custom-select .option {
  display: flex;
  align-items: center;
  padding: 0.5rem;
  transition: background 0.1s;
}
.custom-select .option img {
  width: 20px;
  height: auto;
  margin-right: 0.5rem;
}
.custom-select .option:hover {
  background: #f0f0f0;
}
