/* Custom styles for KonnektAI */

:root {
  /* Call to Action Colors */
  --cta-dark: #de0000;  /* dark red */
  --cta-light: #ff3f3f; /* light red */
  
  /* Error Colors */
  --error-serious: #ff3cff; /* serious error - Purple */
  --error-info: #ffad00;    /* info error - Bright orange */
  
  /* Normal Colors */
  --background: #ffffff;    /* Background white */
  --text: #000000;         /* Text black */
}

/* Navbar styling */
.navbar-brand {
  font-weight: bold;
  height: 120px;
  display: flex;
  align-items: center;
}

.navbar {
  margin-bottom: 20px;
  height: 120px;
}

/* Center navigation items vertically */
.navbar-nav {
  display: flex;
  align-items: center;
  height: 120px;
}
 
.navbar-nav > li > a {
  padding-top: 0;
  padding-bottom: 0;
  line-height: 120px;
}

/* Dropdown menu positioning */
.navbar-nav > li.dropdown > .dropdown-menu {
  margin-top: -20px;
}

/* Footer styling */ 
.footer {
  position: fixed;
  bottom: 15px;
  width: 100%;
  color: #000000;
}

/* CTA Button styling */
.btn-primary {
  background-color: var(--cta-dark);
  border-color: var(--cta-dark);
}

.btn-primary:hover, .btn-primary:focus {
  background-color: var(--cta-light);
  border-color: var(--cta-light);
}

/* Alert styling */
.alert-danger {
  background-color: var(--error-serious);
  color: var(--background);
}

.alert-warning {
  background-color: var(--error-info);
  color: var(--text);
}

/* Main content area */
body {
  background-color: var(--background);
  color: var(--text);
}

/* Active nav item */
.navbar-default .navbar-nav > .active > a,
.navbar-default .navbar-nav > .active > a:hover,
.navbar-default .navbar-nav > .active > a:focus {
  background-color: var(--cta-light);
  color: var(--background);
}

/* Generation cards */
.gen-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.gen-card-link:hover,
.gen-card-link:focus,
.gen-card-link:active {
  text-decoration: none !important;
}

.gen-card {
  border-radius: 10px;
  border: 2px solid var(--cta-dark);
  background: #fff6f6; /* ultra-light red tint */
  transition: transform 0.08s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  overflow: hidden; /* prevent inner overflow from overlapping card */
  position: relative;
}

/* Square tile variant for generation cards */
.gen-card.gen-square {
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
}
.gen-card.gen-square .panel-heading {
  min-height: 56px;
}
.gen-card.gen-square .panel-body {
  flex: 1;
}

.gen-card .panel-heading {
  font-weight: 600;
  font-size: 16px;
  background: var(--cta-dark);
  color: #ffffff;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  line-height: 1.2;
  min-height: 78px; /* ~3 lines at 16px with padding */
  position: relative;
}

.gen-card .panel-heading .fa,
.gen-card .panel-heading .fas {
  margin-right: 8px;
  color: #ffffff;
}

