/**
 * Johnson Appointments Booking - Frontend Styles
 */

/* Booking Button Styles */
.jab-booking-button-wrapper {
  margin: 20px 0;
  padding: 15px;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 5px;
  text-align: center;
}

.jab-book-appointment-btn {
  cursor: pointer !important;
}

.jab-book-appointment-btn .dashicons {
  margin-right: 8px;
  vertical-align: middle;
}

/* Cart Page Booking Button */
.jab-cart-page-booking {
  margin-top: 20px;
  text-align: center;
}

.jab-cart-page-booking .dashicons {
  margin-right: 8px;
  vertical-align: middle;
}

/* Booking Form Styles */
.jab-booking-form-wrapper {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.jab-booking-form-wrapper h2 {
  text-align: center;
  color: #333;
  margin-bottom: 30px;
  font-size: 28px;
}

/* Cart Summary */
.jab-cart-summary {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 5px;
  margin-bottom: 30px;
  border: 1px solid #e9ecef;
}

.jab-cart-summary h3 {
  color: #495057;
  margin-bottom: 15px;
  font-size: 20px;
}

.jab-products-list {
  display: grid;
  gap: 15px;
}

.jab-product-item {
  background: white;
  padding: 15px;
  border-radius: 5px;
  border: 1px solid #dee2e6;
}

.jab-product-item h4 {
  color: #333;
  margin: 0 0 10px 0;
  font-size: 18px;
}

.jab-product-quantity {
  color: #6c757d;
  margin: 0 0 10px 0;
  font-size: 14px;
}

.jab-product-addons h5 {
  color: #495057;
  margin: 10px 0 8px 0;
  font-size: 16px;
}

.jab-product-addons ul {
  margin: 0;
  padding-left: 20px;
  color: #6c757d;
}

.jab-product-addons li {
  margin-bottom: 5px;
}

/* Form Styles */
.jab-booking-form {
  display: grid;
  gap: 20px;
}

.jab-form-row {
  display: flex;
  flex-direction: column;
}

.jab-form-row label {
  font-weight: 600;
  color: #495057;
  margin-bottom: 8px;
  font-size: 16px;
}

.jab-form-row input,
.jab-form-row select,
.jab-form-row textarea {
  padding: 12px;
  border: 2px solid #e9ecef;
  border-radius: 5px;
  font-size: 16px;
  transition: border-color 0.3s ease;
}

.jab-form-row input:focus,
.jab-form-row select:focus,
.jab-form-row textarea:focus {
  outline: none;
  border-color: #007cba;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.jab-form-row small {
  color: #6c757d;
  font-size: 14px;
  margin-top: 5px;
}

.jab-submit-btn {
  background: #28a745 !important;
  color: white !important;
  border: none !important;
  padding: 15px 30px !important;
  font-size: 18px !important;
  border-radius: 5px !important;
  cursor: pointer !important;
  transition: background-color 0.3s ease !important;
  font-weight: 600 !important;
}

.jab-submit-btn:hover {
  background: #218838 !important;
}

.jab-submit-btn:disabled {
  background: #6c757d !important;
  cursor: not-allowed !important;
}

/* Form Messages */
.jab-form-messages {
  margin-top: 20px;
}

.jab-message {
  padding: 15px;
  border-radius: 5px;
  margin-bottom: 15px;
  font-weight: 500;
}

.jab-message-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.jab-message-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* My Appointments Styles */
.jab-my-appointments-wrapper {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
}

.jab-my-appointments-wrapper h2 {
  text-align: center;
  color: #333;
  margin-bottom: 30px;
  font-size: 28px;
}

.jab-appointments-list {
  display: grid;
  gap: 20px;
}

.jab-appointment-item {
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.3s ease;
}

.jab-appointment-item:hover {
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.jab-appointment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #e9ecef;
}

.jab-appointment-header h3 {
  margin: 0;
  color: #333;
  font-size: 20px;
}

.jab-appointment-status {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
}

.jab-status-pending {
  background: #fff3cd;
  color: #856404;
}

.jab-status-confirmed {
  background: #d1ecf1;
  color: #0c5460;
}

.jab-status-completed {
  background: #d4edda;
  color: #155724;
}

.jab-status-cancelled {
  background: #f8d7da;
  color: #721c24;
}

.jab-appointment-details {
  display: grid;
  gap: 15px;
  margin-bottom: 20px;
}

.jab-appointment-details > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f8f9fa;
}

