/* ==========================================================================
   CLASS MANAGER - LESSON PLAN WORKSPACE STYLESHEET (PHASE 5)
   Dedicated full-page layout for Lesson Plan authoring & professional feedback
   ========================================================================== */

:root {
  --lp-primary: #2563eb;
  --lp-primary-hover: #1d4ed8;
  --lp-primary-light: #eff6ff;
  --lp-success: #059669;
  --lp-success-hover: #047857;
  --lp-success-light: #ecfdf5;
  --lp-warning: #d97706;
  --lp-warning-light: #fffbeb;
  --lp-danger: #dc2626;
  --lp-danger-light: #fef2f2;
  --lp-border: #e2e8f0;
  --lp-border-focus: #3b82f6;
  --lp-card-bg: #ffffff;
  --lp-bg: #f8fafc;
  --lp-text: #1e293b;
  --lp-text-muted: #64748b;
  --lp-text-light: #94a3b8;
  --lp-radius-sm: 6px;
  --lp-radius-md: 10px;
  --lp-radius-lg: 14px;
  --lp-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --lp-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --lp-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body.lp-workspace-body {
  background-color: var(--lp-bg);
  color: var(--lp-text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.lp-header {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: #ffffff;
  padding: 0.55rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.lp-header-container {
  max-width: 1700px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.lp-header-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.lp-brand-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.lp-brand-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: drop-shadow(0 2px 5px rgba(220, 38, 38, 0.3));
}

.lp-brand-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: #ffffff;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.lp-badge-workspace {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.12rem 0.48rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.25);
}

.lp-header-divider {
  width: 1px;
  height: 22px;
  background: rgba(255, 255, 255, 0.18);
  margin: 0 0.25rem;
}

.lp-btn-back {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(255, 255, 255, 0.08);
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.38rem 0.75rem;
  border-radius: 6px;
  font-size: 0.92rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.lp-btn-back:hover {
  background: rgba(220, 38, 38, 0.2);
  border-color: rgba(220, 38, 38, 0.5);
  color: #ffffff;
  transform: none;
}

.lp-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.lp-user-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.38rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.92rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.lp-user-role-badge {
  background: rgba(255, 255, 255, 0.18);
  color: #e2e8f0;
  font-size: 0.78rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Main Container */
.lp-main-container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 6rem 1.5rem;
  box-sizing: border-box;
  flex: 1;
}

/* Read-only Context Banner */
.lp-context-banner {
  background: #ffffff;
  border: 1.5px solid var(--lp-border);
  border-radius: var(--lp-radius-lg);
  padding: 1.35rem 1.6rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--lp-shadow-sm);
  transition: box-shadow 0.2s ease;
}

.lp-context-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem 1.75rem;
}

.lp-context-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.lp-context-label {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--lp-text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.lp-context-label i,
.lp-context-label svg {
  width: 15px;
  height: 15px;
  color: var(--lp-primary);
}

.lp-context-value {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--lp-text);
  word-break: break-word;
  line-height: 1.45;
}

.lp-context-value.class-name {
  color: var(--lp-primary);
  font-size: 1.25rem;
  font-weight: 800;
}

/* Status Badges */
.lp-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.lp-status-ready {
  background: var(--lp-success-light);
  color: var(--lp-success-hover);
  border: 1px solid #a7f3d0;
}

.lp-status-draft {
  background: var(--lp-warning-light);
  color: #92400e;
  border: 1px solid #fde68a;
}

.lp-status-notprep {
  background: var(--lp-danger-light);
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* Read-Only Notice Bar */
.lp-readonly-notice {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-left: 4px solid #64748b;
  border-radius: var(--lp-radius-md);
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.88rem;
  color: #334155;
}

/* OCC Conflict Box */
.lp-conflict-box {
  background: #fffbeb;
  border: 1px solid #f59e0b;
  border-left: 5px solid #d97706;
  border-radius: var(--lp-radius-md);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.25rem;
  display: none;
  box-shadow: var(--lp-shadow-sm);
  animation: fadeIn 0.3s ease;
}

/* Workspace Layout (Single column layout with comments at bottom) */
.lp-workspace-layout {
  display: block;
}

.lp-sidebar-column {
  width: 100%;
}

/* Form Card */
.lp-card {
  background: var(--lp-card-bg);
  border: 1px solid var(--lp-border);
  border-radius: var(--lp-radius-lg);
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--lp-shadow-sm);
  transition: all 0.2s ease;
}

.lp-card:hover {
  box-shadow: var(--lp-shadow-md);
}

.lp-card-title {
  margin: 0 0 0.85rem 0;
  font-size: 0.98rem;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.lp-card-title .icon-emoji {
  display: none;
}

.lp-card-title .icon-lucide-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  color: #2563eb;
  flex-shrink: 0;
}

.lp-card-title .icon-lucide-wrap i,
.lp-card-title .icon-lucide-wrap svg {
  width: 19px;
  height: 19px;
  stroke-width: 2.25;
}

.lp-context-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--lp-text-muted);
}

