/* ===== RSR CONTRACTOR ORIENTATION - STYLESHEET ===== */

/* ===== CSS VARIABLES ===== */
:root {
  --rsr-red: #E74C3C;
  --rsr-dark-red: #C0392B;
  --rsr-blue: #3498DB;
  --rsr-teal: #1ABC9C;
  --rsr-green: #27AE60;
  --rsr-dark: #2C3E50;
  --rsr-gray: #E8ECF1;
  --rsr-border: #D1D5DB;
  --rsr-text: #374151;
  --rsr-text-light: #6B7280;
  --rsr-light: #F9FAFB;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--rsr-gray);
  color: var(--rsr-text);
  line-height: 1.6;
  overflow-x: hidden;
}

/* ===== LOGIN OVERLAY ===== */
.login-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: linear-gradient(135deg, #1a2a6c 0%, #b21f1f 50%, #fdbb2d 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  transition: opacity 0.3s, visibility 0.3s;
}
.login-overlay.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.login-card {
  background: white; border-radius: 16px; padding: 40px 32px;
  width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  text-align: center;
}
.login-card img { height: 90px; margin-bottom: 20px; }
.login-card h1 { color: var(--rsr-red); font-size: 1.6rem; margin-bottom: 6px; }
.login-card .subtitle { color: var(--rsr-text-light); margin-bottom: 30px; font-size: 0.95rem; }

.form-group { text-align: left; margin-bottom: 18px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.9rem; }
.form-group input, .form-group select {
  width: 100%; padding: 12px; border: 2px solid var(--rsr-border);
  border-radius: 8px; font-size: 1rem; transition: border-color 0.3s;
}
.form-group input:focus, .form-group select:focus {
  outline: none; border-color: var(--rsr-blue);
}
.form-group .error-msg { color: var(--rsr-red); font-size: 0.85rem; margin-top: 4px; display: none; }
.form-group.error input, .form-group.error select { border-color: var(--rsr-red); }
.form-group.error .error-msg { display: block; }

.btn-start {
  width: 100%; padding: 14px; background: var(--rsr-red);
  color: white; border: none; border-radius: 8px; font-size: 1rem;
  font-weight: 700; cursor: pointer; transition: all 0.3s; margin-top: 10px;
}
.btn-start:hover { background: var(--rsr-dark-red); }
.btn-start:active { transform: scale(0.98); }

