/* ============================================
   APP STYLES - OnCue 2E Editorial
   ============================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Libre Franklin', sans-serif;
  background: #f8f7f5;
  color: #1a1a1a;
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

/* --------------------------------------------
   Auth Pages (Login, Success, Error)
   -------------------------------------------- */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.auth-page header {
  padding: 24px 48px;
}

.logo {
  font-family: 'Lora', serif;
  font-size: 20px;
  font-weight: 500;
}

.auth-page main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}

.auth-page h1 {
  font-family: 'Lora', serif;
  font-size: 36px;
  font-weight: 400;
  margin-bottom: 32px;
  line-height: 1.3;
}

.login-form {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-form input[type="email"] {
  padding: 14px 16px;
  font-size: 16px;
  font-family: inherit;
  border: 1px solid #ddd;
  background: #fff;
  color: #1a1a1a;
  width: 100%;
}

.login-form input[type="email"]:focus {
  outline: none;
  border-color: #1a1a1a;
}

.login-form input[type="email"]::placeholder {
  color: #999;
}

.btn-primary {
  background: #1a1a1a;
  color: #fff;
  border: none;
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
  text-align: center;
  display: inline-block;
}

.btn-primary:hover {
  background: #333;
}

.divider {
  margin-top: 40px;
  font-size: 14px;
  color: #888;
}

.divider a {
  color: #1a1a1a;
  text-decoration: none;
}

.divider a:hover {
  text-decoration: underline;
}

.subtitle {
  font-size: 16px;
  color: #555;
  margin-bottom: 32px;
  line-height: 1.6;
  max-width: 360px;
}

.support {
  margin-top: 32px;
  font-size: 14px;
  color: #888;
}

.support a {
  color: #555;
  text-decoration: none;
}

.support a:hover {
  text-decoration: underline;
}

/* Auth Success specific */
.icon {
  width: 64px;
  height: 64px;
  border: 2px solid #1a1a1a;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: 24px;
}

.email-sent {
  font-size: 14px;
  color: #888;
  margin-bottom: 32px;
}

.email-sent strong {
  color: #1a1a1a;
}

.btn-tertiary {
  background: transparent;
  color: #888;
  border: none;
  padding: 12px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.2s;
}

.btn-tertiary:hover {
  color: #1a1a1a;
}

/* Auth Error specific */
#auth-error h1 {
  font-size: 32px;
  margin-bottom: 16px;
}

/* --------------------------------------------
   Setup Panel
   -------------------------------------------- */
#setup-panel {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#setup-panel header {
  padding: 24px 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e8e6e1;
}

.setup-main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 0;
}

.script-section {
  padding: 32px 48px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #e8e6e1;
}

#script-input {
  flex: 1;
  min-height: 300px;
  padding: 16px;
  font-size: 16px;
  font-family: inherit;
  line-height: 1.6;
  border: 1px solid #ddd;
  background: #fff;
  color: #1a1a1a;
  resize: none;
}

#script-input:focus {
  outline: none;
  border-color: #1a1a1a;
}

#script-input::placeholder {
  color: #999;
}

.controls-section {
  padding: 32px;
  display: flex;
  flex-direction: column;
}

.controls-section h2 {
  font-family: 'Lora', serif;
  font-size: 20px;
  font-weight: 400;
  margin-bottom: 24px;
}

.control-group {
  margin-bottom: 24px;
}

.control-group label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: #555;
  margin-bottom: 8px;
}

.control-group label span {
  color: #1a1a1a;
  font-weight: 500;
}

.control-group input[type="range"] {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: #ddd;
  border-radius: 2px;
  outline: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: #1a1a1a;
  border-radius: 50%;
  cursor: pointer;
}

.control-group input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: #1a1a1a;
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

.controls-section .btn-primary {
  margin-top: auto;
  padding: 16px 32px;
  font-size: 16px;
}

/* --------------------------------------------
   Teleprompter Display (Dark Theme)
   -------------------------------------------- */
#teleprompter {
  height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: #000;
}

#reading-line,
#reading-zone {
  display: none;
}