.lp-context-label i,
.lp-context-label svg {
  width: 13px;
  height: 13px;
  stroke-width: 2;
  color: #64748b;
}

.lp-btn-back i,
.lp-btn-back svg {
  width: 16px;
  height: 16px;
  vertical-align: middle;
  display: inline-block;
  stroke-width: 2;
}

.lp-btn i,
.lp-btn svg {
  width: 15px;
  height: 15px;
  vertical-align: middle;
  display: inline-block;
  stroke-width: 2;
}

.lp-form-group {
  margin-bottom: 1rem;
}

.lp-form-group:last-child {
  margin-bottom: 0;
}

.lp-form-label {
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--lp-text);
  margin-bottom: 0.35rem;
}

.lp-form-label .required {
  color: var(--lp-danger);
}

.lp-input,
.lp-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 0.6rem 0.85rem;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--lp-text);
  background: #ffffff;
  border: 1px solid var(--lp-border);
  border-radius: var(--lp-radius-sm);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.lp-input:focus,
.lp-textarea:focus {
  border-color: var(--lp-border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.lp-input:disabled,
.lp-textarea:disabled,
.lp-input[readonly],
.lp-textarea[readonly] {
  background-color: #f8fafc;
  color: #334155;
  cursor: not-allowed;
  border-color: #cbd5e1;
}

.lp-textarea {
  resize: vertical;
  min-height: 80px;
}

.lp-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Comments Sidebar / Section */
.lp-comments-panel {
  background: #ffffff;
  border: 1px solid var(--lp-border);
  border-radius: var(--lp-radius-lg);
  padding: 1.35rem 1.5rem;
  box-shadow: var(--lp-shadow-sm);
  position: static;
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
}

.lp-comments-panel:hover {
  box-shadow: var(--lp-shadow-md);
}

.lp-comments-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--lp-border);
}

.lp-comments-count-badge {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--lp-primary);
  background: var(--lp-primary-light);
  padding: 2px 8px;
  border-radius: 9999px;
  border: 1px solid #bfdbfe;
}

.lp-btn-refresh-comments {
  background: transparent;
  border: 1px solid var(--lp-border);
  border-radius: var(--lp-radius-sm);
  color: var(--lp-text-muted);
  cursor: pointer;
  padding: 3px 8px;
  font-size: 0.95rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.lp-btn-refresh-comments:hover {
  background: #f1f5f9;
  color: var(--lp-primary);
  border-color: #cbd5e1;
}

.lp-btn-refresh-comments:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.lp-comments-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  overflow-y: auto;
  max-height: 420px;
  padding-right: 4px;
  margin-bottom: 0.85rem;
  min-height: 50px;
}

.lp-comment-item {
  background: #f8fafc;
  border: 1px solid var(--lp-border);
  border-radius: var(--lp-radius-sm);
  padding: 0.65rem 0.75rem;
  font-size: 0.85rem;
  transition: background 0.15s ease;
}

.lp-comment-item:hover {
  background: #f1f5f9;
}

.lp-comment-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.3rem;
}

.lp-comment-author {
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.lp-comment-time {
  font-size: 0.72rem;
  color: var(--lp-text-light);
}

.lp-comment-body {
  color: var(--lp-text);
  white-space: pre-line;
  line-height: 1.45;
}

.lp-btn-del-comment {
  background: transparent;
  border: none;
  color: var(--lp-danger);
  cursor: pointer;
  padding: 0 4px;
  font-size: 0.85rem;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.15s ease;
}

.lp-btn-del-comment:hover {
  opacity: 1;
}

.lp-comment-input-box {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

/* Bottom Sticky Action Bar */
.lp-action-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--lp-border);
  padding: 0.75rem 1.5rem;
  z-index: 90;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
}

