/**
 * Common styles for all pages
 * - Prevents white flash during navigation
 * - Disables pinch zooming
 * - Applies basic consistent styling
 */

/* Modern thin scrollbars site-wide (desktop). Firefox + Chromium/WebKit. */
html {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
}
html::-webkit-scrollbar,
body::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track {
  background: transparent;
}
html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.5);
  background-clip: padding-box;
}

/* Prevent white flash during page loads/redirects */
html:not(:has(body.template-executor-page)) {
  //background-color: #000000 !important;
  overscroll-behavior: none;
  touch-action: manipulation;
  touch-action: pan-x pan-y;
  -ms-touch-action: pan-x pan-y;
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Add a subtle fade-in effect for the whole body */
body:not(.template-executor-page) {
  animation: fadeIn 0.3s ease-in;
  //background-color: #000000 !important;
  color: #fff;
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overscroll-behavior: none; /* Prevents overscroll bounce effects */
  overflow-x: hidden;
  touch-action: pan-x pan-y; /* Only allow scroll, no zoom */
  -ms-touch-action: pan-x pan-y;
  -webkit-touch-callout: none; /* iOS Safari */
  -webkit-user-select: none; /* Safari */
  -khtml-user-select: none; /* Konqueror HTML */
  -moz-user-select: none; /* Firefox */
  -ms-user-select: none; /* Internet Explorer/Edge */
  user-select: none; /* Non-prefixed version */
  font-family: 'Trebuchet MS', sans-serif;
  -webkit-text-size-adjust: 100%; /* Prevent iOS text size adjustment */
  -moz-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
  max-height: 100%; /* Prevent layout shifts that can occur with zoom */
  position: fixed;
  inset: 0; /* Shorthand for top, right, bottom, left: 0 */
  overflow-y: scroll; /* Still allow vertical scrolling */
  /* Improve momentum scrolling feel on iOS */
  -webkit-overflow-scrolling: touch;
  /* CRITICAL iOS Fix: Ensure body doesn't block pointer events */
  pointer-events: auto !important;
}

/* Bottom menu removed permanently across the app (prevents any flash if old markup exists) */
.bottom-menu,
#bottom-menu-container {
  display: none !important;
  height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  pointer-events: none !important;
}

@keyframes fadeIn {
  from { opacity: 0.8; }
  to { opacity: 1; }
}

/* Re-enable text selection for specific elements */
input, textarea, [contenteditable="true"], .selectable-text {
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
  touch-action: auto;
}

/* Shared styles for modal transitions */
.page-transition-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #000000 !important;
  z-index: 99999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.page-transition-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* Remove background images completely - DISABLED for template executor */
/*
body, html, .background-image, #background-image, [id*="background"], .card-container, #card-container {
  background-image: none !important;
  background-color: #000000 !important;
}
*/

/* Hide any background-image elements */
.background-image, #background-image, [id*="background-image"] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  position: absolute !important;
  z-index: -9999 !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
} 

/* Rich Link Preview Styles */
.rich-link-preview {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  overflow: hidden;
  margin: 10px 0;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: all 0.3s ease;
  max-width: min(500px, 100%);
  width: 100%;
  box-sizing: border-box;
}

/* Video Embed Styles */
.rich-video-embed {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  overflow: hidden;
  margin: 10px 0;
  background: rgba(255, 255, 255, 0.05);
  max-width: min(500px, 100%);
  width: 100%;
  box-sizing: border-box;
}

.video-embed-container {
  width: 100%;
  background: #000;
}

.video-embed-info {
  padding: 15px;
}

.video-embed-info .preview-title {
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 8px;
  line-height: 1.4;
}

