/* extrch-links.css: Essential styles for extrch.co Link Page */

/* @font-face for Loft Sans handled by theme's style.css to avoid conflicts */

/* Default values for CSS variables REMOVED. All variables are now set by PHP in the <head>. */

body {
    margin: 0;
    padding: 0;
    /* font-family, background-color, and color moved to .extrch-link-page-container */
}

.extrch-link-page-container {
  font-family: var(--link-page-body-font-family); /* Moved from body */
  /* background: var(--link-page-background-color); */ /* REMOVED background shorthand */
  color: var(--link-page-text-color); /* Moved from body - default text color for the page */
  width: 100%;
  min-height: 100vh; /* Ensure container takes full viewport height */
  padding: 25px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Ensure card text color inherits from body by default, or can be specifically set if needed */
  color: inherit; 
}

.extrch-link-page-container[data-bg-type="color"] {
  background-color: var(--link-page-background-color);
  background-image: none; /* Explicitly remove image/gradient */
}

.extrch-link-page-container[data-bg-type="gradient"] {
  background: linear-gradient(
    var(--link-page-background-gradient-direction),
    var(--link-page-background-gradient-start),
    var(--link-page-background-gradient-end)
  );
  background-image: linear-gradient(
    var(--link-page-background-gradient-direction),
    var(--link-page-background-gradient-start),
    var(--link-page-background-gradient-end)
  );
  background-color: transparent; /* Ensure no base color shows through */
}
.extrch-link-page-container[data-bg-type="image"] {
  background-image: var(--link-page-background-image-url);
  background-size: var(--link-page-image-size); /* Use variable */
  background-position: var(--link-page-image-position); /* Use variable */
  background-repeat: var(--link-page-image-repeat); /* Use variable */
  background-color: transparent; /* Ensure no base color shows through */
}

.extrch-link-page-content-wrapper {
  background-color: var(--link-page-card-bg-color);
  color: inherit;
  width: 100%;
  max-width: 680px;
  padding: 2.5em;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.extrch-link-page-content-wrapper.no-overlay {
  background: none !important;
  box-shadow: none !important;
}

.extrch-link-page-profile-img {
  margin: 0 auto 15px auto;
  overflow: hidden;
  width: var(--link-page-profile-img-size);
  min-width: 60px;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: var(--link-page-profile-img-aspect-ratio);
  border-radius: var(--link-page-profile-img-border-radius);
}
.extrch-link-page-profile-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}

.extrch-link-page-profile-img.shape-circle {
  --link-page-profile-img-aspect-ratio: 1 / 1;
  --link-page-profile-img-border-radius: 50%;
}
.extrch-link-page-profile-img.shape-square {
  --link-page-profile-img-aspect-ratio: 1 / 1;
  /* You can adjust this radius if you want a sharper square, e.g., 0px or 2px */
  --link-page-profile-img-border-radius: 8px; 
}
.extrch-link-page-profile-img.shape-rectangle {
  /* Adjust aspect-ratio to your preferred rectangle, e.g., 4/3, 16/9, 2/1 */
  --link-page-profile-img-aspect-ratio: 16 / 9; 
  /* Adjust radius for the rectangle's corners */
  --link-page-profile-img-border-radius: 12px; 
}

.extrch-link-page-profile-img.no-image {
  display: none !important;
}

.extrch-link-page-title {
  font-family: var(--link-page-title-font-family);
  font-size: var(--link-page-title-font-size);
  font-weight: 700;
  text-align: center;
  margin: 0 0 0.3em 0;
  letter-spacing: 0.01em;
  color: var(--link-page-text-color); /* Ensures title uses the main text color variable */
}

.extrch-link-page-bio {
  color: var(--link-page-text-color); /* Ensures bio uses the main text color variable */
  font-family: var(--link-page-body-font-family); /* Directly apply body font */
  font-size: 1.08em;
  text-align: center;
  margin-bottom: 1.2em;
  margin-top: 0.2em;
}

.extrch-link-page-socials {
  display: flex;
  gap: 1.1em;
  justify-content: center;
  margin-bottom: 1.5em;
}
.extrch-social-icon {
  font-size: 1.5em;
  color: var(--link-page-link-text-color); /* Use specific link text color */
  transition: color 0.18s;
}
.extrch-social-icon:hover {
  color: var(--link-page-button-hover-bg-color); /* Consistent hover, using button hover bg as link hover color */
}

