/* ============================== */
/* SECTION 1: BASE + LAYOUT       */
/* ============================== */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root { --nav-h: 68px; }
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #fff;
  color: #0a2342;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* ============================== */
/* SECTION 2: NAVIGATION BAR      */
/* ============================== */
nav {
  position: sticky;
  top: 0;
  background: #10141a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem 0 1.1rem;
  z-index: 1000;
  min-height: 68px;
  height: 68px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.14);
  gap: 1.5rem;
}
.nav-logo {
  display: flex;
  align-items: center;
  cursor: pointer;
}
.nav-logo img {
  height: 200px;
  width: auto;
  max-width: 90vw;
  display: block;
  filter: brightness(100);
  margin: 0;
  padding: 0 0.2rem;
  transition: height 0.22s;
}
.nav-right {
  display: flex;
  align-items: center;
  gap: 2rem;
}
.nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
  margin-left: 0.5rem;
}
.nav-links li a {
  color: #fff;
  font-weight: 700;
  font-size: 1.09rem;
  letter-spacing: 0.03em;
  transition: color 0.2s;
}
.nav-links li a:hover,
.nav-links li[aria-current="page"] a {
  color: #00e0fe;
  text-shadow: 0 0 8px #00e0fe55;
}
.btn-primary {
  background: #00e0fe; color: #111; font-weight: 900;
  padding: 0.65rem 1.5rem; border: none; border-radius: 8px;
  cursor: pointer; font-size: 1.13rem;
  box-shadow: 0 4px 14px #00e0fe44;
  transition: background 0.2s;
  letter-spacing: 0.01em;
  margin-left: 1.5rem;
}
.btn-primary:hover { background: #00b3c4; }
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 46px;
  height: 46px;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 2002;
}
.hamburger span {
  display: block;
  width: 24px;
  height: 3px;
  margin: 3px 0;
  background: #00e0fe;
  border-radius: 2px;
  transition: all 0.3s;
}
.hamburger.active span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }
.mobile-nav {
  display: none;
  flex-direction: column;
  align-items: flex-end;
  background: #10141a;
  position: absolute;
  top: 68px;
  right: 0;
  width: 100vw;
  max-width: 100vw;
  box-shadow: 0 8px 28px #0008;
  border-radius: 0 0 18px 18px;
  padding: 1.2rem 2.2rem 1.8rem 2.2rem;
  z-index: 2001;
  animation: slideDown 0.22s;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-24px);}
  to   { opacity: 1; transform: translateY(0);}
}
.mobile-nav li { margin-bottom: 1.18rem; text-align: right; }
.mobile-nav li:last-child { margin-bottom: 0; }
.mobile-nav a, .mobile-nav .btn-primary {
  font-size: 1.2rem;
  color: #fff;
  font-weight: 800;
}
.mobile-nav .btn-primary {
  width: 100%;
  margin-left: 0;
  margin-top: 1.2rem;
}

/* ============================== */
/* SECTION 3: RESPONSIVE NAV      */
/* ============================== */
@media (max-width: 850px) {
  .nav-logo img { height: 150px; }
  nav { min-height: 50px; height: 50px; }
  .nav-links { gap: 1.1rem; }
  .mobile-nav { top: 50px; }
  :root { --nav-h: 50px; }
}
@media (max-width: 700px) {
  .nav-logo img { height: 120px; }
  nav { min-height: 42px; height: 42px; padding: 0 1rem; }
  .nav-links { display: none; }
  .btn-primary { display: none; }
  .hamburger { display: flex; }
  .mobile-nav { top: 42px; }
  :root { --nav-h: 42px; }
}
@media (max-width: 480px) {
  .nav-logo img { height: 90px; }
  .mobile-nav { padding: 1rem 1rem 1.5rem 1rem; }
}

