/* ==========================================================================
   TageBis Universal Share Engine Modal & Styling
   Vollständig optimiert für Light & Dark Mode
   ========================================================================== */

.share-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: seFadeIn 0.2s ease-out;
}

@keyframes seFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.share-modal-card {
  background: var(--bg-surface, #ffffff);
  color: var(--text-main, #0f172a);
  width: 100%;
  max-width: 860px;
  max-height: 92vh;
  border-radius: 20px;
  border: 1px solid var(--border-color, #e2e8f0);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.share-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.share-modal-header h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
}

.share-modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.share-modal-close:hover {
  color: var(--text-main);
}

.share-modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 768px) {
  .share-modal-body {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 16px;
  }
}

/* Linke Spalte: Live Canvas-Vorschau */
.share-preview-pane {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.share-canvas-wrap {
  width: 100%;
  max-width: 280px;
  aspect-ratio: 9 / 16;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: aspect-ratio 0.25s ease;
}

.share-canvas-wrap.format-square {
  aspect-ratio: 1 / 1;
}

#share-render-canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Rechte Spalte: Steuerelemente */
.share-controls-pane {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.se-control-group label {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #64748b);
  display: block;
  margin-bottom: 8px;
}

/* Format Umschalter */
.se-format-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.se-format-btn {
  background: var(--bg-subtle, #f8fafc);
  border: 1.5px solid var(--border-color, #cbd5e1);
  color: var(--text-main, #0f172a);
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.se-format-btn:hover {
  border-color: var(--primary);
}

.se-format-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

/* Presets Grid (10 Bilder + Upload) */
.se-presets-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

@media (max-width: 500px) {
  .se-presets-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.se-preset-thumb {
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
  position: relative;
}

.se-preset-thumb:hover {
  transform: scale(1.05);
}

.se-preset-thumb.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.se-preset-upload {
  border: 1.5px dashed var(--border-color, #cbd5e1);
  background: var(--bg-subtle, #f8fafc);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted, #64748b);
  gap: 2px;
}

.se-preset-upload input[type="file"] {
  display: none;
}

/* Social Actions Grid */
.se-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}

.se-btn-platform {
  border: none;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.82rem;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.se-btn-platform:hover {
  transform: translateY(-1px);
  opacity: 0.92;
}

.se-btn-whatsapp { background: #25d366; }
.se-btn-facebook { background: #1877f2 !important; color: #ffffff !important; }
.se-btn-download { background: #2563eb; }
.se-btn-copy { background: #475569; }

/* Conversion Notice */
.se-post-share-cta {
  background: var(--primary-subtle);
  border: 1px dashed var(--primary);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.82rem;
}

.se-post-share-cta strong {
  display: block;
  color: var(--text-main);
}

.se-post-share-cta span {
  color: var(--text-muted);
  font-size: 0.74rem;
}

.se-post-share-cta button {
  background: var(--primary);
  color: #ffffff;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.se-post-share-cta button:hover {
  background: var(--primary-hover);
}

/* ==========================================================================
   ERGÄNZUNG: DARK-MODE-ABSICHERUNG FÜR DAS SHARE-MODAL
   ========================================================================== */
:root.dark-theme .share-modal-card,
html.dark-theme .share-modal-card,
body.dark-theme .share-modal-card {
  background: var(--bg-surface) !important;
  color: var(--text-main) !important;
  border-color: var(--border-color) !important;
}

:root.dark-theme .share-modal-header,
html.dark-theme .share-modal-header,
body.dark-theme .share-modal-header {
  border-color: var(--border-color) !important;
}

:root.dark-theme .se-format-btn,
html.dark-theme .se-format-btn,
body.dark-theme .se-format-btn {
  background: var(--bg-subtle) !important;
  color: var(--text-main) !important;
  border-color: var(--border-color) !important;
}

:root.dark-theme .se-preset-upload,
html.dark-theme .se-preset-upload,
body.dark-theme .se-preset-upload {
  background: var(--bg-subtle) !important;
  color: var(--text-muted) !important;
  border-color: var(--border-color) !important;
}

/* ==========================================================================
   AUFFÄLLIGER HERO-BUTTON FÜR EIGENES FOTO UPLOAD
   ========================================================================== */
.se-preset-upload-hero {
  background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
  border: 2px dashed rgba(255, 255, 255, 0.6) !important;
  color: #ffffff !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 0.62rem !important;
  font-weight: 800 !important;
  text-transform: uppercase;
  gap: 3px !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

.se-preset-upload-hero i {
  font-size: 1.2rem;
}

.se-preset-upload-hero:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.5);
}

/* ==========================================================================
   HAPTISCHES KLICK-FEEDBACK FÜR TOUCH & DESKTOP
   ========================================================================== */
.se-btn-platform:active,
.se-format-btn:active,
.se-preset-thumb:active,
.share-modal-close:active,
.se-post-share-cta button:active {
  transform: scale(0.95) !important;
}

/* ==========================================================================
   AUFFÄLLIGER HERO-BUTTON FÜR EIGENES FOTO UPLOAD
   ========================================================================== */
.se-preset-upload-hero {
  background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
  border: 2px dashed rgba(255, 255, 255, 0.7) !important;
  color: #ffffff !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 0.65rem !important;
  font-weight: 800 !important;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  gap: 4px !important;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

.se-preset-upload-hero svg {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}

.se-preset-upload-hero:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.5);
  border-color: #ffffff !important;
}

.se-preset-upload-hero:active {
  transform: scale(0.95);
}