/* CSS cho Tiện ích Soạn Kế Hoạch Bài Dạy Chuẩn Công Văn 5512/BGDĐT - TCT.VN */
:root {
  --primary-color: #1e3a8a;
  --primary-hover: #172554;
  --secondary-color: #0d9488;
  --accent-color: #2563eb;
  --bg-color: #f1f5f9;
  --card-bg: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-color: #cbd5e1;
  --border-light: #e2e8f0;
  --word-blue: #185abd;
  --word-hover: #103f84;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.05);
}

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

body {
  font-family: 'Be Vietnam Pro', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header Styles */
.app-header {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  color: #334155;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 0.85rem;
  border-radius: 6px;
  transition: all 0.2s;
}

.btn-back:hover {
  background-color: #e2e8f0;
  color: #0f172a;
  transform: translateX(-2px);
}

.header-icon {
  background: #eff6ff;
  color: var(--accent-color);
  border-radius: 8px;
  padding: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-header h1 {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.3;
}

.subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-sample {
  background-color: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}
.btn-sample:hover {
  background-color: #d1fae5;
}

.btn-backup {
  background-color: #f0fdf4;
  color: #166534;
  border-color: #bbf7d0;
}
.btn-backup:hover {
  background-color: #dcfce7;
}

.btn-restore {
  background-color: #fefce8;
  color: #854d0e;
  border-color: #fef08a;
}
.btn-restore:hover {
  background-color: #fef9c3;
}

.btn-word {
  background-color: var(--word-blue);
  color: #ffffff;
}
.btn-word:hover {
  background-color: var(--word-hover);
}

.btn-primary {
  background-color: var(--primary-color);
  color: #ffffff;
}
.btn-primary:hover {
  background-color: var(--primary-hover);
}

/* Dropdown Menu */
.dropdown-group {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.4rem;
  background-color: #ffffff;
  min-width: 280px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  z-index: 1100;
  overflow: hidden;
}

.dropdown-menu.show {
  display: block;
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 0.65rem 1rem;
  text-align: left;
  border: none;
  background: none;
  font-size: 0.85rem;
  color: var(--text-main);
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.dropdown-item:hover {
  background-color: #f1f5f9;
  color: var(--accent-color);
}

.dropdown-item:not(:last-child) {
  border-bottom: 1px solid var(--border-light);
}

/* App Body Layout */
.app-body {
  display: flex;
  flex: 1;
  max-width: 1560px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
  gap: 1.5rem;
}

/* Sidebar Nav */
.editor-nav {
  width: 280px;
  flex-shrink: 0;
  position: sticky;
  top: 5rem;
  height: calc(100vh - 6.5rem);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.nav-title {
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding-left: 0.5rem;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.85rem;
  color: #475569;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 6px;
  transition: all 0.2s;
  background: #ffffff;
  border: 1px solid var(--border-light);
}

.nav-item:hover {
  color: var(--accent-color);
  background-color: #eff6ff;
  border-color: #bfdbfe;
}

.nav-item.active {
  background-color: #dbeafe;
  color: var(--primary-color);
  border-color: #93c5fd;
  font-weight: 700;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: #e2e8f0;
  color: #334155;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
}

.nav-item.active .step-num {
  background: var(--primary-color);
  color: #ffffff;
}

.guideline-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 0.85rem;
  font-size: 0.78rem;
}

.guide-title {
  font-weight: 700;
  color: #92400e;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.guide-list {
  list-style: none;
  color: #78350f;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.autosave-status {
  margin-top: auto;
  font-size: 0.75rem;
  color: #166534;
  background: #dcfce7;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}

/* Document Editor Content */
.editor-content-wrapper {
  flex: 1;
  display: flex;
  justify-content: center;
}

.lesson-document {
  width: 100%;
  max-width: 960px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 3rem 3.5rem;
  box-shadow: var(--shadow-md);
  font-family: 'Times New Roman', Times, serif;
  color: #000000;
  font-size: 13pt;
  line-height: 1.45;
}

/* Doc Elements */
.doc-section {
  margin-bottom: 2rem;
}

.header-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
  font-size: 12pt;
}

.form-group-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.form-group-inline label {
  white-space: nowrap;
  font-weight: bold;
}

.doc-input {
  width: 100%;
  border: none;
  border-bottom: 1px dashed #94a3b8;
  padding: 0.2rem 0.35rem;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: transparent;
  transition: all 0.2s;
}

.doc-input:focus {
  outline: none;
  border-bottom: 2px solid var(--accent-color);
  background: #f8fafc;
}

.doc-input.bold-input {
  font-weight: bold;
}

.doc-input.uppercase {
  text-transform: uppercase;
}

.doc-input.short-input {
  max-width: 90px;
}

.doc-input.text-center {
  text-align: center;
}

.lesson-main-title-block {
  text-align: center;
  margin-bottom: 2rem;
  border-bottom: 2px solid #000;
  padding-bottom: 1.25rem;
}

.main-title-text {
  font-size: 16pt;
  font-weight: bold;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

.sub-title-row {
  display: flex;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.sub-title-row .form-group-inline {
  width: 90%;
  justify-content: center;
}

.sub-title-row input {
  font-size: 14pt;
  text-align: center;
}

.sub-meta-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-style: italic;
  font-size: 12pt;
}

.sub-meta-row .form-group-inline label {
  font-weight: normal;
}

.section-heading {
  font-size: 13pt;
  font-weight: bold;
  text-transform: uppercase;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  color: #000000;
}

.sub-heading {
  font-size: 13pt;
  font-weight: bold;
  margin-top: 0.6rem;
  margin-bottom: 0.35rem;
}

.doc-textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  font-family: inherit;
  font-size: inherit;
  line-height: 1.45;
  color: inherit;
  background-color: #fafbfc;
  resize: vertical;
  transition: all 0.2s;
  margin-bottom: 0.75rem;
}

.doc-textarea:focus {
  outline: none;
  border-color: var(--accent-color);
  background-color: #ffffff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.competence-block {
  padding-left: 1.25rem;
}

.comp-title {
  font-weight: bold;
  font-style: italic;
  margin-bottom: 0.25rem;
}

.equipment-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

/* Activity Card */
.activity-card {
  margin-top: 1.25rem;
  margin-bottom: 1.5rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 1.25rem;
  background: #fdfdfe;
}

.activity-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  border-bottom: 1px dashed #cbd5e1;
  padding-bottom: 0.65rem;
}

.act-badge {
  background: #1e3a8a;
  color: #ffffff;
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.2rem 0.65rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.act-name-input-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.act-name-input-group input {
  font-size: 13pt;
}

.act-time-wrap {
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.time-input {
  max-width: 110px;
  text-align: center;
}

.act-field {
  margin-bottom: 0.75rem;
}

.field-label {
  display: block;
  font-weight: bold;
  margin-bottom: 0.25rem;
}

.table-steps-wrapper {
  overflow-x: auto;
  margin-top: 0.5rem;
}

.table-steps {
  width: 100%;
  border-collapse: collapse;
  font-size: 13pt;
}

.table-steps th, .table-steps td {
  border: 1px solid #000000;
  padding: 0.5rem 0.65rem;
  vertical-align: top;
}

.table-steps th {
  background-color: #f1f5f9;
  font-weight: bold;
  text-align: center;
}

.table-steps td strong {
  display: block;
  margin-bottom: 0.25rem;
}

.step-area {
  margin-bottom: 0;
  background-color: #ffffff;
}

/* Signatures */
.signature-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
}

.sign-box {
  text-align: center;
}

.sign-title {
  font-weight: bold;
  font-size: 12pt;
}

.sign-sub {
  font-style: italic;
  font-size: 11pt;
  margin-bottom: 0.5rem;
}

.sign-date-row {
  font-size: 12pt;
  margin-bottom: 0.4rem;
}

.sign-space {
  height: 70px;
}

.sign-box input {
  width: 70%;
  margin: 0 auto;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background-color: #1e293b;
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s;
  pointer-events: none;
  z-index: 2000;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* PRINT STYLES (A4) */
@media print {
  body {
    background-color: #ffffff !important;
    color: #000000 !important;
  }

  .no-print {
    display: none !important;
  }

  .app-body {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
  }

  .editor-content-wrapper {
    display: block !important;
  }

  .lesson-document {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    font-size: 13pt !important;
  }

  .doc-input, .doc-textarea {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    resize: none !important;
    overflow: visible !important;
  }

  .activity-card {
    border: none !important;
    padding: 0 !important;
    margin-top: 1rem !important;
    background: transparent !important;
    page-break-inside: avoid;
  }

  .act-badge {
    background: transparent !important;
    color: #000000 !important;
    padding: 0 !important;
    font-weight: bold !important;
  }

  .table-steps th, .table-steps td {
    border: 1px solid #000000 !important;
  }

  @page {
    size: A4 portrait;
    margin: 20mm 15mm 20mm 20mm; /* Căn lề chuẩn văn bản giáo án */
  }
}

/* Responsive */
@media (max-width: 1024px) {
  .app-body {
    flex-direction: column;
  }
  .editor-nav {
    display: none; /* Hide sidebar nav on smaller screens */
  }
  .lesson-document {
    padding: 1.5rem;
  }
}

@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .header-actions {
    flex-wrap: wrap;
    width: 100%;
  }
  .header-info-grid, .equipment-grid, .signature-section {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}