/* Ribbon badge on generation cards */
.gen-ribbon {
  position: absolute;
  top: 14px;
  right: -44px; /* pull into corner */
  z-index: 3;
  width: 180px;
  padding: 6px 0;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #ffffff;
  text-transform: uppercase;
  transform: rotate(45deg);
  transform-origin: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.18);
  pointer-events: none; /* keep entire card clickable */
}
.ribbon-blue { background-color: #0d6efd; }
.ribbon-green { background-color: #28a745; }
.ribbon-black { background-color: #000000; }
.ribbon-orange { background-color: #ff9800; }

.gen-card .panel-body p {
  color: var(--text);
}
/* Make text white on image-backed cards */
.gen-card .panel-body.with-bg,
.gen-card .panel-body.with-bg p,
.gen-card .panel-body.with-bg a { color: #ffffff; }

/* Background images for generation cards */
.gen-card .panel-body.with-bg {
  position: relative;
  overflow: hidden;
  background: transparent;
  /* common background sizing for stacked images (gradient + photo) */
  background-size: cover, cover;
  background-position: center 70%, center 70%;
  background-repeat: no-repeat, no-repeat;
}
.gen-card .panel-body.with-bg > * {
  position: relative;
  z-index: 1;
}
/* Disable pseudo-element background for testing (no transparency) */
.gen-card .panel-body.with-bg::before { content: none; }

/* Map specific backgrounds */
.gen-card .panel-body.bg-ideation {
  background-image: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('/generation/assets/BG_Ideation.jpg');
}
.gen-card .panel-body.bg-ideation-market {
  background-image: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('/generation/assets/BG_PickIdeationDataSets.jpg');
}
.gen-card .panel-body.bg-news {
  background-image: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('/generation/assets/BG_CreateNewsArticles.jpg');
}
.gen-card .panel-body.bg-social {
  background-image: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('/generation/assets/BG_CreateSocialMediaArticles.jpg');
}
.gen-card .panel-body.bg-audio-script {
  background-image: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('/generation/assets/BG_CreateAudioScript.jpg');
}
.gen-card .panel-body.bg-video-script {
  background-image: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('/generation/assets/BG_CreateVideoScript.jpg');
}
.gen-card .panel-body.bg-images {
  background-image: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('/generation/assets/BG_CreateImages.jpg');
}
.gen-card .panel-body.bg-mp3 {
  background-image: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('/generation/assets/BG_CreateMP3.jpg');
}
.gen-card .panel-body.bg-mp4 {
  background-image: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('/generation/assets/BG_CreateMP4.jpg');
}

.gen-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.12);
  border-color: var(--cta-dark);
}

/* Center tile grids for Bootstrap 3 (floats) */
.tile-row { text-align: center; }
.tile-col { float: none; display: inline-block; vertical-align: top; }

/* Loading overlay for results panel */
.relative { position: relative; }
.loading-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255, 246, 246, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.loading-overlay .loading-box {
  background: #ffffff;
  border: 1px solid var(--cta-dark);
  color: var(--cta-dark);
  padding: 10px 14px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.loading-overlay.show { display: flex; }

/* Page section backgrounds */
.page-bg {
  padding: 15px;
  border-radius: 8px;
  background-size: cover;
  background-position: center 70%;
  background-repeat: no-repeat;
}

/* Sticky footer pinned to bottom with white background */
body { padding-bottom: 70px; }
.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: transparent;
  border-top: none;
  z-index: 1030;
  padding: 0;
}
.footer .footer-text {
  display: inline-block;
  position: relative;
  margin: 0;
  padding: 6px 12px;
}
.footer .footer-text:before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #ffffff;
  border: 1px solid #eee;
  border-top-left-radius: 9999px; /* equal/greater than height for full cap */
  border-top-right-radius: 9999px;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  transform: scaleX(1.2); /* 20% wider total => 10% each side */
  transform-origin: center;
  z-index: -1;
  /* Carve concave bottom corners with radius = 50% of bar height */
  -webkit-mask:
    radial-gradient(100% 100% at 0% 100%, transparent 49%, #000 50%) 0% 100% / 50% 100% no-repeat,
    radial-gradient(100% 100% at 100% 100%, transparent 49%, #000 50%) 100% 100% / 50% 100% no-repeat,
    linear-gradient(#000 0 0);
  mask:
    radial-gradient(100% 100% at 0% 100%, transparent 49%, #000 50%) 0% 100% / 50% 100% no-repeat,
    radial-gradient(100% 100% at 100% 100%, transparent 49%, #000 50%) 100% 100% / 50% 100% no-repeat,
    linear-gradient(#000 0 0);
}
.page-bg.page-bg-ideation { background-image: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('/generation/assets/BG_Ideation.jpg'); }
.page-bg.page-bg-news { background-image: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('/generation/assets/BG_CreateNewsArticles.jpg'); }
.page-bg.page-bg-social { background-image: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('/generation/assets/BG_CreateSocialMediaArticles.jpg'); }
.page-bg.page-bg-audio { background-image: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('/generation/assets/BG_CreateAudioScript.jpg'); }
.page-bg.page-bg-video { background-image: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('/generation/assets/BG_CreateVideoScript.jpg'); }
.page-bg.page-bg-images { background-image: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('/generation/assets/BG_CreateImages.jpg'); }
.page-bg.page-bg-mp3 { background-image: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('/generation/assets/BG_CreateMP3.jpg'); }
.page-bg.page-bg-mp4 { background-image: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('/generation/assets/BG_CreateMP4.jpg'); }
/* Page background for ideation marketplace */
.page-bg.page-bg-ideation-market { background-image: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('/generation/assets/BG_PickIdeationDataSets.jpg'); }
/* Ensure page headers and top descriptions are white on background images */
.page-bg > h1,
.page-bg > h2,
.page-bg > h3,
.page-bg > p {
  color: #ffffff !important;
}

/* Toggle button-style checkboxes (Bootstrap 3 compatibility) */
.btn-check {
  position: absolute;
  clip: rect(0, 0, 0, 0);
  pointer-events: none;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
}

.btn-outline-primary {
  background: transparent;
  color: #337ab7;
  border: 1px solid #337ab7;
}
.btn-outline-primary:hover,
.btn-outline-primary:focus {
  background: #337ab7;
  color: #ffffff;
  border-color: #2e6da4;
}
.btn-check:checked + .btn-outline-primary {
  background: #337ab7;
  color: #ffffff;
  border-color: #2e6da4;
}

.btn-outline-secondary {
  background: transparent;
  color: #6c757d;
  border: 1px solid #6c757d;
}
.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
  background: #6c757d;
  color: #ffffff;
  border-color: #5c636a;
}
.btn-check:checked + .btn-outline-secondary {
  background: #6c757d;
  color: #ffffff;
  border-color: #5c636a;
}

/* Larger font and control height for Leads filter dropdowns */
.lead-filters select.form-select,
.lead-filters select.form-control,
.lead-filters select {
  font-size: 18px;           /* reduced for better readability */
  line-height: 1.3;
  height: auto;              /* allow height to grow with padding */
  padding-top: 16px;
  padding-bottom: 16px;
  width: 100%;               /* full column width */
}

/* Utility helpers to mimic Bootstrap 5 spacing and shapes */
.rounded-pill { border-radius: 999px; }
.me-1 { margin-right: 4px; }
.me-2 { margin-right: 8px; }
.mb-2 { margin-bottom: 8px; }
.bg-light { background-color: #f8f9fa; }
.text-dark { color: #212529; }
.border { border: 1px solid #dee2e6; }

/* Selection highlight for article list on Images page */
#news-list .panel.selected-red,
#social-list .panel.selected-red {
  border: 3px solid var(--cta-dark) !important;
}

/* Standardized image thumbnail frame for Library Images tab */
.library-image-card {
  height: auto; /* allow card to size to its content */
  display: flex;
  flex-direction: column;
}
.library-image-card .panel-heading {
  min-height: 78px; /* align with 3-line title height */
  line-height: 1.2;
  white-space: normal;
  overflow: hidden;
}
.library-image-card .panel-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* contain image/text inside card */
}

/* Clamp title text to 3 lines and reserve space for action icons */
.gen-card .panel-heading strong {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
  padding-right: 56px; /* space for right-side icons */
}
.gen-card .panel-heading .pull-right {
  position: absolute;
  right: 12px;
  top: 8px;
}
.library-image-frame {
  width: 100%;
  /* fixed preview area height to standardize image box */
  height: 260px;
  background: #f8f9fa;
  border: 1px solid #eee;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.library-image-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.library-image-card .preview-text {
  margin-top: 8px;
  max-height: 40px;
  overflow: hidden;
}

/* Typewriter style and background for News article previews in Library */
.news-text-pre {
  font-family: "Times New Roman", Times, serif;
  font-size: 1.2em;
  background-image: url('/library/assets/BG_NewsArticleText.jpg');
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  background-color: transparent;
  width: 100%;
  display: block;
  padding: 0 12px; /* left/right only; control top/bottom proportionally */
  /* Reserve top/bottom space = 1/16 of image height each. With aspect 1:1.34, that's 1/16*1.34 = 8.375% of width */
  padding-top: 8.375%;
  padding-bottom: 8.375%;
  border-radius: 6px;
  /* Match social card sizing */
  aspect-ratio: 1 / 1.34;
  min-height: 360px;
  overflow-y: auto;
}

/* Override generic pre cap for news cards */
#content-list pre.news-text-pre {
  max-height: none;
}

.social-text-pre {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  background-image: url('/library/assets/BG_SocialArticleText.jpg');
  background-size: 100% auto; /* use full width; height adjusts to preserve aspect */
  background-repeat: no-repeat;
  background-position: center;
  background-color: transparent;
  width: 100%;
  display: block;
  padding: 0 12px; /* left/right text padding */
  /* Reserve top space = 1/6 of image height => 16.6667% * 1.34 = ~22.34% of width */
  padding-top: 22.34%;
  /* Reserve bottom space so text ends at 4/5 height => 20% * 1.34 = 26.8% of width */
  padding-bottom: 26.8%;
  border-radius: 6px;
  /* Maintain image aspect ratio (width:height = 1:1.34) while allowing scroll for text */
  aspect-ratio: 1 / 1.34;
  min-height: 360px;
  overflow-y: auto;
}

/* Override generic pre max-height for social cards so background can fully show */
#content-list pre.social-text-pre {
  max-height: none;
}

/* Make long article text scrollable in Library cards */
#content-list pre {
  max-height: 220px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-wrap: break-word;       /* legacy name */
  overflow-wrap: anywhere;     /* modern equivalent */
  word-break: break-word;      /* Safari/WebKit safeguard */
  hyphens: auto;
}

/* New container-based layout to keep scrolling inside reserved regions */
.news-text-card {
  position: relative;
  background-image: url('/library/assets/BG_NewsArticleText.jpg');
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  width: 100%;
  display: block;
  border-radius: 6px;
  aspect-ratio: 1 / 1.34;
  min-height: 360px;
  overflow: hidden;
}
.news-text-scroll {
  position: absolute;
  left: 12px; right: 12px;
  /* 1/32 of image height top/bottom; with aspect 1:1.34 -> 1/32*1.34 = 4.1875% of width */
  top: 4.1875%; bottom: 4.1875%;
  overflow-y: auto;
  background-color: transparent;
  padding: 0;
}
.news-text-card pre {
  font-family: "Times New Roman", Times, serif;
  font-size: 1.2em;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
  margin: 0;
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
}
.news-preview-title {
  font-family: "Times New Roman", Times, serif;
  font-weight: 700;
  font-size: 1.2em;
  margin: 0 0 10px 0;
}

.social-text-card {
  position: relative;
  background-image: url('/library/assets/BG_SocialArticleText.jpg');
  background-size: 100% auto;
  background-repeat: no-repeat;
  background-position: center;
  width: 100%;
  display: block;
  border-radius: 6px;
  aspect-ratio: 1 / 1.34;
  min-height: 360px;
  overflow: hidden;
}
.social-text-scroll {
  position: absolute;
  left: 12px; right: 12px;
  /* Start at 1/10 of height, end at 9/10 (bottom margin 1/10). Convert via aspect 1:1.34 => 13.4% of width */
  top: 13.4%; bottom: 13.4%;
  overflow-y: auto;
  background-color: transparent;
  padding: 0;
}
.social-text-card pre {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
  margin: 0;
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
}

/* Remove generic pre cap for container-based cards */
#content-list .news-text-card pre,
#content-list .social-text-card pre { max-height: none; }
