/*--------------------------------------------------------------
# Modal Styles (Centralized)
# Contains all modal, overlay, and modal component styles
--------------------------------------------------------------*/

/*------------------------------
# Video Modal Subtitle Fixes
------------------------------*/
.modal-video-element {
  width: 100%;
  max-width: 100%;
  height: auto;
}

/* Video modal container constraints */
.modal-content {
  background: var(--surface-color);
  border-radius: 10px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.video-modal-content {
  max-width: 800px;
  width: 95%; /* Ensure video modal is slightly wider */
}

/* Fix subtitle wrapping and positioning */
.modal-video-element::-webkit-media-text-track-display {
  /* WebKit browsers (Chrome, Safari) */
  max-width: 90% !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  white-space: normal !important;
  text-align: center !important;
  margin: 0 auto !important;
  padding: 0 5% !important;
  box-sizing: border-box !important;
  font-size: 16px !important; /* Ensure readable font size */
  line-height: 1.4 !important; /* Better line spacing */
}

/* Firefox subtitle styling */
.modal-video-element::cue {
  max-width: 90% !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  white-space: normal !important;
  text-align: center !important;
  margin: 0 auto !important;
  padding: 0 5% !important;
  box-sizing: border-box !important;
  font-size: 16px !important;
  line-height: 1.4 !important;
}

/* Ensure video container has proper overflow handling */
.modal-body {
  padding: 30px;
  overflow: hidden; /* Prevent subtitle overflow */
}

.modal-body video {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
}

/* Additional subtitle positioning for better visibility */
.modal-video-element::-webkit-media-text-track-container {
  max-width: 100% !important;
  overflow: hidden !important;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
  .video-modal-content {
    width: 98%;
    max-width: 95vw;
  }
  
  .modal-video-element::-webkit-media-text-track-display,
  .modal-video-element::cue {
    max-width: 95% !important;
    font-size: 14px !important;
    padding: 0 2.5% !important;
  }
}

/*------------------------------
# Custom Modal (Automations Store, etc.)
------------------------------*/
.custom-modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(30, 34, 44, 0.45);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
}
.custom-modal-backdrop.hidden {
  display: none;
}
.custom-modal-content {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  padding: 32px 32px 24px 32px;
  max-width: 900px;
  width: 100%;
  position: relative;
  min-width: 340px;
}
.custom-modal-close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  background: none;
  border: none;
  font-size: 2rem;
  color: #888;
  cursor: pointer;
  z-index: 10;
  transition: color 0.2s;
}
.custom-modal-close-btn:hover {
  color: #222;
}
.custom-modal-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: #222;
}
.custom-modal-tabs {
  display: flex;
  gap: 24px;
  border-bottom: 2px solid #e5eaf1;
  margin-bottom: 24px;
  padding-bottom: 4px;
}
.custom-modal-tabs span {
  font-size: 1.1rem;
  color: #888;
  padding: 0 8px 8px 8px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.custom-modal-tabs .active {
  color: #222;
  border-bottom: 2px solid #0078d4;
  font-weight: 500;
}
.custom-modal-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px 32px;
  margin-top: 12px;
}
@media (min-width: 700px) {
  .custom-modal-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
.custom-modal-card {
  background: #f8fafd;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  padding: 18px 16px 16px 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 170px;
  position: relative;
  border: 2px solid transparent;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.custom-modal-card.highlight {
  border-color: #e74c3c;
  box-shadow: 0 0 0 3px #ffe5e0;
}
.custom-modal-card-icon {
  width: 36px;
  height: 36px;
  margin-bottom: 10px;
  border-radius: 8px;
  background: #e5eaf1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.commercial-marketplace { background: #0078d4; }
.windows { background: #0078d4; }
.hardware { background: #222; }
.edge { background: #0078d4; }
.copilot { background: linear-gradient(135deg, #fbbc05 0%, #34a853 50%, #4285f4 100%); }
.minecraft { background: #22a532; }
.custom-modal-card-title {
  font-size: 1.08rem;
  font-weight: 600;
  color: #222;
  margin-bottom: 4px;
}
.custom-modal-card-desc {
  font-size: 0.98rem;
  color: #555;
  margin-bottom: 10px;
}
.custom-modal-card-link {
  font-size: 0.97rem;
  color: #0078d4;
  text-decoration: underline;
  margin-top: auto;
  font-weight: 500;
  transition: color 0.2s;
}
.custom-modal-card-link:hover {
  color: #005fa3;
}

/* Automation Store Modal Icons */
.calendar-automation { 
  background: #3b82f6; 
  position: relative;
}
.calendar-automation::before {
  content: "\f596"; /* bi-stopwatch - represents time/calendar */
  color: white;
  font-size: 18px;
}

.email-automation { 
  background: #10b981; 
  position: relative;
}
.email-automation::before {
  content: "\f32f"; /* bi-envelope */
  color: white;
  font-size: 18px;
}

.marketing-outreach { 
  background: #f59e0b; 
  position: relative;
}
.marketing-outreach::before {
  content: "\f52e"; /* bi-share */
  color: white;
  font-size: 18px;
}

.marketing-research { 
  background: #8b5cf6; 
  position: relative;
}
.marketing-research::before {
  content: "\f52a"; /* bi-search */
  color: white;
  font-size: 18px;
}

.personal-assistant { 
  background: #ef4444; 
  position: relative;
}
.personal-assistant::before {
  content: "\f4d3"; /* bi-person - represents personal assistant */
  color: white;
  font-size: 18px;
}

.quote-to-cash { 
  background: #06b6d4; 
  position: relative;
}
.quote-to-cash::before {
  content: "\f636"; /* bi-currency-dollar */
  color: white;
  font-size: 18px;
}

/*------------------------------
# Generic Modal Styles (.modal, .modal-content, .modal-backdrop)
------------------------------*/
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}
.modal.show {
  display: flex;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 30px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}
.modal-header h3 {
  margin: 0;
  color: var(--heading-color);
  font-size: 1.5rem;
  font-weight: 600;
}
.modal-body {
  padding: 30px;
}
.modal-body video {
  width: 100%;
}

/*------------------------------
# Contact Modal Styles (if used)
------------------------------*/
.contact-modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(30, 34, 44, 0.45);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
}
.contact-modal-backdrop.hidden {
  display: none;
}
.contact-modal-content {
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  padding: 40px 36px 32px 36px;
  max-width: 540px;
  width: 100%;
  position: relative;
  min-width: 320px;
  font-family: var(--default-font);
}
.contact-modal-header {
  margin-bottom: 10px;
}
.contact-modal-header h2 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--heading-color);
  margin: 0 0 8px 0;
  text-align: left;
}
.contact-modal-subtitle {
  font-size: 1.08rem;
  color: #485664;
  margin-bottom: 28px;
  text-align: left;
}
.contact-modal-close-btn {
  position: absolute;
  top: 22px;
  right: 22px;
  background: none;
  border: none;
  font-size: 2rem;
  color: #b0b6be;
  cursor: pointer;
  transition: color 0.2s;
  z-index: 10;
  line-height: 1;
}
.contact-modal-close-btn:hover {
  color: #3b82f6;
}

/* Form Layout */
.contact-modal-body form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.contact-modal-body .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) {
  .contact-modal-body .form-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}
.contact-modal-body .form-group {
  display: flex;
  flex-direction: column;
}
.contact-modal-body .form-control {
  width: 100%;
  padding: 18px 20px;
  border: 1.5px solid #e5eaf1;
  border-radius: 14px;
  font-size: 1.08rem;
  color: var(--default-color);
  background: #f8fafc;
  margin-bottom: 0;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: var(--default-font);
}
.contact-modal-body .form-control:focus {
  border-color: #3b82f6;
  outline: none;
  background: #fff;
  box-shadow: 0 0 0 2px #e0eaff;
}
.contact-modal-body .form-control::placeholder {
  color: #b0b6be;
  opacity: 1;
  font-size: 1.08rem;
}
.contact-modal-body textarea.form-control {
  min-height: 110px;
  resize: vertical;
}

/* reCAPTCHA v3 (invisible) - no styling needed */

/* Submit Button */
.contact-modal-body button[type="submit"] {
  width: 100%;
  padding: 18px 0;
  background: #3b82f6;
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-top: 10px;
  transition: background 0.2s, transform 0.2s;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.10);
}
.contact-modal-body button[type="submit"]:hover {
  background: #2563eb;
  transform: translateY(-2px) scale(1.01);
}

/* Remove default button outline on click */
.contact-modal-body button[type="submit"]:focus {
  outline: none;
  box-shadow: 0 0 0 2px #e0eaff;
}

/* Error, loading, sent messages (reuse modal styles) */
.contact-modal-body .loading,
.contact-modal-body .error-message,
.contact-modal-body .sent-message {
  display: none;
  margin: 10px 0 0 0;
  padding: 12px;
  border-radius: 8px;
  font-size: 1rem;
  text-align: center;
}
.contact-modal-body .loading { color: #485664; background: #f3f4f6; }
.contact-modal-body .error-message { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.contact-modal-body .sent-message { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }

/*------------------------------
# Modal Utility Classes
------------------------------*/
.hidden {
  display: none !important;
}

/* Generic close button for modals */
.close-btn {
  position: absolute;
  top: -10px;
  right: -5px;
  color: #fff;
  background-color: #000;
  border: 2px solid #fff;
  border-radius: 50%;
  width: 35px;
  height: 35px;
  font-size: 24px;
  line-height: 30px;
  text-align: center;
  font-weight: bold;
  cursor: pointer;
  z-index: 10001;
  transition: all 0.2s ease-in-out;
}
.close-btn:hover {
  transform: scale(1.1);
  background-color: var(--accent-color);
}

/*------------------------------
# Form Styles for Modals
------------------------------*/
/* Loading and message styles for modal forms */
.loading, .error-message, .sent-message {
  display: none;
  margin: 10px 0;
  padding: 10px;
  border-radius: 5px;
}
.loading {
  color: var(--default-color);
}
.error-message {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}
.sent-message {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

/* reCAPTCHA v3 (invisible) - no styling needed */

/* PHP Email Form Messages for modals */
.php-email-form .error-message {
  display: none;
  color: #fff;
  background: #ed3c0d;
  text-align: left;
  padding: 15px;
  font-weight: 600;
}
.php-email-form .error-message br+br {
  margin-top: 25px;
}
.php-email-form .sent-message {
  display: none;
  color: #fff;
  background: #18d26e;
  text-align: center;
  padding: 15px;
  font-weight: 600;
}
.php-email-form .loading {
  display: none;
  background: #fff;
  text-align: center;
  padding: 15px;
}
.php-email-form .loading:before {
  content: "";
  display: inline-block;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  margin: 0 10px -6px 0;
  border: 3px solid #18d26e;
  border-top-color: #eee;
  animation: php-email-form-loading 1s ease-in-out infinite;
}
@keyframes php-email-form-loading {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}