.login-settings {
  margin-top: 20px; padding-top: 16px; border-top: 1px solid #e0e0e0; text-align: center;
}
.login-settings-btn {
  background: none; border: 1px solid #ccc; color: #777;
  padding: 8px 20px; border-radius: 6px; font-size: 0.85rem;
  cursor: pointer; transition: all 0.2s;
}
.login-settings-btn:hover { background: #f5f5f5; color: var(--rsr-red); border-color: var(--rsr-red); }

/* ===== HEADER ===== */
.app-header {
  height: 60px; background: white; display: flex; align-items: center;
  justify-content: space-between; padding: 0 24px; position: sticky; top: 0;
  z-index: 1000; box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.header-logo { height: 36px; }
.header-title {
  flex: 1; margin-left: 16px; font-size: 1.3rem; font-weight: 700;
  color: var(--rsr-dark); display: flex; align-items: center; gap: 8px;
}
.header-title span { color: var(--rsr-red); }

.header-right {
  display: flex; align-items: center; gap: 16px;
}
.header-user { font-weight: 600; font-size: 0.95rem; }
.progress-badge {
  background: var(--rsr-red); color: white; padding: 4px 12px;
  border-radius: 20px; font-weight: 700; font-size: 0.85rem;
}

/* Voice controls */
.voice-controls { display: flex; align-items: center; gap: 6px; }
.voice-toggle {
  display: flex; align-items: center; gap: 6px;
  background: var(--rsr-gray); padding: 5px 12px;
  border-radius: 20px; cursor: pointer; user-select: none;
  border: 2px solid transparent; transition: all 0.3s;
}
.voice-toggle:hover { border-color: var(--rsr-blue); }
.voice-toggle.active { background: #e3f2fd; border-color: var(--rsr-blue); }
.voice-toggle .voice-icon { font-size: 1.2rem; }
.voice-toggle .voice-label { font-size: 0.8rem; font-weight: 600; color: var(--rsr-text); }
.voice-select {
  background: var(--rsr-gray); border: 2px solid transparent;
  border-radius: 8px; padding: 4px 6px; font-size: 0.75rem;
  color: var(--rsr-text); cursor: pointer; max-width: 150px;
  transition: all 0.3s; outline: none;
}
.voice-select:hover, .voice-select:focus { border-color: var(--rsr-blue); }
.voice-rate {
  background: var(--rsr-gray); border: 2px solid transparent;
  border-radius: 8px; padding: 4px 6px; font-size: 0.7rem;
  color: var(--rsr-text); cursor: pointer;
  transition: all 0.3s; outline: none;
}
.voice-rate:hover, .voice-rate:focus { border-color: var(--rsr-blue); }

/* ===== SIDEBAR ===== */
.app-sidebar {
  width: 260px; background: var(--rsr-dark); height: calc(100vh - 60px);
  overflow-y: auto; position: fixed; top: 60px; left: 0;
  padding: 20px 0; z-index: 900;
}
.sidebar-section { margin-bottom: 24px; padding: 0 16px; }
.sidebar-section-title {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px;
  color: rgba(255,255,255,0.4); margin-bottom: 8px; font-weight: 700;
}
.sidebar-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  color: rgba(255,255,255,0.7); border-radius: 6px; cursor: pointer;
  transition: all 0.2s; font-size: 0.9rem;
}
.sidebar-item:hover { background: rgba(255,255,255,0.1); }
.sidebar-item.active { background: var(--rsr-red); color: white; }
.sidebar-item.locked { opacity: 0.4; cursor: not-allowed; }
.sidebar-item.completed { color: var(--rsr-teal); }
.sidebar-item .checkmark { opacity: 0; }
.sidebar-item.completed .checkmark { opacity: 1; }

/* ===== MAIN CONTENT ===== */
.app-main {
  margin-left: 260px; padding: 32px; min-height: calc(100vh - 60px);
  background: var(--rsr-light);
}

/* ===== SLIDES ===== */
.slide-container {
  background: white; border-radius: 12px; box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  overflow: hidden;
  margin-bottom: 24px; border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--rsr-border);
  background: #fafafa;
}
.slide-body { padding: 36px; }

/* Slide content text */
.slide-content { line-height: 1.8; font-size: 1.02rem; color: var(--rsr-text); }
.slide-content h3 { color: var(--rsr-red); font-size: 1.25rem; margin: 20px 0 10px; }
.slide-content ul { padding-left: 24px; margin: 10px 0; }
.slide-content li { margin-bottom: 6px; }
.slide-content strong { color: var(--rsr-dark); }
.slide-content .highlight-box {
  background: #fff3e0; border-left: 4px solid #ff9800;
  padding: 14px 18px; border-radius: 0 8px 8px 0;
  margin: 16px 0; font-weight: 500;
}
.slide-content .danger-box {
  background: #ffebee; border-left: 4px solid #f44336;
  padding: 14px 18px; border-radius: 0 8px 8px 0;
  margin: 16px 0; font-weight: 500;
}

/* Voiceover highlighting */
.voice-sentence { transition: background 0.3s; }
.voice-sentence.speaking { background: #fff59d; }

/* Quiz */
.quiz-section {
  background: var(--rsr-light); padding: 24px; border-radius: 8px;
  margin-top: 24px; border: 2px solid var(--rsr-border);
}
.quiz-section h3 { margin-bottom: 16px; color: var(--rsr-dark); }
.quiz-question { margin-bottom: 20px; }
.quiz-question h4 { margin-bottom: 10px; font-weight: 600; }
.quiz-options { margin-left: 0; list-style: none; }
.quiz-options li {
  padding: 10px 12px; margin-bottom: 6px; border: 2px solid var(--rsr-border);
  border-radius: 6px; cursor: pointer; transition: all 0.2s;
}
.quiz-options li:hover { background: var(--rsr-gray); }
.quiz-options li.selected { border-color: var(--rsr-blue); background: #e3f2fd; }
.quiz-options li.correct { border-color: var(--rsr-green); background: #e8f5e9; }
.quiz-options li.incorrect { border-color: var(--rsr-red); background: #ffebee; }

.quiz-feedback {
  margin-top: 16px; padding: 12px; border-radius: 6px; font-weight: 600;
  display: none;
}
.quiz-feedback.success { background: #e8f5e9; color: var(--rsr-green); }
.quiz-feedback.error { background: #ffebee; color: var(--rsr-red); }

.btn-quiz {
  padding: 10px 24px; background: var(--rsr-blue); color: white;
  border: none; border-radius: 6px; font-weight: 600; cursor: pointer;
  margin-top: 16px; transition: all 0.3s;
}
.btn-quiz:hover { background: #1565c0; }

/* Slide navigation */
.slide-nav {
  padding: 16px 36px; background: white; border-top: 1px solid var(--rsr-border);
  display: flex; align-items: center; justify-content: space-between;
}
.btn-nav {
  padding: 10px 24px; border-radius: 6px; font-weight: 600;
  cursor: pointer; transition: all 0.3s; border: none;
}
.btn-prev { background: var(--rsr-gray); color: var(--rsr-text); }
.btn-prev:hover { background: #d1d5db; }
.btn-next { background: var(--rsr-red); color: white; }
.btn-next:hover { background: var(--rsr-dark-red); }
.btn-next:disabled { opacity: 0.5; cursor: not-allowed; }
.slide-counter { font-weight: 600; color: var(--rsr-text-light); }

/* ===== CERTIFICATE ===== */
.certificate-container {
  max-width: 960px; margin: 0 auto;
  background: white; border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  overflow: hidden;
}
.certificate-preview {
  padding: 40px; background: white;
}
.certificate-frame {
  border: 4px double var(--rsr-dark); padding: 50px 40px;
  text-align: center; position: relative;
  background: linear-gradient(135deg, #fafafa 0%, white 50%, #fafafa 100%);
}
.certificate-frame::before, .certificate-frame::after {
  content: ''; position: absolute; border: 2px solid var(--rsr-red);
}
.certificate-frame::before { inset: 8px; }
.certificate-frame::after { inset: 14px; border-color: var(--rsr-border); border-style: dashed; }

.cert-logo { height: 80px; margin-bottom: 16px; position: relative; z-index: 1; }
.cert-title { font-size: 2rem; color: var(--rsr-red); font-weight: 800; margin-bottom: 4px; position: relative; z-index: 1; }
.cert-subtitle { font-size: 1.1rem; color: var(--rsr-text-light); margin-bottom: 24px; position: relative; z-index: 1; }
.cert-awarded-to { font-size: 0.9rem; color: var(--rsr-text-light); margin-bottom: 6px; position: relative; z-index: 1; }
.cert-name { font-size: 2rem; color: var(--rsr-dark); font-family: 'Georgia', serif; font-style: italic; margin-bottom: 4px; position: relative; z-index: 1; }
.cert-company { font-size: 1rem; color: var(--rsr-text-light); margin-bottom: 4px; position: relative; z-index: 1; }
.cert-yard { font-size: 1rem; color: var(--rsr-teal); font-weight: 600; margin-bottom: 20px; position: relative; z-index: 1; }
.cert-description { font-size: 0.9rem; color: var(--rsr-text-light); max-width: 600px; margin: 0 auto 24px; line-height: 1.6; position: relative; z-index: 1; }
.cert-date { font-size: 0.95rem; color: var(--rsr-text); font-weight: 600; margin-bottom: 4px; position: relative; z-index: 1; }
.cert-expiry { font-size: 0.85rem; color: var(--rsr-red); font-weight: 600; position: relative; z-index: 1; }
.cert-id { font-size: 0.75rem; color: #999; margin-top: 16px; position: relative; z-index: 1; }

/* Wallet Card */
.wallet-section {
  padding: 30px 40px; border-top: 1px solid var(--rsr-border); background: white;
}
.wallet-section h3 { font-size: 1.1rem; color: var(--rsr-dark); margin-bottom: 6px; text-align: center; }
.wallet-section .wallet-hint { font-size: 0.82rem; color: var(--rsr-text-light); text-align: center; margin-bottom: 18px; }
.wallet-card-wrapper { display: flex; justify-content: center; }
.wallet-card {
  width: 3.5in; height: 2in; border: 2px solid var(--rsr-dark); border-radius: 8px;
  padding: 10px 14px; display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(135deg, #fafafa 0%, white 50%, #fafafa 100%);
  position: relative; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.wallet-card::after {
  content: ''; position: absolute; inset: 4px; border: 1px solid var(--rsr-red);
  border-radius: 5px; pointer-events: none;
}
.wallet-top { display: flex; align-items: center; gap: 8px; }
.wallet-top img { height: 28px; }
.wallet-top-text { flex: 1; }
.wallet-top-text .wt-title { font-size: 0.55rem; font-weight: 800; color: var(--rsr-red); text-transform: uppercase; line-height: 1.2; }
.wallet-top-text .wt-sub { font-size: 0.45rem; color: var(--rsr-text-light); line-height: 1.2; }
.wallet-body { position: relative; z-index: 1; }
.wallet-body .wb-name { font-size: 0.7rem; font-weight: 700; color: var(--rsr-dark); font-family: 'Georgia', serif; }
.wallet-body .wb-company { font-size: 0.48rem; color: var(--rsr-text-light); }
.wallet-body .wb-yard { font-size: 0.48rem; color: var(--rsr-teal); font-weight: 600; }
.wallet-bottom {
  display: flex; justify-content: space-between; align-items: flex-end; position: relative; z-index: 1;
}
.wallet-bottom .wb-dates { font-size: 0.42rem; color: var(--rsr-text); line-height: 1.5; }
.wallet-bottom .wb-dates strong { color: var(--rsr-dark); }
.wallet-bottom .wb-dates .wb-expiry { color: var(--rsr-red); font-weight: 600; }
.wallet-bottom .wb-certid { font-size: 0.38rem; color: #999; text-align: right; }

.cert-actions {
  padding: 24px 40px; background: #fafafa; border-top: 1px solid var(--rsr-border);
  display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
}
.btn-cert {
  padding: 12px 28px; border-radius: 8px; font-size: 0.95rem;
  font-weight: 600; cursor: pointer; border: none;
  display: flex; align-items: center; gap: 8px; transition: all 0.3s;
}
.btn-download { background: var(--rsr-green); color: white; }
.btn-download:hover { background: #388e3c; }
.btn-wallet { background: #6d4c41; color: white; }
.btn-wallet:hover { background: #4e342e; }
.btn-email { background: var(--rsr-blue); color: white; }
.btn-email:hover { background: #1565c0; }
.btn-print { background: var(--rsr-teal); color: white; }
.btn-print:hover { background: #00695c; }

.email-sent-msg {
  text-align: center; padding: 12px; background: #e8f5e9;
  color: var(--rsr-green); font-weight: 600; border-radius: 6px;
  display: none; margin-top: 12px;
}
.email-sent-msg.show { display: block; }

/* ===== MODALS ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 10001; display: none;
  background: rgba(0,0,0,0.5); align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal-card {
  background: white; border-radius: 12px; width: 100%; max-width: 600px;
  max-height: 90vh; overflow-y: auto; padding: 24px;
}
.modal-card h2 { color: var(--rsr-dark); margin-bottom: 8px; }
.modal-subtitle { color: var(--rsr-text-light); margin-bottom: 20px; }

.settings-locked-msg {
  text-align: center; padding: 30px; margin-bottom: 20px;
}
.lock-icon { font-size: 3rem; margin-bottom: 12px; }
.settings-password-section { margin-top: 20px; }
.btn-unlock {
  width: 100%; padding: 12px; background: var(--rsr-blue); color: white;
  border: none; border-radius: 8px; font-weight: 600; cursor: pointer;
}
.btn-unlock:hover { background: #1565c0; }

.modal-section { margin-bottom: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--rsr-border); }
.modal-section:last-child { border-bottom: none; }
.modal-section h3 { font-size: 1rem; margin-bottom: 8px; }
.yard-email-section { display: flex; flex-direction: column; gap: 16px; }
.yard-email-group { background: var(--rsr-light); padding: 16px; border-radius: 8px; }
.yard-email-group h4 { font-size: 0.9rem; margin-bottom: 8px; }
.email-row { display: flex; gap: 8px; margin-bottom: 8px; }
.email-row input { flex: 1; padding: 8px; border: 1px solid var(--rsr-border); border-radius: 6px; }
.btn-remove-email {
  padding: 8px 12px; background: #ffebee; color: var(--rsr-red);
  border: 1px solid var(--rsr-red); border-radius: 6px; cursor: pointer;
}
.btn-add-email {
  padding: 8px 16px; background: var(--rsr-gray); color: var(--rsr-text);
  border: 1px solid var(--rsr-border); border-radius: 6px; cursor: pointer;
  font-size: 0.85rem;
}
.btn-add-email:hover { background: #d1d5db; }

.modal-actions {
  display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px;
}
.btn-modal {
  padding: 10px 20px; border-radius: 6px; font-weight: 600; cursor: pointer;
  border: none; transition: all 0.3s;
}
.btn-modal-cancel { background: var(--rsr-gray); color: var(--rsr-text); }
.btn-modal-cancel:hover { background: #d1d5db; }
.btn-modal-save { background: var(--rsr-green); color: white; }
.btn-modal-save:hover { background: #388e3c; }

/* ===== TOAST ===== */
.toast {
  position: fixed; bottom: 30px; right: 30px;
  background: #323232; color: white; padding: 14px 24px;
  border-radius: 8px; font-size: 0.95rem; z-index: 9999;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  transform: translateY(100px); opacity: 0; transition: all 0.4s;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: var(--rsr-green); }
.toast.error { background: var(--rsr-red); }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .app-sidebar { display: none; }
  .app-main { margin-left: 0; padding: 20px; }
  .voice-controls { flex-direction: column; gap: 4px; }
}
@media (max-width: 600px) {
  .header-title span { display: none; }
  .login-card { padding: 30px 24px; }
  .slide-body { padding: 20px; }
}

/* ===== PRINT ===== */
@media print {
  .app-header, .app-sidebar, .slide-nav, .cert-actions,
  .btn-nav, .voice-controls, .login-overlay, .email-sent-msg { display: none !important; }
  .app-main { position: static; padding: 0; background: white; }
  .slide-container, .certificate-container { box-shadow: none; border-radius: 0; }
  .certificate-frame { break-inside: avoid; }
  .wallet-section { break-before: page; }
  .wallet-section h3, .wallet-section .wallet-hint { display: none; }
  .wallet-card { box-shadow: none; }
  body { overflow: visible; height: auto; }

  body.print-wallet .certificate-preview { display: none !important; }
  body.print-wallet .wallet-section { break-before: auto; padding: 0; border: none; }
  body.print-wallet .wallet-card { margin: 0; border-radius: 0; }
}

/* ===== ANIMATIONS ===== */
@keyframes slideIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.slide-container, .certificate-container { animation: slideIn 0.4s ease; }