.extrch-link-page-links {
  display: flex;
  flex-direction: column;
  gap: 1em;
  width: 100%;
  margin-bottom: 1.5em;
}
.extrch-link-page-link {
  background: var(--link-page-button-bg-color);
  color: var(--link-page-link-text-color);
  padding: 0.95em 1.2em;
  border-radius: var(--link-page-button-radius);
  border: 2px solid var(--link-page-button-border-color); /* Ensure border color uses variable */
  text-decoration: none;
  font-weight: 600;
  font-family: var(--link-page-body-font-family); /* Directly apply body font */
  font-size: 1.08em;
  transition: background 0.18s, color 0.18s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  
  /* Flexbox for layout */
  display: flex;
  justify-content: space-between; /* Will be effectively center + far right due to text span growing */
  align-items: center;
}

/* New class for the link text span */
.extrch-link-page-link-text {
  flex-grow: 1; /* Allows text to expand and effectively center */
  text-align: center; /* Centers the text within this span */
  white-space: wrap;
  overflow: hidden;
  text-overflow: wrap;
}

/* New class for the link icon span/element */
.extrch-link-page-link-icon {
  flex-shrink: 0; /* Prevent icon from shrinking */
  display: flex; /* To help align icon if it's complex */
  align-items: center;
}

.extrch-link-page-link:hover {
  background: var(--link-page-button-hover-bg-color);
  color: var(--link-page-button-bg-color); /* Revert to original button background color for text on hover */
  text-decoration: none;
}
.extrch-link-page-links-container{
  width: 100%;
 }

.extrch-link-page-powered {
  margin-top: 2em;
  font-size: 0.98em;
  color: var(--link-page-muted-text-color);
  font-family: var(--link-page-body-font-family); /* Directly apply body font */
  text-align: center;
}
.extrch-link-page-powered a {
  color: var(--link-page-link-text-color); /* Consistent link text color */
  text-decoration: underline;
}

.extrch-link-page-powered a:hover {
  color: var(--link-page-button-hover-bg-color); /* Consistent hover */
}

.extrch-link-page-preview-indicator {
  display: inline-block;
  margin-bottom: 0.7em;
  padding: 0.18em 0.7em;
  font-size: 0.98em;
  font-weight: 600;
  color: var(--accent);
  background: rgba(83,148,11,0.08);
  border-radius: 8px;
  letter-spacing: 0.01em;
  text-align: center;
}

.extrch-link-page-section-title {
  font-size: 1.15em;
  font-weight: 700;
  margin: 1em 0 0.7em 0;
  color: var(--link-page-text-color);
  font-family: var(--link-page-title-font-family); /* Use title font */
  letter-spacing: 0.01em;
  text-align: center;
}

/* Edit button styles for public link page */
.extrch-link-page-edit-btn {
  position: fixed;
  /* top: 18px; */ /* Removed */
  bottom: 18px; /* Added */
  right: 18px;
  z-index: 1000;
  background: transparent;
  border: none;
  padding: 0.5em; /* Adjust for touch target size */
  color: var(--link-page-link-text-color);
  font-size: 1.5em; /* Adjust icon size */
  opacity: 0.7;
  text-decoration: none;
  box-shadow: none;
  transition: color 0.2s ease-in-out, opacity 0.2s ease-in-out;
}

.extrch-link-page-edit-btn:hover {
  color: var(--link-page-button-hover-bg-color);
  opacity: 1;
}

@media (max-width: 768px) {
  .extrch-link-page-content-wrapper {
    padding: 2em;
  }
}

@media (max-width: 600px) {
  .extrch-link-page-container {
    padding: 15px;
  }
  .extrch-link-page-content-wrapper {
    max-width: 95vw;
    padding: 1.5em;
  }
  .extrch-link-page-profile-img img {
    max-width: 100%;
  }
  .extrch-link-page-title {
    /* Removed fixed font-size to allow CSS variable to control */
  }
  .extrch-link-page-bio {
    font-size: 1em;
  }
  .extrch-link-page-link {
    font-size: 1em;
    padding: 0.85em .95em;
  }
}


.extrch-link-page-socials {
  display: flex;
  gap: 1.1em;
  justify-content: center;
  margin-bottom: 1.5em;
}
.extrch-social-icon {
  font-size: 1.5em;
  color: var(--link-page-link-text-color); /* Use specific link text color */
  transition: color 0.18s;
}
.extrch-social-icon:hover {
  color: var(--link-page-button-hover-bg-color); /* Consistent hover, using button hover bg as link hover color */
}