.jab-appointment-details strong {
  color: #495057;
  font-weight: 600;
}

.jab-appointment-options ul {
  margin: 0;
  padding-left: 20px;
  color: #6c757d;
}

.jab-appointment-options li {
  margin-bottom: 5px;
}

.jab-appointment-actions {
  text-align: right;
}

.jab-cancel-appointment {
  background: #dc3545 !important;
  color: white !important;
  border: none !important;
  padding: 8px 16px !important;
  border-radius: 5px !important;
  cursor: pointer !important;
  transition: background-color 0.3s ease !important;
}

.jab-cancel-appointment:hover {
  background: #c82333 !important;
}

/* Checkout Booking Fields */
#jab-checkout-booking-fields {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 5px;
  margin-bottom: 20px;
  border: 1px solid #e9ecef;
}

#jab-checkout-booking-fields h3 {
  color: #495057;
  margin-bottom: 20px;
  font-size: 20px;
}

/* Login Required Messages */
.jab-login-required,
.jab-phone-required,
.jab-no-products,
.jab-no-appointments {
  text-align: center;
  padding: 40px 20px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.jab-login-required p,
.jab-phone-required p,
.jab-no-products p,
.jab-no-appointments p {
  color: #6c757d;
  font-size: 16px;
  margin-bottom: 15px;
}

.jab-login-required a,
.jab-phone-required a,
.jab-no-products a,
.jab-no-appointments a {
  color: #007cba;
  text-decoration: none;
}

.jab-login-required a:hover,
.jab-phone-required a:hover,
.jab-no-products a:hover,
.jab-no-appointments a:hover {
  text-decoration: underline;
}

/* Branch Selection Styles */
.jab-branches-selection {
  display: grid;
  gap: 20px;
  margin-top: 10px;
}

.jab-branch-option {
  border: 2px solid #e9ecef;
  border-radius: 8px;
  padding: 20px;
  transition: all 0.3s ease;
  cursor: pointer;
  background: #fff;
  position: relative;
}

.jab-branch-option:hover {
  border-color: #007cba;
  box-shadow: 0 4px 12px rgba(0, 124, 186, 0.15);
}

.jab-branch-option:has(input[type="radio"]:checked) {
  border-color: #007cba;
  background: #f8f9ff;
  box-shadow: 0 4px 12px rgba(0, 124, 186, 0.2);
}

.jab-branch-radio {
  display: block;
  cursor: pointer;
  margin: 0;
}

.jab-branch-radio input[type="radio"] {
  display: none;
}

.jab-branch-radio input[type="radio"]:checked + .jab-branch-info {
  border-left: 4px solid #007cba;
  padding-left: 16px;
}

.jab-branch-option:has(input[type="radio"]:checked)::before {
  content: "✓";
  position: absolute;
  top: 15px;
  right: 15px;
  background: #007cba;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
}

.jab-branch-info {
  padding-left: 20px;
  transition: all 0.3s ease;
}

.jab-branch-name {
  margin: 0 0 15px 0;
  color: #007cba;
  font-size: 20px;
  font-weight: 600;
}

.jab-branch-address,
.jab-branch-phone,
.jab-branch-email,
.jab-branch-hours {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  color: #495057;
  font-size: 14px;
}

.jab-branch-address i,
.jab-branch-phone i,
.jab-branch-email i,
.jab-branch-hours i {
  margin-right: 8px;
  color: #6c757d;
  width: 16px;
  text-align: center;
}

.jab-branch-phone a,
.jab-branch-email a {
  color: #007cba;
  text-decoration: none;
}

.jab-branch-phone a:hover,
.jab-branch-email a:hover {
  text-decoration: underline;
}

.jab-branch-hours {
  align-items: flex-start;
  margin-top: 15px;
}

.jab-branch-hours strong {
  margin-right: 8px;
  color: #495057;
}

.jab-hours-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 5px;
}