/* ============================== */
/* SECTION 4: PAGE CONTENT        */
/* ============================== */
main.page-content {
  flex: 1 0 auto;
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 3.5rem 2rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 22px #00e0fe10;
}
h2 {
  margin-bottom: 1.1rem;
  font-size: 1.41rem;
  color: #0a2342;
  font-weight: 900;
  letter-spacing: -0.5px;
}
textarea, select, input {
  width: 100%;
  padding: .82rem;
  border: 2px solid #00e0fe;
  border-radius: 8px;
  font-family: inherit;
  font-size: 1.06rem;
  color: #0a2342;
  margin-bottom: 1.2rem;
  background: #f7fbff;
  transition: border 0.22s;
}
textarea:focus, select:focus, input:focus { border-color: #00b3c4; }
#scriptTextarea { height: 240px; resize: vertical; }
.btn {
  background: #00e0fe;
  color: #10141a;
  border: none;
  padding: .85rem 2.1rem;
  border-radius: 8px;
  font-weight: 900;
  cursor: pointer;
  font-size: 1.09rem;
  box-shadow: 0 6px 18px #00e0fe34;
  margin-bottom: 0.5rem;
  transition: background 0.2s, color 0.2s;
  letter-spacing: 0.01em;
}
.btn:hover { background: #00b3c4; color: #fff; }
.btn:disabled { background: #a9e6f7; color: #444; cursor: not-allowed; }
.guidance-tip {
  font-size: 1.02rem;
  color: #007fa3;
  margin-bottom: 1.4rem;
  background: linear-gradient(135deg, #eaf7fb 0%, #f0faff 100%);
  padding: 0.82rem 1.1rem;
  border-left: 4px solid #00e0fe;
  border-radius: 6px;
  width: 100%;
  box-sizing: border-box;
  font-style: italic;
  box-shadow: 0 1px 4px rgba(0,224,254,0.1);
}
.gen-status { display: inline-block; margin-left: 1.2em; font-size: 1.08rem; color: #00b3c4; min-width: 78px; font-weight: 700; letter-spacing: 0.04em; vertical-align: middle; }
#metaDataBox { margin-top: 18px; width: 100%; }

/* =============================================== */
/* VIDEO CONTAINER & VIDEO: YouTube-style 16:9 Viewer */
/* =============================================== */
.video-container {
  position: relative;
  width: 720px;              /* Standard YouTube player width */
  max-width: 100%;
  aspect-ratio: 16 / 9;
  margin: 24px auto 16px auto;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(0,0,0,.25);
  display: block;
}

.video-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  background: #000;
  display: block;
  border-radius: 0;
  margin: 0 auto;
  outline: none;

  /* === Player stability guards (Safari/WebKit) === */
  transform: none !important;
  animation: none !important;
  transition: none !important;
  filter: none !important;
  backface-visibility: hidden;
  will-change: auto;
  contain: paint;
}

@media (max-width: 800px) {
  .video-container {
    width: 100vw;
    height: calc(100vw * 9 / 16); /* fallback for older browsers */
    max-width: 100%;
    border-radius: 0;
  }
}

/* ================================ */
/* REST OF ORIGINAL CSS UNCHANGED   */
/* ================================ */

#output {
  min-height: 2.2rem;
  padding: .8rem;
  background: #f0f8ff;
  border: 1px solid #cce6ff;
  border-radius: 6px;
  font-family: monospace;
  margin-bottom: 1.2rem;
  width: 100%;
  word-break: break-word;
}
#downloadBtn { display: none; margin-bottom: 1rem; }
#shareBtn { display: none; margin-bottom: 1rem; }
#progressBarWrap {
  width: 100%;
  background: #e6f2fa;
  border-radius: 10px;
  margin: 10px 0;
  height: 24px;
  box-shadow: 0 2px 12px #00e0fe33;
  display: none;
}
#progressBar {
  height: 100%;
  background: linear-gradient(90deg,#00e0fe,#00b3c4 85%);
  width: 0;
  border-radius: 10px;
  transition: width 0.25s;
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  text-align: center;
  line-height: 24px;
}
#progressStatus { margin-top: 6px; font-size: 0.98rem; min-height: 1.4em; }
.meta-group { margin: 10px 0 22px 0; }
.meta-label { font-weight: bold; font-size:1.04em; color:#0a2342; margin-bottom:2px; display:flex; align-items:center; gap:4px; position: relative; }
.meta-value {
  background: #f0f8ff;
  border: 1.5px solid #cce6ff;
  border-radius: 5px;
  padding: 7px 44px 7px 10px;
  font-size: 1rem;
  color: #0a2342;
  font-family: inherit;
  position: relative;
  margin-bottom:6px;
  min-height: 26px;
  white-space: pre-line;
  word-break: break-word;
  user-select: all;
}
.copy-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 7px;
  margin-left: 4px;
  color: #00e0fe;
  font-size: 1.11em;
  border-radius: 4px;
  transition: background 0.15s;
  position: absolute;
  top: 7px;
  right: 5px;
  display: flex;
  align-items: center;
  outline: none;
}
.copy-btn:hover { background: #d4f1ff; }
.copy-btn.copied { color: #008000; background: #c9f7d2; }
.branding-toggle-row { display: flex; align-items: center; margin-bottom: 14px; gap: 12px; }
.switch { position: relative; display: inline-block; width: 48px; height: 28px; }
.switch input { display: none; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #a0cfee; transition: .4s; border-radius: 30px; }
.slider:before { position: absolute; content: ""; height: 22px; width: 22px; left: 3px; bottom: 3px; background-color: #fff; transition: .4s; border-radius: 50%; box-shadow: 0 1px 6px #00e0fe33; }
input:checked + .slider { background-color: #00e0fe; }
input:checked + .slider:before { transform: translateX(20px); background: #e6f2fa; }
.branding-label { font-size:1rem; font-weight:600; color:#0a2342; margin-right:10px; }

/* ============================== */
/* SECTION 6: CHATBOT BUBBLE      */
/* ============================== */
#chatbot-bubble {
  position: fixed;
  bottom: 26px;
  right: 26px;
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg,#00e0fe 80%,#00b3c4 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 32px #00e0fe70, 0 1.5px 9px #0a234266;
  transition: background 0.22s, transform 0.12s;
  z-index: 1000;
  animation: bounce 1.5s infinite alternate cubic-bezier(.65,-0.25,.5,1.25);
  border: 2.5px solid #fff;
}
#chatbot-bubble:hover { background: linear-gradient(135deg,#00b3c4 80%,#00e0fe 100%); transform: scale(1.09) rotate(-6deg); box-shadow: 0 12px 36px #00b3c470, 0 1.5px 9px #0a234266; }
@media (max-width: 600px) { #chatbot-bubble::after { display:none; } }
@keyframes poptext { from { opacity: 0.6; } to { opacity: 0.96; } }
@keyframes sparkieblink { 0%, 95%, 100% { fill: #ffe800; } 96% { fill: #fff; } }
@keyframes bounce { from { transform: translateY(0);} to   { transform: translateY(-10px);} }

/* ============================== */
/* DURATION ESTIMATE STYLES       */
/* ============================== */
.duration-estimate-container {
  margin-top: 12px;
  width: 100%;
}

.duration-estimate {
  padding: 14px 16px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  font-weight: 600;
  animation: fadeIn 0.3s ease-in;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  transition: all 0.2s ease;
}

.duration-estimate:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.duration-good {
  background: linear-gradient(135deg, #d4edda 0%, #e8f5e8 100%);
  border: 2px solid #c3e6cb;
  color: #155724;
}

.duration-caution {
  background: linear-gradient(135deg, #fff3cd 0%, #fffae6 100%);
  border: 2px solid #ffeaa7;
  color: #856404;
}

.duration-warning {
  background: linear-gradient(135deg, #f8d7da 0%, #fce4e6 100%);
  border: 2px solid #f5c6cb;
  color: #721c24;
}

.duration-icon {
  font-size: 20px;
  min-width: 20px;
  animation: pulse 2s infinite;
}

.duration-text {
  flex: 1;
}

.duration-text strong {
  display: block;
  margin-bottom: 4px;
  font-size: 16px;
  letter-spacing: -0.2px;
}

.duration-text small {
  font-size: 13px;
  opacity: 0.85;
  font-weight: 500;
  line-height: 1.3;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

/* Responsive adjustments for duration estimate */
@media (max-width: 600px) {
  .duration-estimate {
    padding: 12px 14px;
    font-size: 14px;
    gap: 10px;
  }

  .duration-icon {
    font-size: 18px;
  }

  .duration-text strong {
    font-size: 15px;
  }

  .duration-text small {
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .duration-estimate {
    flex-direction: column;
    text-align: center;
    gap: 8px;
  }

  .duration-text {
    text-align: center;
  }
}

/* Special styling for different duration ranges */
.duration-good .duration-icon {
  color: #28a745;
  text-shadow: 0 0 8px rgba(40, 167, 69, 0.3);
}

.duration-caution .duration-icon {
  color: #ffc107;
  text-shadow: 0 0 8px rgba(255, 193, 7, 0.3);
}

.duration-warning .duration-icon {
  color: #dc3545;
  text-shadow: 0 0 8px rgba(220, 53, 69, 0.3);
}

/* Integration with existing form styles */
.duration-estimate-container + section {
  margin-top: 2rem;
}

/* Enhanced hover effects */
.duration-good:hover {
  border-color: #28a745;
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.15);
}

.duration-caution:hover {
  border-color: #ffc107;
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.15);
}

.duration-warning:hover {
  border-color: #dc3545;
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.15);
}

/* Spinner for progress status */
.progress-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #b3e0fc;
  border-top: 2px solid #00b3c4;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
  margin-left: 8px;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