.lp-action-bar-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.lp-dirty-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--lp-warning);
}

.lp-action-buttons {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.lp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 1.25rem;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: var(--lp-radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.lp-btn-primary {
  background: var(--lp-primary);
  color: #ffffff;
}

.lp-btn-primary:hover:not(:disabled) {
  background: var(--lp-primary-hover);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.lp-btn-success {
  background: var(--lp-success);
  color: #ffffff;
}

.lp-btn-success:hover:not(:disabled) {
  background: var(--lp-success-hover);
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.3);
}

.lp-btn-secondary {
  background: #f1f5f9;
  color: #334155;
  border-color: #cbd5e1;
}

.lp-btn-secondary:hover:not(:disabled) {
  background: #e2e8f0;
}

.lp-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Loading & Empty States */
.lp-loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.lp-spinner {
  width: 42px;
  height: 42px;
  border: 3px solid #cbd5e1;
  border-top-color: var(--lp-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
  .lp-workspace-layout {
    grid-template-columns: 1fr;
  }
  .lp-comments-panel {
    position: static;
    max-height: none;
  }
}

@media (max-width: 640px) {
  .lp-header-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  .lp-header-right {
    width: 100%;
    justify-content: space-between;
  }
  .lp-main-container {
    padding: 1rem 0.75rem 6.5rem 0.75rem;
  }
  .lp-grid-2col {
    grid-template-columns: 1fr;
  }
  .lp-context-grid {
    grid-template-columns: 1fr 1fr;
  }
  .lp-action-bar-container {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  .lp-action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

/* Phase 6B: Local Draft Recovery Banner & Status Badge */
.lp-recovery-banner {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-left: 5px solid #2563eb;
  border-radius: var(--lp-radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
  animation: fadeIn 0.3s ease;
}

.lp-local-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--lp-radius-sm);
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  transition: all 0.2s ease;
}

.lp-local-status-badge.unsynced {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}

.lp-local-status-badge.saved {
  background: #f0fdf4;
  color: #15803d;
  border-color: #bbf7d0;
}

.lp-local-status-badge.saving {
  background: #eff6ff;
  color: #2563eb;
  border-color: #bfdbfe;
}

/* ==========================================================================
   PHASE 7: DEDICATED PRINT & PDF EXPORT STYLES (A4 OPTIMIZED)
   ========================================================================== */

#lp-printable-document {
  display: none;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 12mm 15mm 15mm 15mm;
  }

  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }

  html, body {
    background: #ffffff !important;
    color: #0f172a !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
    font-size: 9.5pt !important;
    line-height: 1.5 !important;
    padding: 0 !important;
    margin: 0 !important;
    min-height: auto !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Hide interactive workspace UI */
  .lp-header,
  .lp-context-banner,
  .lp-readonly-notice,
  .lp-conflict-box,
  .lp-recovery-banner,
  .lp-workspace-layout,
  .lp-action-bar,
  .toast-container,
  .lp-loading-overlay,
  .lp-user-pill,
  button,
  .lp-btn,
  .lp-drawer-panel,
  .lp-drawer-overlay,
  .chat-floating-fixed-btn,
  .chat-widget-card,
  #chat-widget,
  #chat-notification-popup {
    display: none !important;
    visibility: hidden !important;
  }

  .lp-main-container,
  body.lp-previous-drawer-open .lp-main-container {
    padding: 0 !important;
    margin: 0 !important;
    margin-right: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    display: block !important;
    visibility: visible !important;
    height: auto !important;
    overflow: visible !important;
    box-sizing: border-box !important;
  }

  body.lp-previous-drawer-open {
    overflow: visible !important;
  }

  /* Display printable sheet */
  #lp-printable-document {
    display: block !important;
    visibility: visible !important;
    width: 100% !important;
    box-sizing: border-box !important;
    position: static !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  #lp-printable-document,
  #lp-printable-document * {
    visibility: visible !important;
  }

  .lp-print-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #1e3a8a;
    padding-bottom: 8px;
    margin-bottom: 12px;
  }

  .lp-print-brand {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .lp-print-logo {
    width: 44px !important;
    height: 44px !important;
    max-width: 44px !important;
    max-height: 44px !important;
    object-fit: contain !important;
    display: block !important;
    visibility: visible !important;
    flex-shrink: 0 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .lp-print-brand-text h2 {
    margin: 0;
    font-size: 13pt;
    font-weight: 800;
    color: #1e3a8a;
    text-transform: uppercase;
    letter-spacing: 0.02em;
  }

  .lp-print-brand-text p {
    margin: 2px 0 0 0;
    font-size: 8.5pt;
    color: #64748b;
  }

  .lp-print-doc-badge {
    text-align: right;
  }

  .lp-print-doc-badge .badge-title {
    font-size: 12pt;
    font-weight: 800;
    color: #0f172a;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin: 0;
  }

  .lp-print-doc-badge .badge-sub {
    font-size: 8pt;
    color: #64748b;
    margin: 2px 0 0 0;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  /* Meta Info Block (Section 1: Thông tin buổi học) */
  .lp-print-meta-grid {
    display: flex;
    flex-direction: column;
    gap: 9px;
    background: #f8fafc;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    padding: 12px 18px;
    margin-bottom: 14px;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .lp-print-meta-row {
    display: flex;
    align-items: baseline;
    justify-content: flex-start;
    gap: 28px;
    width: 100%;
  }

  .lp-print-meta-item {
    font-size: 9.6pt;
    line-height: 1.45;
    display: flex;
    align-items: baseline;
    gap: 7px;
    white-space: nowrap;
  }

  .lp-print-meta-item.flex-fill {
    flex: 1;
    min-width: 0;
  }

  .lp-print-meta-label {
    font-size: 9pt;
    font-weight: 800;
    color: #475569;
    flex-shrink: 0;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.03em;
  }

  .lp-print-meta-val {
    font-size: 9.6pt;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
  }

  .lp-print-meta-val.class-highlight {
    color: #1e3a8a;
    font-weight: 800;
    font-size: 10.5pt;
  }

  /* Plan Content Sections */
  .lp-print-section {
    margin-bottom: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 8px 12px;
    page-break-inside: avoid;
    break-inside: avoid;
    background: #ffffff;
  }

  .lp-print-section.highlight {
    border-left: 3.5px solid #2563eb;
  }

  .lp-print-section.success {
    border-left: 3.5px solid #059669;
  }

  .lp-print-section.note {
    background: #fffdf5;
    border-color: #fef08a;
    border-left: 3.5px solid #d97706;
  }

  .lp-print-section-title {
    font-size: 9.8pt;
    font-weight: 800;
    color: #1e3a8a;
    margin: 0 0 5px 0;
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 3px;
  }

  .lp-print-section-title .lp-print-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: #2563eb;
  }

  .lp-print-section-title .lp-print-icon i,
  .lp-print-section-title .lp-print-icon svg {
    width: 14px;
    height: 14px;
    stroke-width: 2.25;
  }

  .lp-print-section.success .lp-print-section-title .lp-print-icon {
    color: #059669;
  }

  .lp-print-section.note .lp-print-section-title .lp-print-icon {
    color: #d97706;
  }

  .lp-print-section-content {
    font-size: 9.2pt;
    line-height: 1.48;
    color: #1e293b;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    padding: 0;
    text-indent: 0;
  }

  .lp-print-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .lp-print-footer {
    margin-top: 16px;
    padding-top: 8px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    font-size: 7.8pt;
    color: #94a3b8;
    page-break-inside: avoid;
    break-inside: avoid;
  }
}

/* Tối ưu vị trí nút chat nổi và khung chat trong không gian Soạn Giáo Án */
.lp-workspace-body .chat-floating-fixed-btn {
  bottom: 76px !important;
  z-index: 1000;
}

.lp-workspace-body .chat-widget-card {
  bottom: 130px !important;
  z-index: 100000;
}

/* ==========================================================================
   SLIDE-OVER DRAWER: GIÁO ÁN BUỔI TRƯỚC (PREVIOUS LESSON PLAN DRAWER - SIDE-BY-SIDE DOCK)
   ========================================================================== */
.lp-drawer-overlay {
  display: none !important;
  pointer-events: none !important;
}

.lp-drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 500px;
  max-width: 90vw;
  background: #f8fafc;
  z-index: 950;
  box-shadow: -8px 0 24px -4px rgba(0, 0, 0, 0.18), -2px 0 6px rgba(0, 0, 0, 0.08);
  border-left: 1px solid #cbd5e1;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.lp-drawer-panel.active {
  transform: translateX(0);
}

/* Side-by-Side Workspace Layout Transitions */
.lp-main-container,
.lp-action-bar {
  transition: margin-right 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              max-width 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@media screen and (min-width: 1200px) {
  body.lp-previous-drawer-open .lp-main-container {
    margin-right: 500px;
    max-width: calc(100% - 510px);
  }
  body.lp-previous-drawer-open .lp-action-bar {
    right: 500px;
    max-width: calc(100% - 500px);
  }
}

@media screen and (min-width: 992px) and (max-width: 1199px) {
  .lp-drawer-panel {
    width: 440px;
  }
  body.lp-previous-drawer-open .lp-main-container {
    margin-right: 440px;
    max-width: calc(100% - 450px);
  }
  body.lp-previous-drawer-open .lp-action-bar {
    right: 440px;
    max-width: calc(100% - 440px);
  }
}

@media screen and (max-width: 991px) {
  .lp-drawer-panel {
    width: 420px;
    max-width: 90vw;
    z-index: 1000;
  }
}

.lp-drawer-header {
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.lp-drawer-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.lp-drawer-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.25);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #60a5fa;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.lp-drawer-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lp-drawer-subtitle {
  margin: 0.15rem 0 0 0;
  font-size: 0.8rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lp-drawer-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.lp-drawer-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #f1f5f9;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.lp-drawer-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.lp-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

/* Context Banner Previous Plan Selector */
.lp-ctx-prev-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.lp-ctx-prev-display {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-size: 0.92rem;
  line-height: 1.35;
}

.lp-ctx-prev-date {
  color: #0284c7;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.lp-ctx-prev-topic {
  color: #64748b;
  font-size: 0.82rem;
  font-weight: normal;
}

.lp-ctx-prev-dropdown-wrap {
  margin-top: 0.15rem;
}

.lp-ctx-prev-select {
  width: 100%;
  max-width: 280px;
  padding: 0.3rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #1e293b;
  background-color: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  outline: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lp-ctx-prev-select:hover {
  background-color: #e2e8f0;
  border-color: #94a3b8;
}

.lp-ctx-prev-select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
  background-color: #ffffff;
}

/* Slide-over Drawer Session Picker */
.lp-prev-picker-box {
  background: linear-gradient(135deg, #ffffff 0%, #f0f7ff 100%);
  border: 1.5px solid #bfdbfe;
  border-radius: 9px;
  padding: 0.8rem 0.95rem;
  box-shadow: 0 2px 6px -1px rgba(37, 99, 235, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.lp-prev-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.lp-prev-picker-title {
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #1d4ed8;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.lp-prev-picker-title i,
.lp-prev-picker-title svg {
  width: 14px;
  height: 14px;
  color: #2563eb;
}

.lp-prev-picker-counter {
  font-size: 0.72rem;
  font-weight: 700;
  color: #1e40af;
  background: #dbeafe;
  border: 1px solid #bfdbfe;
  padding: 2px 8px;
  border-radius: 10px;
}

.lp-prev-picker-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.lp-prev-select-wrap {
  flex: 1;
  min-width: 0;
}

.lp-prev-select-dropdown {
  width: 100%;
  padding: 0.45rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #0f172a;
  background-color: #ffffff;
  border: 1.5px solid #93c5fd;
  border-radius: 7px;
  outline: none;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lp-prev-select-dropdown:hover {
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px #3b82f6;
}

.lp-prev-select-dropdown:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.lp-prev-nav-btn {
  background: #ffffff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  padding: 0.42rem 0.65rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.15s ease;
  flex-shrink: 0;
  user-select: none;
}

.lp-prev-nav-btn:hover:not(:disabled) {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e40af;
}

.lp-prev-nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #94a3b8;
}

.lp-prev-nav-btn i,
.lp-prev-nav-btn svg {
  width: 13px;
  height: 13px;
}

/* Metadata Bar inside Drawer */
.lp-prev-meta-bar {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  font-size: 0.82rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.lp-prev-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #475569;
}

.lp-prev-meta-item strong {
  color: #0f172a;
}

/* Previous Plan Cards */
.lp-prev-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.9rem 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.lp-prev-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.lp-prev-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.lp-prev-card-title {
  margin: 0;
  font-size: 0.83rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.lp-prev-card-title i,
.lp-prev-card-title svg {
  width: 14px;
  height: 14px;
  color: #2563eb;
}

.lp-prev-card-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.lp-btn-copy-field,
.lp-btn-insert-field {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
  padding: 0.22rem 0.52rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.15s ease;
  user-select: none;
}

.lp-btn-copy-field:hover {
  background: #e2e8f0;
  color: #1e293b;
  border-color: #94a3b8;
}

.lp-btn-insert-field {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.lp-btn-insert-field:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e40af;
}

.lp-btn-copy-field.copied,
.lp-btn-insert-field.inserted {
  background: #ecfdf5 !important;
  color: #059669 !important;
  border-color: #a7f3d0 !important;
}

.lp-prev-card-content {
  font-size: 0.88rem;
  line-height: 1.5;
  color: #1e293b;
  white-space: pre-wrap;
  word-break: break-word;
  background: #f8fafc;
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  border: 1px solid #f1f5f9;
}

.lp-prev-card-content.empty {
  color: #94a3b8;
  font-style: italic;
  font-size: 0.82rem;
}

/* Field Highlight Animation when text is inserted */
@keyframes fieldInsertedPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.6);
    border-color: #2563eb;
    background-color: #eff6ff;
  }
  60% {
    box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.2);
    border-color: #2563eb;
    background-color: #eff6ff;
  }
  100% {
    box-shadow: none;
    background-color: transparent;
  }
}

.lp-field-highlighted {
  animation: fieldInsertedPulse 1.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* Special highlight for Homework card */
.lp-prev-card.homework {
  border-left: 4px solid #d97706;
  background: #fffdfa;
}

.lp-prev-card.homework .lp-prev-card-title {
  color: #b45309;
}

.lp-prev-card.homework .lp-prev-card-title i,
.lp-prev-card.homework .lp-prev-card-title svg {
  color: #d97706;
}

.lp-prev-card.homework .lp-prev-card-content {
  background: #fffbeb;
  border-color: #fef3c7;
  color: #78350f;
  font-weight: 500;
}

/* Special highlight for Speaking card */
.lp-prev-card.speaking {
  border-left: 4px solid #059669;
}

.lp-prev-card.speaking .lp-prev-card-title {
  color: #047857;
}

.lp-prev-card.speaking .lp-prev-card-title i,
.lp-prev-card.speaking .lp-prev-card-title svg {
  color: #059669;
}

/* Empty State inside Drawer */
.lp-prev-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.5rem;
  color: #64748b;
  background: #ffffff;
  border-radius: 12px;
  border: 1.5px dashed #cbd5e1;
  margin-top: 1rem;
}

.lp-prev-empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  color: #94a3b8;
}

.lp-prev-empty-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #334155;
  margin: 0 0 0.5rem 0;
}

.lp-prev-empty-desc {
  font-size: 0.86rem;
  line-height: 1.5;
  color: #64748b;
  margin: 0;
  max-width: 360px;
}

/* ==========================================================================
   PRINT / PDF EXPORT ISOLATION GUARANTEES
   Overrides side-by-side dock, slide-over drawer and floating widgets during print
   ========================================================================== */
@media print {
  .lp-drawer-panel,
  .lp-drawer-overlay,
  .chat-floating-fixed-btn,
  .chat-widget-card,
  #chat-widget,
  #chat-notification-popup {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  body.lp-previous-drawer-open .lp-main-container,
  .lp-main-container {
    margin: 0 !important;
    margin-right: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  body.lp-previous-drawer-open {
    overflow: visible !important;
  }
}