.jab-day-open,
.jab-day-closed {
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.jab-day-open {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.jab-day-closed {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.jab-no-branches {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  padding: 20px;
  text-align: center;
  color: #6c757d;
}

/* Calendar Day Blocking */
.ui-datepicker-calendar .jab-day-closed {
  background-color: #f8d7da !important;
  color: #721c24 !important;
  cursor: not-allowed !important;
  position: relative;
}

.ui-datepicker-calendar .jab-day-closed a {
  color: #721c24 !important;
  text-decoration: line-through !important;
  opacity: 0.6;
}

.ui-datepicker-calendar .jab-day-closed:hover {
  background-color: #f8d7da !important;
}

.ui-datepicker-calendar .jab-day-closed::after {
  content: "✗";
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 10px;
  color: #721c24;
  font-weight: bold;
}

/* Responsive Design */
@media (max-width: 768px) {
  .jab-booking-form-wrapper {
    padding: 15px;
    margin: 10px;
  }

  .jab-branches-selection {
    gap: 15px;
  }

  .jab-branch-option {
    padding: 15px;
  }

  .jab-branch-name {
    font-size: 18px;
  }

  .jab-hours-list {
    flex-direction: column;
    gap: 4px;
  }

  .jab-day-open,
  .jab-day-closed {
    font-size: 11px;
    padding: 1px 4px;
  }

  .jab-appointment-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .jab-appointment-details > div {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }

  .jab-appointment-actions {
    text-align: center;
  }

  .jab-submit-btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .jab-booking-form-wrapper h2 {
    font-size: 24px;
  }

  .jab-my-appointments-wrapper h2 {
    font-size: 24px;
  }

  .jab-appointment-item {
    padding: 15px;
  }

  .jab-appointment-header h3 {
    font-size: 18px;
  }
}

/* Appointments Table Styles */
.jab-appointments-table-wrapper {
  overflow-x: auto;
  margin-top: 20px;
}

.jab-appointments-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.jab-appointments-table th {
  background: #f8f9fa;
  padding: 15px;
  text-align: left;
  font-weight: 600;
  color: #495057;
  border-bottom: 2px solid #e9ecef;
}

.jab-appointments-table td {
  padding: 15px;
  border-bottom: 1px solid #e9ecef;
  vertical-align: middle;
}

.jab-appointments-table tr:hover {
  background: #f8f9fa;
}

.jab-appointment-row.jab-status-pending {
  border-left: 4px solid #ffc107;
}

.jab-appointment-row.jab-status-confirmed {
  border-left: 4px solid #28a745;
}

.jab-appointment-row.jab-status-cancelled {
  border-left: 4px solid #dc3545;
}

.jab-appointment-row.jab-status-completed {
  border-left: 4px solid #6c757d;
}

.jab-appointment-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.jab-appointment-actions .button {
  padding: 6px 12px;
  font-size: 14px;
  border-radius: 4px;
  text-decoration: none;
  display: inline-block;
  cursor: pointer;
  border: none;
  transition: all 0.3s ease;
}

.jab-view-appointment-details {
  background: #007cba !important;
  color: white !important;
}

.jab-view-appointment-details:hover {
  background: #005a87 !important;
}

/* Modal Styles */
.jab-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}

.jab-modal-content {
  background-color: #fff;
  margin: 5% auto;
  padding: 0;
  border-radius: 8px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.jab-modal-header {
  padding: 20px;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.jab-modal-header h3 {
  margin: 0;
  color: #495057;
  font-size: 20px;
}

.jab-modal-close {
  font-size: 28px;
  font-weight: bold;
  color: #6c757d;
  cursor: pointer;
  line-height: 1;
}

.jab-modal-close:hover {
  color: #495057;
}

.jab-modal-body {
  padding: 20px;
}

.jab-appointment-details-full {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.jab-appointment-detail {
  display: flex;
  border-bottom: 1px solid #f1f3f4;
  padding-bottom: 15px;
}

.jab-appointment-detail:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.jab-appointment-detail-label {
  font-weight: 600;
  color: #495057;
  min-width: 120px;
  flex-shrink: 0;
}

.jab-appointment-detail-value {
  color: #6c757d;
  flex: 1;
}

.jab-appointment-options ul {
  margin: 10px 0;
  padding-left: 20px;
}

.jab-appointment-options li {
  margin-bottom: 5px;
}

.jab-loading {
  text-align: center;
  padding: 40px;
  color: #6c757d;
  font-style: italic;
}

.jab-loading::before {
  content: "⏳ ";
  margin-right: 8px;
}

/* Responsive Table */
@media (max-width: 768px) {
  .jab-appointments-table {
    font-size: 14px;
  }

  .jab-appointments-table th,
  .jab-appointments-table td {
    padding: 10px 8px;
  }

  .jab-appointment-actions {
    flex-direction: column;
    gap: 5px;
  }

  .jab-appointment-actions .button {
    width: 100%;
    text-align: center;
  }

  .jab-modal-content {
    width: 95%;
    margin: 10% auto;
  }

  .jab-appointment-detail {
    flex-direction: column;
    gap: 5px;
  }

  .jab-appointment-detail-label {
    min-width: auto;
  }
}

/* WooCommerce My Account Endpoint Styles */
.woocommerce-account .jab-endpoint-description {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 5px;
  border-left: 4px solid #007cba;
  margin-bottom: 20px;
  color: #495057;
  font-size: 14px;
}

/* My Account Integration Notice */
.jab-my-account-notice {
  background: #e7f3ff;
  border: 1px solid #007cba;
  border-radius: 5px;
  padding: 15px;
  margin-bottom: 20px;
  text-align: center;
}

.jab-my-account-notice p {
  margin: 0;
  color: #005a87;
  font-size: 14px;
}

.jab-my-account-notice a {
  color: #007cba;
  text-decoration: none;
  font-weight: 600;
}

.jab-my-account-notice a:hover {
  text-decoration: underline;
}

.woocommerce-account .jab-my-appointments-wrapper {
  margin-top: 0;
}

.woocommerce-account .jab-my-appointments-wrapper h2 {
  margin-top: 0;
  margin-bottom: 20px;
  color: #23282d;
  font-size: 24px;
  border-bottom: 2px solid #007cba;
  padding-bottom: 10px;
}

/* My Account Navigation Highlight */
.woocommerce-MyAccount-navigation-link--appointments a {
  color: #007cba;
  font-weight: 600;
}

.woocommerce-MyAccount-navigation-link--appointments.is-active a {
  background-color: #007cba;
  color: white;
}

/* Responsive My Account */
@media (max-width: 768px) {
  .woocommerce-account .jab-my-appointments-wrapper h2 {
    font-size: 20px;
  }

  .woocommerce-account .jab-endpoint-description {
    padding: 12px;
    font-size: 13px;
  }
}

/* Remove calendar icon from JAB date field */
#jab_appointment_date {
  background-image: none !important;
  background: none !important;
}

/* Remove jQuery UI datepicker calendar icon */
#jab_appointment_date.hasDatepicker {
  background-image: none !important;
  background: none !important;
}

/* Override theme's calendar icon rules specifically for JAB date field */
html:not(.browser-Firefox) #jab_appointment_date,
html:not(.browser-Firefox) #jab_appointment_date.hasDatepicker,
html:not(.browser-Firefox) [class*="color-scheme-light"] #jab_appointment_date,
html:not(.browser-Firefox)
  [class*="color-scheme-light"]
  #jab_appointment_date.hasDatepicker {
  background-image: none !important;
  background: none !important;
}

/* Ensure no calendar icon shows for JAB date field in any browser */
#jab_appointment_date::-webkit-calendar-picker-indicator {
  display: none !important;
}

#jab_appointment_date::-webkit-inner-spin-button {
  display: none !important;
}

#jab_appointment_date::-webkit-clear-button {
  display: none !important;
}

/* Additional jQuery UI datepicker icon removal */
.ui-datepicker-trigger {
  display: none !important;
}

/* Target any datepicker icon that might be added by jQuery UI */
#jab_appointment_date + .ui-datepicker-trigger,
#jab_appointment_date + img[src*="calendar"],
#jab_appointment_date + .ui-icon-calendar {
  display: none !important;
}