.video-embed-info .preview-description {
  font-size: 13px;
  color: #cccccc;
  margin-bottom: 8px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-embed-info .preview-domain {
  font-size: 12px;
  color: #888888;
  font-weight: 500;
}

/* Instagram Embed Styles */
.rich-instagram-embed {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  overflow: hidden;
  margin: 10px 0;
  background: rgba(255, 255, 255, 0.05);
  max-width: min(500px, 100%);
  width: 100%;
  box-sizing: border-box;
}

.instagram-embed-container {
  width: 100%;
  min-height: 400px;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}

.instagram-embed-info {
  padding: 15px;
}

.instagram-embed-info .preview-title {
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 8px;
  line-height: 1.4;
}

.instagram-embed-info .preview-description {
  font-size: 13px;
  color: #cccccc;
  margin-bottom: 8px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.instagram-embed-info .preview-domain {
  font-size: 12px;
  color: #888888;
  font-weight: 500;
}

/* Simple Embed Styles (Facebook, etc.) - same as Instagram for consistency */
.rich-simple-embed {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  overflow: hidden;
  margin: 10px 0;
  //background: rgba(255, 255, 255, 0.05);
  max-width: min(500px, 100%);
  width: 100%;
  box-sizing: border-box;
}

.simple-embed-container {
  width: 100%;
  min-height: 400px;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}

.simple-embed-info {
  padding: 15px;
}

.simple-embed-info .preview-title {
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 8px;
  line-height: 1.4;
}

.simple-embed-info .preview-description {
  font-size: 13px;
  color: #cccccc;
  margin-bottom: 8px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.simple-embed-info .preview-domain {
  font-size: 12px;
  color: #888888;
  font-weight: 500;
}

.rich-link-preview:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(29, 185, 84, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.rich-link-preview .preview-image {
  width: 100%;
  height: 200px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
}

.rich-link-preview .preview-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Mobile-friendly adjustments */
@media (max-width: 768px) {
  .rich-link-preview .preview-image {
    height: 120px; /* Smaller height on mobile */
  }
  
  .rich-link-preview {
    margin: 8px 0; /* Reduce margin on mobile */
  }
  
  .rich-link-preview .preview-content {
    padding: 10px; /* Reduce padding on mobile */
  }
  
  .rich-link-preview .preview-title {
    font-size: 14px; /* Smaller title font on mobile */
    line-height: 1.3;
  }
  
  .rich-link-preview .preview-description {
    font-size: 12px; /* Smaller description font on mobile */
    line-height: 1.4;
  }
  
  /* Video embed mobile styles */
  .rich-video-embed {
    margin: 8px 0; /* Reduce margin on mobile */
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
  }
  
  .video-embed-info {
    padding: 10px; /* Reduce padding on mobile */
  }
  
  .video-embed-info .preview-title {
    font-size: 14px; /* Smaller title font on mobile */
    line-height: 1.3;
  }
  
  .video-embed-info .preview-description {
    font-size: 12px; /* Smaller description font on mobile */
    line-height: 1.4;
  }
  
  .video-embed-info .preview-domain {
    font-size: 11px; /* Smaller domain font on mobile */
  }
  
  /* Instagram embed mobile styles */
  .rich-instagram-embed {
    margin: 8px 0; /* Reduce margin on mobile */
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
  }
  
  .instagram-embed-container {
    min-height: 350px; /* Slightly shorter on mobile but still tall enough */
  }
  
  .instagram-embed-info {
    padding: 10px; /* Reduce padding on mobile */
  }
  
  .instagram-embed-info .preview-title {
    font-size: 14px; /* Smaller title font on mobile */
    line-height: 1.3;
  }
  
  .instagram-embed-info .preview-description {
    font-size: 12px; /* Smaller description font on mobile */
    line-height: 1.4;
  }
  
  .instagram-embed-info .preview-domain {
    font-size: 11px; /* Smaller domain font on mobile */
  }
  
  /* Simple embed mobile styles */
  .rich-simple-embed {
    margin: 8px 0; /* Reduce margin on mobile */
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
  }
  
  .simple-embed-container {
    min-height: 350px; /* Slightly shorter on mobile but still tall enough */
  }
  
  .simple-embed-info {
    padding: 10px; /* Reduce padding on mobile */
  }
  
  .simple-embed-info .preview-title {
    font-size: 14px; /* Smaller title font on mobile */
    line-height: 1.3;
  }
  
  .simple-embed-info .preview-description {
    font-size: 12px; /* Smaller description font on mobile */
    line-height: 1.4;
  }
  
  .simple-embed-info .preview-domain {
    font-size: 11px; /* Smaller domain font on mobile */
  }
}

.rich-link-preview .preview-content {
  padding: 15px;
}

.rich-link-preview .preview-title {
  font-weight: bold;
  font-size: 16px;
  color: #fff;
  margin-bottom: 8px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rich-link-preview .preview-description {
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rich-link-preview .preview-domain {
  color: rgba(29, 185, 84, 0.9);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Mobile responsiveness for rich previews */
@media (max-width: 768px) {
  .rich-link-preview {
    max-width: 100%;
    width: 100%;
    margin: 8px 0;
    box-sizing: border-box;
  }
  
  .rich-link-preview .preview-image {
    height: 180px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  .rich-link-preview .preview-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    max-width: 100%;
  }
  
  .rich-link-preview .preview-content {
    padding: 12px;
    box-sizing: border-box;
  }
  
  .rich-link-preview .preview-title {
    font-size: 14px;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  
  .rich-link-preview .preview-description {
    font-size: 13px;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  
  .rich-link-preview .preview-domain {
    font-size: 11px;
  }
}

/* Dark theme adjustments */
@media (prefers-color-scheme: dark) {
  .rich-link-preview {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.08);
  }
  
  .rich-link-preview:hover {
    background: rgba(255, 255, 255, 0.15);
  }
}

/* Loading state for rich previews */
.rich-link-preview.loading {
  opacity: 0.7;
}

.rich-link-preview.loading .preview-content::after {
  content: "Loading preview...";
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  font-style: italic;
}

/* Iframely Embed Styles - for standard URL embeds */
.iframely-embed {
  max-width: min(500px, 100%) !important;
  width: 100% !important;
  margin: 10px 0 !important;
  box-sizing: border-box !important;
}

.iframely-responsive {
  max-width: 100% !important;
  width: 100% !important;
  height: auto !important;
  min-height: 120px !important;
  max-height: 200px !important;
  box-sizing: border-box !important;
}

/* Mobile styles for Iframely embeds */
@media (max-width: 768px) {
  .iframely-embed {
    max-width: 100% !important;
    width: 100% !important;
    margin: 8px 0 !important;
    box-sizing: border-box !important;
  }
  
  .iframely-responsive {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    min-height: 100px !important;
    max-height: 150px !important;
    box-sizing: border-box !important;
  }
} 

.location-dropdown {
  background: #000;
  border: 1px solid #333;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  max-height: 200px;
  overflow-y: auto;
  width: 250px;
  z-index: 1000;
  margin-top: 5px;
  display: none;
}

.location-option {
  padding: 8px 10px;
  cursor: pointer;
  transition: background-color 0.2s;
  color: #fff;
  background: #000;
}

.location-option:hover {
  background-color: #222;
  color: #fff;
}

.selected-location {
  padding: 5px 10px;
  background: #f8f9fa;
  border-radius: 15px;
  font-size: 12px;
  color: #666;
  margin: 5px 0;
  display: none;
  align-items: center;
}

.selected-location i {
  margin-right: 5px;
  color: #1DB954;
}

.selected-location button {
  margin-left: auto;
  border: none;
  background: none;
  color: #666;
  cursor: pointer;
  padding: 0 5px;
}

.selected-location button:hover {
  color: #dc3545;
}

/* Location dropdown styling */
.pac-container {
  background-color: #000 !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
  padding: 8px 0 !important;
  margin-top: 4px !important;
  font-family: inherit !important;
  z-index: 9999 !important;
}

.pac-item {
  padding: 8px 12px !important;
  border-top: none !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  color: #fff !important;
  background-color: #000 !important;
  font-family: inherit !important;
}

.pac-item:hover {
  background-color: #333 !important;
}

.pac-item .pac-icon {
  display: none !important;
}

.pac-item .pac-item-query {
  color: #fff !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  font-family: inherit !important;
  padding-right: 3px !important;
}

.pac-item .pac-matched {
  color: #4ade80 !important;
}

.pac-item .pac-secondary-text {
  color: #aaa !important;
  font-size: 12px !important;
  font-family: inherit !important;
}

/* Location thumbnail in dropdown */
.pac-item img {
  width: 32px !important;
  height: 32px !important;
  border-radius: 6px !important;
  object-fit: cover !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* Remove Google Places branding */
.pac-container::after,
.pac-logo::after {
  display: none !important;
}

/* Force black background on Google Places elements */
.pac-container,
.pac-container *,
.pac-item,
.pac-item * {
  background-color: #000 !important;
}

/* Location display in posts */
.post-location-container {
  margin: 8px 0;
  padding: 12px;
  background-color: #000 !important;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  width: 100%;
  transition: all 0.2s ease;
}

.post-location-container:hover {
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.post-location {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  color: #fff;
}

.location-icon-wrapper {
  width: 32px;
  height: 32px;
  min-width: 32px;
  background-color: #333;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
  background-size: cover;
  background-position: center;
}

.location-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.location-link {
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
}

.location-link:hover {
  text-decoration: underline;
  color: #4ade80;
}

.location-address {
  color: #aaa;
  font-size: 12px;
}

.location-map {
  width: 100%;
  height: 100px;
  object-fit: cover;
  border-radius: 4px;
  margin-top: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
}

.location-map:hover {
  border-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.01);
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .post-location {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .location-address {
    margin-left: 0;
    max-width: 100%;
    text-align: left;
  }
  
  .location-map {
    height: 80px;
  }
} 

/* Override Google Places autocomplete styles */
.pac-container::after {
  display: none !important;
}

.pac-logo::after {
  display: none !important;
}

/* Force black background on Google Places elements */
.pac-container * {
  background-color: #000 !important;
} 

/* Post Menu Styles */
.post-menu-container {
  position: relative;
  margin-left: auto;
}

.post-menu-button {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.post-menu-button:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.post-menu-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: #333;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  min-width: 150px;
  padding: 8px 0;
}

.post-menu-dropdown button {
  display: block;
  width: 100%;
  padding: 8px 16px;
  border: none;
  background: none;
  color: #fff;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s;
}

.post-menu-dropdown button:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.post-menu-dropdown button i {
  margin-right: 8px;
  width: 16px;
  text-align: center;
}

.hidden {
  display: none !important;
} 

/* Location display container */
.location-display-container {
  margin: 8px 0;
  width: 100%;
}

.location-display {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: 4px;
  margin: 8px 0;
  font-size: 14px;
  color: #666;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.location-display span {
  flex-grow: 1;
}

.remove-location-btn {
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  padding: 4px;
  margin-left: 8px;
  transition: color 0.2s;
}

.remove-location-btn:hover {
  color: #dc3545;
}

/* Dark mode styles */
@media (prefers-color-scheme: dark) {
  .location-display {
    background: #222;
    border-color: rgba(255, 255, 255, 0.1);
    color: #fff;
  }

  .location-display span {
    color: #fff;
  }

  .remove-location-btn {
    color: #fff;
  }

  .remove-location-btn:hover {
    color: #ff4d4d;
  }
} 