#script-display {
  flex: 1;
  padding: 20px 15%;
  overflow: hidden;
  font-family: 'Lexend Deca', sans-serif;
  line-height: 1.5;
  text-align: left;
  position: relative;
  color: #fff;
}

.script-line {
  display: block;
  white-space: nowrap;
  margin-bottom: 0.2em;
}

.word {
  display: inline;
  transition: all 0.3s ease;
  padding: 2px 4px;
  border-radius: 4px;
}

.word.spoken {
  color: #444;
}

.word.current {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
  font-weight: 600;
}

.word.upcoming {
  color: #ccc;
}

/* Status Indicator */
#status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  margin-right: 8px;
  color: #888;
}

#status-indicator::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #666;
}

#status-indicator.listening::before {
  background: #4ade80;
  animation: pulse 1.5s infinite;
}

#status-indicator.paused::before {
  background: #fbbf24;
}

#status-indicator.error::before {
  background: #f87171;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Control Bar */
#control-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: #0a0a0a;
}

#control-bar button {
  padding: 6px 12px;
  font-size: 12px;
  background: #333;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}

#control-bar button:hover {
  background: #444;
}

/* Mirror mode */
body.mirrored #script-display {
  transform: scaleX(-1);
}

/* --------------------------------------------
   Responsive - Mobile
   -------------------------------------------- */
@media (max-width: 900px) {
  .setup-main {
    grid-template-columns: 1fr;
  }

  .script-section {
    border-right: none;
    border-bottom: 1px solid #e8e6e1;
    padding: 24px;
  }

  .controls-section {
    padding: 24px;
  }
}

@media (max-width: 600px) {
  .auth-page header {
    padding: 16px 24px;
  }

  .auth-page h1 {
    font-size: 28px;
  }

  #setup-panel header {
    padding: 16px 24px;
  }

  .script-section {
    padding: 16px;
  }

  .controls-section {
    padding: 16px;
  }

  #script-input {
    min-height: 200px;
    font-size: 16px; /* Prevents iOS zoom */
  }

  .controls-section h2 {
    font-size: 16px;
    margin-bottom: 16px;
  }

  .control-group {
    margin-bottom: 16px;
  }

  .control-group label {
    font-size: 12px;
  }

  .controls-section .btn-primary {
    padding: 14px 24px;
    font-size: 14px;
  }

  /* Teleprompter */
  #control-bar {
    flex-wrap: wrap;
    padding: 6px;
    gap: 4px;
  }

  #control-bar button {
    padding: 8px 10px;
    font-size: 12px;
    min-height: 36px;
  }

  #status-indicator {
    width: 100%;
    justify-content: center;
    margin-bottom: 4px;
  }
}

/* Elgato Prompter - compact height */
@media (max-height: 650px) {
  #setup-panel header {
    padding: 12px 24px;
  }

  .setup-main {
    grid-template-columns: 1fr 280px;
  }

  .script-section {
    padding: 16px 24px;
  }

  .controls-section {
    padding: 16px 20px;
  }

  .controls-section h2 {
    font-size: 16px;
    margin-bottom: 16px;
  }

  .control-group {
    margin-bottom: 16px;
  }

  .control-group label {
    font-size: 12px;
    margin-bottom: 4px;
  }

  .controls-section .btn-primary {
    padding: 12px 24px;
    font-size: 14px;
  }

  #script-input {
    min-height: 150px;
  }

  /* Compact control bar */
  #control-bar {
    padding: 4px;
    gap: 6px;
  }

  #control-bar button {
    padding: 4px 8px;
    font-size: 11px;
  }

  #status-indicator {
    font-size: 10px;
  }
}

/* Large screens */
@media (min-width: 1400px) {
  .auth-page h1 {
    font-size: 42px;
  }

  .setup-main {
    grid-template-columns: 1fr 400px;
  }

  .script-section {
    padding: 48px 64px;
  }

  .controls-section {
    padding: 48px;
  }

  .controls-section h2 {
    font-size: 24px;
  }

  #script-input {
    font-size: 18px;
  }

  #control-bar {
    padding: 12px;
    gap: 12px;
  }

  #control-bar button {
    padding: 10px 20px;
    font-size: 14px;
  }

  #status-indicator {
    font-size: 14px;
  }
}