/* Add position: relative here for the main layout file */
.extrch-link-page-header-content {
  position: relative; /* Crucial for absolute positioning of page share trigger */
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

/* YouTube Inline Embed Styles */
.extrch-youtube-video-placeholder {
    margin-top: 10px; /* Space between button and video */
    margin-bottom: 10px; /* Space below video */
    max-width: 100%;
    overflow: hidden; /* Crucial for the slide effect */
    max-height: 0; /* Initially collapsed */
    transition: max-height 0.4s ease-in-out, margin-top 0.4s ease-in-out, margin-bottom 0.4s ease-in-out, padding-top 0.4s ease-in-out, padding-bottom 0.4s ease-in-out; /* Smooth transition for height and spacing */
    /* Add padding to the transition if you want space inside the placeholder when it opens */
    /* padding-top: 0; */
    /* padding-bottom: 0; */
}

.extrch-youtube-video-placeholder.video-visible {
    max-height: 56.25vw; /* Max height based on 16:9 aspect ratio relative to viewport width (adjust as needed, or use a fixed px value like 500px) */
    /* Alternatively, a large enough fixed pixel value if vw is problematic:
    max-height: 500px; 
    */
    /* If you added padding to the transition, define the open state padding here */
    /* padding-top: 10px; */
    /* padding-bottom: 10px; */
}

.extrch-youtube-video-placeholder iframe {
    display: block; /* Removes extra space below iframe */
    width: 100%;
    aspect-ratio: 16/9; /* Maintain 16:9 aspect ratio */
    border: none; /* Ensure no iframe border */
    max-width: 100%; /* Ensure iframe doesn't overflow its container */
}

/* Optional: Style for the button when video is active */
.extrch-link-button.video-active {
    /* Example: change background or add an icon */
    /* background-color: #ffdddd; */ 
}

/* --- Subscribe Modal Styles --- */
.extrch-subscribe-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.extrch-subscribe-modal-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1;
}
.extrch-subscribe-modal-content {
  position: relative;
  z-index: 2;
  background: var(--link-page-card-bg-color);
  color: var(--link-page-text-color);
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
  padding: 2em 2em 1.5em 2em;
  max-width: 95vw;
  width: 350px;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: extrch-modal-fadein 0.2s;
  border: 1px solid var(--link-page-button-border-color);
}

/* Background inheritance for subscribe modal - matches main container */
.extrch-subscribe-modal-content[data-bg-type="color"] {
  background-color: var(--link-page-background-color);
  background-image: none; /* Explicitly remove image/gradient */
}

.extrch-subscribe-modal-content[data-bg-type="gradient"] {
  background: linear-gradient(
    var(--link-page-background-gradient-direction),
    var(--link-page-background-gradient-start),
    var(--link-page-background-gradient-end)
  );
  background-image: linear-gradient(
    var(--link-page-background-gradient-direction),
    var(--link-page-background-gradient-start),
    var(--link-page-background-gradient-end)
  );
  background-color: transparent; /* Ensure no base color shows through */
}

.extrch-subscribe-modal-content[data-bg-type="image"] {
  background-image: var(--link-page-background-image-url);
  background-size: var(--link-page-image-size); /* Use variable */
  background-position: var(--link-page-image-position); /* Use variable */
  background-repeat: var(--link-page-image-repeat); /* Use variable */
  background-color: transparent; /* Ensure no base color shows through */
}
@keyframes extrch-modal-fadein {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}
.extrch-subscribe-modal-close {
  position: absolute;
  top: 0.7em;
  right: 0.7em;
  background: none;
  border: none;
  color: var(--link-page-text-color);
  font-size: 1.5em;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.extrch-subscribe-modal-close:hover {
  opacity: 1;
}
.extrch-subscribe-modal-header {
  text-align: center;
  margin-bottom: 1.2em;
}
.extrch-subscribe-modal-header h3 {
  margin: 0 0 0.3em 0;
  font-size: 1.25em;
  font-family: var(--link-page-title-font-family);
  color: var(--link-page-text-color);
}
.extrch-subscribe-modal-header p {
  margin: 0;
  color: var(--link-page-muted-text-color);
  font-size: 1em;
}

/* --- Subscribe Inline Form Styles --- */
.extrch-link-page-subscribe-inline-form-container {
  background: var(--link-page-card-bg-color);
  color: var(--link-page-text-color);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.13);
  padding: 1.5em 1.5em 1.2em 1.5em;
  margin: 1.5em 0 1.5em 0;
  max-width: 420px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 1px solid var(--link-page-button-border-color);
}
.extrch-link-page-subscribe-inline-form-container h3 {
  margin: 0 0 0.3em 0;
  font-size: 1.15em;
  font-family: var(--link-page-title-font-family);
  color: var(--link-page-text-color);
}
.extrch-link-page-subscribe-inline-form-container p {
  margin: 0 0 1em 0;
  color: var(--link-page-muted-text-color);
  font-size: 1em;
  text-align: center;
}

