/**
 * ALLDATA Checkout Styling
 * Matches ALLDATA.com branding and design
 */

/* Checkout Breadcrumb Styling */
.checkout-page .region-breadcrumb {
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  padding: 1rem 0;
}

.checkout-page .region-breadcrumb ol {
  list-style: decimal;
  list-style-position: inside;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.checkout-page .region-breadcrumb ol li {
  display: inline;
  color: #2c3e50;
  font-size: 0.9rem;
}

.checkout-page .region-breadcrumb ol li::marker {
  color: #2c3e50;
  font-weight: 600;
}

.checkout-page .region-breadcrumb ol li a {
  color: #3498db;
  text-decoration: none;
  margin-left: 0.25rem;
}

.checkout-page .region-breadcrumb ol li a:hover {
  text-decoration: underline;
  color: #E62A30;
}

/* Checkout Page Container */
.checkout-page-container {
  background: #ececec;
  min-height: 100vh;
  padding: 0 0 4rem;
}

.checkout-page-container .container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
}

.checkout-header {
  text-align: center;
  margin: 2rem auto 3rem;
  padding: 3rem 2rem;
  background: linear-gradient(135deg, #E62A30 0%, #D14124 100%);
  color: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(230, 42, 48, 0.2);
}

.checkout-header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.checkout-subtitle {
  font-size: 1.1rem;
  margin: 0;
  opacity: 0.95;
  font-weight: 400;
}

/* Checkout Container */
.layout-checkout-form {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0;
}

.layout-region-checkout-main {
  background: transparent;
  padding: 2rem;
  border-radius: 8px;
  width: 65%;
  margin: 0 auto;
}

.layout-region-checkout-secondary {
  background: #fff;
  padding: 0;
  border-radius: 8px;
  border: 2px solid #e0e0e0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  align-self: start;
  position: sticky;
  top: 20px;
  overflow: hidden;
}

.layout-region-checkout-secondary h3 {
  color: #fff;
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  padding: 1.5rem 2rem;
  background: linear-gradient(135deg, #E62A30 0%, #D14124 100%);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.layout-region-checkout-secondary > *:not(h3) {
  padding: 1.5rem 2rem;
}

.layout-region-checkout-footer {
  grid-column: 1 / -1;
  padding-top: 1rem;
}

/* Checkout Progress Bar */
.checkout-progress-wrapper {
  background: #fff;
  padding: 1.5rem 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 2rem;
}

.checkout-progress {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  justify-content: space-between;
  position: relative;
  counter-reset: step;
}

.checkout-progress::before {
  content: '';
  position: absolute;
  top: 20px;
  left: 0;
  right: 0;
  height: 2px;
  background: #e0e0e0;
  z-index: 0;
}

.checkout-progress--step {
  flex: 1;
  text-align: center;
  position: relative;
  z-index: 1;
  counter-increment: step;
}

.checkout-progress--step::before {
  content: counter(step);
  display: block;
  width: 40px;
  height: 40px;
  line-height: 40px;
  margin: 0 auto 0.5rem;
  background: #fff;
  border: 2px solid #e0e0e0;
  border-radius: 50%;
  color: #95a5a6;
  font-weight: 700;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.checkout-progress--step__current::before {
  background: linear-gradient(135deg, #E62A30 0%, #D14124 100%);
  border-color: #E62A30;
  color: #fff;
  box-shadow: 0 0 0 4px rgba(230, 42, 48, 0.1);
}

.checkout-progress--step__previous::before {
  background: #27ae60;
  border-color: #27ae60;
  color: #fff;
}

.checkout-progress--label {
  color: #95a5a6;
  font-size: 0.875rem;
  font-weight: 500;
  display: block;
}

.checkout-progress--step__current .checkout-progress--label {
  color: #E62A30;
  font-weight: 700;
}

.checkout-progress--step__previous .checkout-progress--label {
  color: #27ae60;
  font-weight: 600;
}

/* Checkout Panes */
.checkout-pane {
  margin-bottom: 2rem;
  background: #fff;
  padding: 2rem;
  border-radius: 8px;
}

.checkout-pane h3,
.checkout-pane .fieldset-legend {
  color: #2c3e50;
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
}

/* Exception for login pane which has its own styling */
.checkout-pane-login {
  background: transparent;
  padding: 0;
  border: none;
}

/* Review Page Title */
.checkout-pane-review > h3,
.checkout-pane-review > .fieldset-legend {
  background: linear-gradient(135deg, #E62A30 0%, #D14124 100%);
  color: #fff;
  padding: 1.5rem 2rem;
  margin: -2rem -2rem 2rem -2rem;
  border-radius: 8px 8px 0 0;
  border-bottom: none;
  font-size: 1.5rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Login Pane Specific Styling */
.checkout-pane-login .fieldset-wrapper {
  padding: 0;
}

.form-wrapper__returning-customer .form-item,
.form-wrapper__guest-checkout .form-item {
  margin-bottom: 1.25rem;
}

.form-wrapper__returning-customer .form-actions,
.form-wrapper__guest-checkout .form-actions {
  margin-top: 1.5rem;
  margin-bottom: 0;
}

/* Login Pane - Two Column Layout */
.checkout-pane-login {
  display: flex;
  justify-content: center;
  gap: 2rem;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.checkout-pane-login > fieldset {
  flex: 1;
  max-width: 580px;
}

.form-wrapper__returning-customer,
.form-wrapper__guest-checkout {
  background: #fff;
  padding: 2.5rem;
  border: 3px solid #E62A30;
  border-radius: 8px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.form-wrapper__returning-customer:hover,
.form-wrapper__guest-checkout:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.form-wrapper__returning-customer .fieldset-legend,
.form-wrapper__guest-checkout .fieldset-legend {
  color: #E62A30;
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 1.5rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #E62A30;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-block;
}

.form-wrapper__guest-checkout .fieldset-legend {
  text-align: center;
  width: auto;
}

.form-wrapper__guest-checkout {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.form-wrapper__guest-checkout p {
  color: #2c3e50;
  font-size: 1rem;
  margin: 3rem 0 2rem;
  line-height: 1.6;
  max-width: 80%;
}

.form-wrapper__guest-checkout .fieldset-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
}

/* Ensure equal height for both containers */
.form-wrapper__returning-customer,
.form-wrapper__guest-checkout {
  min-height: 350px;
}

/* Guest checkout button */
.form-wrapper__guest-checkout button {
  max-width: 400px;
  width: 100%;
}

/* Login button styling */
.form-wrapper__returning-customer button[value*="Log in"],
.form-wrapper__returning-customer input[value*="Log in"] {
  margin-top: 1.5rem;
}

/* Form Fields */
.checkout-pane .form-item {
  margin-bottom: 1.25rem;
}

.checkout-pane label {
  display: block;
  color: #2c3e50;
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.checkout-pane input[type="text"],
.checkout-pane input[type="email"],
.checkout-pane input[type="tel"],
.checkout-pane input[type="password"],
.checkout-pane select,
.checkout-pane textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #d1d1d1;
  border-radius: 4px;
  font-size: 1rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  background: #fff;
}

.checkout-pane input[type="text"]:focus,
.checkout-pane input[type="email"]:focus,
.checkout-pane input[type="tel"]:focus,
.checkout-pane input[type="password"]:focus,
.checkout-pane select:focus,
.checkout-pane textarea:focus {
  border-color: #999;
  outline: none;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.checkout-pane .form-required::after {
  content: '*';
  color: #E62A30;
  margin-left: 0.25rem;
  font-weight: 700;
}

.checkout-pane .description {
  color: #7f8c8d;
  font-size: 0.875rem;
  margin-top: 0.25rem;
  font-style: italic;
}

/* Buttons */
.checkout-pane button,
.checkout-pane input[type="submit"],
.layout-region-checkout-footer button,
.layout-region-checkout-footer input[type="submit"] {
  background: #C44D4D;
  color: #fff;
  border: none;
  padding: 0.875rem 2rem;
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s ease;
  letter-spacing: 0.5px;
}

.checkout-pane button,
.checkout-pane input[type="submit"] {
  width: 100%;
}

.checkout-pane button:hover,
.checkout-pane input[type="submit"]:hover,
.layout-region-checkout-footer button:hover,
.layout-region-checkout-footer input[type="submit"]:hover {
  background: #B33D3D;
}

.checkout-pane button:active,
.checkout-pane input[type="submit"]:active,
.layout-region-checkout-footer button:active,
.layout-region-checkout-footer input[type="submit"]:active {
  background: #A32D2D;
}

/* Forgot Password Link */
.form-wrapper__returning-customer a {
  color: #3498db;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  display: inline-block;
  margin-top: 0.5rem;
  transition: color 0.3s ease;
}

.form-wrapper__returning-customer a:hover {
  color: #E62A30;
  text-decoration: underline;
}

.layout-region-checkout-footer {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 2rem;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  width: 60%;
  margin: 0 auto;
}

.layout-region-checkout-footer button,
.layout-region-checkout-footer input[type="submit"] {
  width: auto;
  flex: 1;
  min-width: 200px;
}

.layout-region-checkout-footer button[value*="Back"],
.layout-region-checkout-footer button[value*="Return"] {
  background: #6c757d;
}

.layout-region-checkout-footer button[value*="Back"]:hover,
.layout-region-checkout-footer button[value*="Return"]:hover {
  background: #5a6268;
}

/* Order Summary */
.checkout-order-summary {
  background: transparent;
  padding: 0;
  border-radius: 0;
  margin-top: 0;
}

.layout-region-checkout-secondary .checkout-order-summary {
  padding: 0;
}

.checkout-order-summary > div {
  padding: 0 1.5rem 1.5rem;
}

.checkout-order-summary table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-bottom: 0.5rem;
  background: #fff;
  border: none;
  border-radius: 0;
  overflow: hidden;
}

.checkout-order-summary thead {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.checkout-order-summary thead tr th {
  padding: 1rem;
  text-align: left;
  font-weight: 700;
  color: #2c3e50;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #E62A30;
}

.checkout-order-summary thead tr th:last-child {
  text-align: right;
}

.checkout-order-summary tbody tr {
  border-bottom: 1px solid #e9ecef;
  transition: background 0.2s ease;
}

.checkout-order-summary tbody tr:hover {
  background: #f8f9fa;
}

.checkout-order-summary tbody tr:last-child {
  border-bottom: none;
}

.checkout-order-summary td {
  padding: 1rem;
  color: #2c3e50;
  font-size: 0.95rem;
  vertical-align: middle;
}

.checkout-order-summary td:first-child {
  width: 60px;
  color: #7f8c8d;
  font-weight: 700;
  text-align: center;
}

.checkout-order-summary td:nth-child(2) {
  font-weight: 600;
  color: #2c3e50;
}

.checkout-order-summary td:nth-child(3) {
  text-align: center;
  color: #7f8c8d;
  font-weight: 600;
}

.checkout-order-summary td:last-child {
  text-align: right;
  font-weight: 700;
  color: #E62A30;
  font-size: 1rem;
}

/* Order Totals */
.commerce-order-total-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid #e9ecef;
  color: #2c3e50;
  font-size: 0.95rem;
  background: #fff;
}

.commerce-order-total-line:first-child {
  border-top: 2px solid #e0e0e0;
  margin-top: 1rem;
}

.commerce-order-total-line:last-child {
  border-bottom: none;
  padding: 1.25rem 1rem;
  margin-top: 0;
  border-top: 3px solid #E62A30;
  font-size: 1.35rem;
  font-weight: 700;
  color: #E62A30;
  background: linear-gradient(135deg, #fff5f5 0%, #fff 100%);
}

.commerce-order-total-line__label {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.85rem;
}

.commerce-order-total-line:last-child .commerce-order-total-line__label {
  font-size: 1rem;
  font-weight: 700;
}

.commerce-order-total-line__price {
  font-weight: 700;
  font-size: 1.1rem;
}

.commerce-order-total-line:last-child .commerce-order-total-line__price {
  font-size: 1.5rem;
}

/* Address Fields */
.checkout-pane .address-container-inline {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.checkout-pane .address-container-inline > .form-item {
  margin-bottom: 0;
}

/* Radio and Checkbox Styling */
.checkout-pane input[type="radio"],
.checkout-pane input[type="checkbox"] {
  margin-right: 0.5rem;
  width: 18px;
  height: 18px;
  accent-color: #E62A30;
}

.checkout-pane .form-type-radio,
.checkout-pane .form-type-checkbox {
  display: flex;
  align-items: center;
  margin-bottom: 0.75rem;
}

.checkout-pane .form-type-radio label,
.checkout-pane .form-type-checkbox label {
  margin-bottom: 0;
  cursor: pointer;
}

/* Payment Methods */
.checkout-pane-payment-information .payment-method-option {
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  transition: border-color 0.3s ease;
}

.checkout-pane-payment-information .payment-method-option:hover {
  border-color: #E62A30;
}

.checkout-pane-payment-information .payment-method-option.selected {
  border-color: #E62A30;
  background: rgba(230, 42, 48, 0.05);
}

/* Error Messages */
.checkout-pane .form-item--error input,
.checkout-pane .form-item--error select {
  border-color: #e74c3c;
}

.checkout-pane .form-item--error-message {
  color: #e74c3c;
  font-size: 0.875rem;
  margin-top: 0.25rem;
  font-weight: 600;
}

/* Order Information Page Styling */
.checkout-pane-contact-information:not(.checkout-pane-summary),
.checkout-pane-business-details:not(.checkout-pane-summary),
.checkout-pane-payment-information:not(.checkout-pane-summary) {
  margin-bottom: 2rem;
}

/* Responsive Design */
@media (max-width: 992px) {
  .layout-region-checkout-secondary {
    position: static;
    margin-top: 2rem;
  }

  .checkout-pane-login {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 0 1rem;
  }

  .checkout-progress-wrapper {
    padding: 1rem;
  }

  .checkout-progress {
    font-size: 0.75rem;
  }

  .checkout-progress--step::before {
    width: 32px;
    height: 32px;
    line-height: 32px;
    font-size: 0.875rem;
  }

  .checkout-header h1 {
    font-size: 2rem;
  }

  .checkout-subtitle {
    font-size: 1rem;
  }

  .layout-region-checkout-main {
    width: 100% !important;
  }
}

@media (max-width: 768px) {
  .checkout-pane .address-container-inline {
    grid-template-columns: 1fr;
  }

  .layout-region-checkout-footer {
    flex-direction: column;
    gap: 1rem;
    width: 100%;
  }

  .layout-region-checkout-footer button,
  .layout-region-checkout-footer input[type="submit"] {
    width: 100%;
    flex: none;
  }

  .layout-region-checkout-main,
  .layout-region-checkout-secondary {
    padding: 1.5rem;
  }

  .layout-region-checkout-main {
    width: 100%;
  }
}

/* Loading State */
.checkout-pane.is-loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Checkout Completion Page */
.checkout-complete {
  max-width: 700px;
  margin: 3rem auto;
  padding: 3rem;
  background: #fff;
  border-radius: 8px;
  border: 2px solid #e0e0e0;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.checkout-complete__success-icon {
  margin-bottom: 2rem;
  display: flex;
  justify-content: center;
  animation: successPulse 0.5s ease-out;
}

@keyframes successPulse {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.checkout-complete__message {
  font-size: 1.1rem;
  line-height: 1.8;
  color: #2c3e50;
  margin-bottom: 2rem;
}

.checkout-complete__message p {
  margin-bottom: 1rem;
}

.checkout-complete__message strong {
  color: #E62A30;
  font-size: 1.25rem;
  display: block;
  margin-top: 1rem;
}

.checkout-complete__payment-instructions {
  background: #f8f9fa;
  padding: 1.5rem;
  border-radius: 4px;
  margin: 2rem 0;
  text-align: left;
}

.checkout-complete__payment-instructions h3 {
  color: #2c3e50;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e0e0e0;
}

.checkout-complete__actions {
  margin-top: 2.5rem;
}

.checkout-complete__actions .btn {
  background: #C44D4D;
  color: #fff;
  padding: 0.875rem 2.5rem;
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  border-radius: 4px;
  text-decoration: none;
  display: inline-block;
  transition: background 0.2s ease;
  letter-spacing: 0.5px;
}

.checkout-complete__actions .btn:hover {
  background: #B33D3D;
  text-decoration: none;
}

/* Hide registration form */
.commerce-checkout-completion-register {
  display: none;
}

/* Checkout Review Page Styling */
.checkout-pane-review {
  background: transparent;
  padding: 0;
  border: none;
}

.checkout-pane-review > .fieldset-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Review Summary Panes */
.checkout-pane-review .checkout-pane-summary {
  background: #fff;
  padding: 1.5rem;
  border-radius: 8px;
  border: 2px solid #e0e0e0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.checkout-pane-review .checkout-pane-summary .fieldset-legend {
  color: #2c3e50;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #E62A30;
  display: block;
}

.checkout-pane-review .checkout-pane-summary .fieldset-wrapper {
  color: #2c3e50;
  line-height: 1.8;
}

/* Contact Information Summary */
.checkout-pane-contact-information.checkout-pane-summary {
  display: block !important;
}

.checkout-pane-contact-information.checkout-pane-summary .fieldset-wrapper {
  font-size: 1rem;
}

/* Business Details Summary */
.checkout-pane-business-details.checkout-pane-summary {
  display: block !important;
}

.checkout-pane-business-details.checkout-pane-summary .fieldset-wrapper {
  font-size: 1rem;
}

.checkout-pane-business-details.checkout-pane-summary div {
  margin-top: 0.5rem;
  color: #7f8c8d;
}

/* Payment Information Summary */
.checkout-pane-payment-information.checkout-pane-summary {
  display: block !important;
}

.checkout-pane-payment-information.checkout-pane-summary .profile {
  margin-top: 1rem;
}

.checkout-pane-payment-information.checkout-pane-summary .address {
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 4px;
  border-left: 3px solid #E62A30;
  margin-top: 0.5rem;
}

.checkout-pane-payment-information.checkout-pane-summary .address span {
  display: block;
  line-height: 1.6;
}

.checkout-pane-payment-information.checkout-pane-summary .given-name,
.checkout-pane-payment-information.checkout-pane-summary .family-name {
  font-weight: 600;
}

/* Review Page Layout */
.checkout-pane-review .checkout-pane-summary:hover {
  border-color: #E62A30;
  box-shadow: 0 4px 12px rgba(230, 42, 48, 0.15);
  transition: all 0.3s ease;
}

/* Edit links in review summaries */
.checkout-pane-review .checkout-pane-summary a {
  color: #3498db;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  display: inline-block;
  margin-top: 1rem;
}

.checkout-pane-review .checkout-pane-summary a:hover {
  color: #E62A30;
  text-decoration: underline;
}

/* Hide pane summaries on completion page */
.checkout-pane-completion-message .checkout-pane-summary {
  display: none !important;
}

/* Hide specific completion summaries - Contact, Business, Payment */
.checkout-pane-contact-information.checkout-pane-summary,
.checkout-pane-business-details.checkout-pane-summary,
.checkout-pane-payment-information.checkout-pane-summary,
.checkout-pane-billing-information.checkout-pane-summary {
  display: none !important;
}

/* Hide completion message fieldsets for contact, business, and payment info */
fieldset[data-drupal-selector*="completion-message-contact"],
fieldset[data-drupal-selector*="completion-message-business"],
fieldset[data-drupal-selector*="completion-message-payment"],
fieldset[id*="completion-message-contact"],
fieldset[id*="completion-message-business"],
fieldset[id*="completion-message-payment"] {
  display: none !important;
}

/* Success Messages */
.messages--status {
  background: #d4edda;
  border: 1px solid #c3e6cb;
  color: #155724;
  padding: 1rem 1.5rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

/* Warning Messages */
.messages--warning {
  background: #fff3cd;
  border: 1px solid #ffeeba;
  color: #856404;
  padding: 1rem 1.5rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

/* Error Messages */
.messages--error {
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
  padding: 1rem 1.5rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}