/* --- Shared Subscribe Form Styles --- */
.extrch-subscribe-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1em;
}
.extrch-subscribe-form .form-group {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.extrch-subscribe-form input[type="email"] {
  width: 100%;
  padding: 0.7em 1em;
  border-radius: 8px;
  border: 1.5px solid var(--link-page-button-border-color);
  background: var(--link-page-input-bg);
  color: var(--link-page-text-color);
  font-size: 1em;
  font-family: var(--link-page-body-font-family);
  margin-bottom: 0.2em;
  box-sizing: border-box;
  transition: border-color 0.18s;
}
.extrch-subscribe-form input[type="email"]:focus {
  border-color: var(--link-page-button-hover-bg-color);
  outline: none;
}
.extrch-subscribe-form button[type="submit"] {
  background: var(--link-page-button-bg-color);
  color: var(--link-page-link-text-color);
  border: none;
  border-radius: var(--link-page-button-radius);
  padding: 0.7em 1em;
  font-size: 1.08em;
  font-family: var(--link-page-body-font-family);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}
.extrch-subscribe-form button[type="submit"]:hover {
  background: var(--link-page-button-hover-bg-color);
  color: var(--link-page-button-bg-color);
}
.extrch-form-message {
  min-height: 1.2em;
  font-size: 0.98em;
  margin-top: 0.2em;
  text-align: center;
  color: var(--link-page-muted-text-color);
}
@media (max-width: 600px) {
  .extrch-link-page-subscribe-inline-form-container {
    padding: 1em 0.7em 1em 0.7em;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    margin-left: 0;
    margin-right: 0;
  }
  .extrch-link-page-subscribe-inline-form-container * {
    max-width: 100%;
    box-sizing: border-box;
    overflow-wrap: break-word;
  }
}

/* --- Bulletproof subscribe form input and button override for manager and live page (restored) --- */
.extrch-link-page-subscribe-inline-form-container form.extrch-subscribe-form button[type="submit"],
.extrch-link-page-subscribe-inline-form-container .button,
.extrch-link-page-subscribe-inline-form-container .extrch-subscribe-btn,
.extrch-subscribe-modal form.extrch-subscribe-form button[type="submit"],
.extrch-subscribe-modal .button,
.extrch-subscribe-modal .extrch-subscribe-btn {
  background: var(--link-page-button-bg-color) !important;
  color: var(--link-page-link-text-color) !important;
  border: 1.2px solid var(--link-page-button-border-color) !important;
  border-radius: var(--link-page-button-radius) !important;
  padding: 0.7em 1em !important;
  font-size: 1.08em !important;
  font-family: var(--link-page-body-font-family) !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: background 0.18s, color 0.18s, border-color 0.18s !important;
  box-shadow: none !important;
  z-index: 3;
  outline: none !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0.5em 0 0 0 !important;
  display: block !important;
}
.extrch-link-page-subscribe-inline-form-container form.extrch-subscribe-form button[type="submit"]:hover:not(:disabled),
.extrch-link-page-subscribe-inline-form-container .button:hover:not(:disabled),
.extrch-link-page-subscribe-inline-form-container .extrch-subscribe-btn:hover:not(:disabled),
.extrch-subscribe-modal form.extrch-subscribe-form button[type="submit"]:hover:not(:disabled),
.extrch-subscribe-modal .button:hover:not(:disabled),
.extrch-subscribe-modal .extrch-subscribe-btn:hover:not(:disabled) {
  background: var(--link-page-button-hover-bg-color) !important;
  color: var(--link-page-button-bg-color) !important;
  border-color: var(--link-page-button-border-color) !important;
}

/* --- Ensure subscribe button hover works in live preview (iframe) --- */
.extrch-link-page-preview-container .extrch-link-page-subscribe-inline-form-container form.extrch-subscribe-form button[type="submit"]:hover:not(:disabled),
.extrch-link-page-preview-container .extrch-link-page-subscribe-inline-form-container .button:hover:not(:disabled),
.extrch-link-page-preview-container .extrch-link-page-subscribe-inline-form-container .extrch-subscribe-btn:hover:not(:disabled) {
  background: var(--link-page-button-hover-bg-color) !important;
  color: var(--link-page-button-bg-color) !important;
  border-color: var(--link-page-button-border-color) !important;
}

/* Modal visibility control */
.extrch-modal-hidden {
  display: none !important;
}

/* Share modal element visibility */
.extrch-share-option-visible {
  display: flex !important;
}

.extrch-share-profile-img-hidden {
  display: none !important;
}

/* Form styling */
.extrch-form-input-wide {
  width: 100%;
  max-width: 400px;
}

.extrch-form-input-hidden {
  display: none;
}

.extrch-form-button-spaced {
  margin-left: 5px;
}