/* ===================================
   HTML Boot Camp - Custom Styles
   =================================== */

/* --- Base Styles --- */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Noto Sans JP', sans-serif;
  line-height: 1.7;
}

/* --- Dark Mode --- */
body.dark {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

body.dark header {
  background: rgba(30, 41, 59, 0.9);
}

body.dark .bg-white {
  background-color: #1e293b !important;
}

body.dark .text-slate-800 {
  color: #f1f5f9 !important;
}

body.dark .text-slate-600 {
  color: #94a3b8 !important;
}

body.dark .text-slate-500 {
  color: #64748b !important;
}

body.dark .bg-slate-100 {
  background-color: #334155 !important;
}

body.dark .border-slate-200 {
  border-color: #334155 !important;
}

/* --- Day Cards --- */
.day-card {
  transform: translateY(0);
}

.day-card:hover {
  transform: translateY(-4px);
}

.day-card.locked {
  opacity: 0.7;
  pointer-events: none;
}

/* --- Final Card --- */
.final-card.locked {
  opacity: 0.6;
  pointer-events: none;
}

/* --- Code Blocks --- */
pre[class*="language-"],
code[class*="language-"] {
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 14px;
  line-height: 1.6;
}

/* --- Live Editor Styles --- */
.editor-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: 100%;
}

@media (min-width: 1024px) {
  .editor-container {
    flex-direction: row;
  }
}

.code-editor-wrapper {
  flex: 1;
  min-height: 300px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  background: #1e293b;
}

.code-editor-wrapper.focused {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.preview-wrapper {
  flex: 1;
  min-height: 300px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  background: white;
}

.preview-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* --- Editor Header --- */
.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #0f172a;
  border-bottom: 1px solid #334155;
}

.editor-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 500;
}

.editor-header-title i {
  color: #f97316;
}

.editor-actions {
  display: flex;
  gap: 8px;
}

.editor-actions button {
  padding: 4px 8px;
  font-size: 12px;
  color: #94a3b8;
  background: transparent;
  border: 1px solid #334155;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.editor-actions button:hover {
  background: #334155;
  color: #f1f5f9;
}

/* --- Preview Header --- */
.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.preview-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #64748b;
  font-size: 13px;
  font-weight: 500;
}

.preview-header-title i {
  color: #10b981;
}

/* --- Validation Messages --- */
.validation-messages {
  background: #1e293b;
  border-bottom: 1px solid #334155;
  padding: 0;
  max-height: 150px;
  overflow-y: auto;
}

.validation-message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  font-size: 13px;
  border-bottom: 1px solid #334155;
}

.validation-message:last-child {
  border-bottom: none;
}

.validation-message.error {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

.validation-message.error i {
  color: #ef4444;
  margin-top: 2px;
}

.validation-message.warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
}

.validation-message.warning i {
  color: #f59e0b;
  margin-top: 2px;
}

.validation-message span {
  flex: 1;
  line-height: 1.4;
}

/* --- Lesson Card Styles --- */
.lesson-card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  margin-bottom: 2rem;
}

.lesson-header {
  padding: 1.5rem;
  border-bottom: 1px solid #e2e8f0;
}

.lesson-content {
  padding: 1.5rem;
}

.lesson-footer {
  padding: 1rem 1.5rem;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

/* --- Tag Reference Table --- */
.tag-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 14px;
}

.tag-table th,
.tag-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.tag-table th {
  background: #f8fafc;
  font-weight: 600;
  color: #475569;
}

.tag-table tr:hover {
  background: #f1f5f9;
}

.tag-table code {
  background: #e0e7ff;
  color: #4338ca;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: 'Fira Code', monospace;
  font-size: 13px;
}

/* --- Info Boxes --- */
.info-box {
  padding: 1rem 1.25rem;
  border-radius: 12px;
  margin: 1rem 0;
}

.info-box.tip {
  background: #ecfdf5;
  border-left: 4px solid #10b981;
}

.info-box.warning {
  background: #fffbeb;
  border-left: 4px solid #f59e0b;
}

.info-box.note {
  background: #eff6ff;
  border-left: 4px solid #3b82f6;
}

.info-box.danger {
  background: #fef2f2;
  border-left: 4px solid #ef4444;
}

.info-box-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  margin-bottom: 4px;
}

.info-box.tip .info-box-title {
  color: #047857;
}

.info-box.warning .info-box-title {
  color: #b45309;
}

.info-box.note .info-box-title {
  color: #1d4ed8;
}

.info-box.danger .info-box-title {
  color: #b91c1c;
}

/* --- Solution Toggle --- */
.solution-toggle {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s;
}

.solution-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.solution-box {
  background: #1e293b;
  border-radius: 12px;
  overflow: hidden;
  margin-top: 1rem;
  max-height: 0;
  opacity: 0;
  transition: all 0.3s ease-out;
}

.solution-box.show {
  max-height: 2000px;
  opacity: 1;
}

.solution-box pre {
  margin: 0;
  padding: 1.5rem;
  overflow-x: auto;
}

/* --- Progress Steps --- */
.progress-steps {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 1.5rem;
}

.progress-step {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s;
}

.progress-step.completed {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
}

.progress-step.current {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: white;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.3);
}

.progress-step.upcoming {
  background: #e2e8f0;
  color: #94a3b8;
}

.progress-line {
  flex: 1;
  height: 3px;
  background: #e2e8f0;
  border-radius: 2px;
}

.progress-line.completed {
  background: linear-gradient(90deg, #10b981 0%, #6366f1 100%);
}

/* --- Navigation Buttons --- */
.nav-buttons {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 10px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s;
}

.nav-btn.prev {
  background: #f1f5f9;
  color: #475569;
}

.nav-btn.prev:hover {
  background: #e2e8f0;
}

.nav-btn.next {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: white;
}

.nav-btn.next:hover {
  transform: translateX(4px);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.nav-btn.complete {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
}

.nav-btn.complete:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}

/* --- Toast Notification --- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 16px 24px;
  background: #1e293b;
  color: white;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease-out;
  z-index: 1000;
}

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

.toast.success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.toast.error {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.toast.info {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

/* --- Confetti Animation --- */
@keyframes confetti-fall {
  0% {
    transform: translateY(-100vh) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  top: 0;
  z-index: 1000;
  animation: confetti-fall 3s linear forwards;
}

/* --- Checkbox Animation --- */
.lesson-checkbox {
  position: relative;
  width: 24px;
  height: 24px;
  cursor: pointer;
}

.lesson-checkbox input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.lesson-checkbox .checkmark {
  width: 24px;
  height: 24px;
  border: 2px solid #cbd5e1;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.lesson-checkbox input:checked + .checkmark {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-color: #10b981;
}

.lesson-checkbox .checkmark i {
  color: white;
  font-size: 12px;
  opacity: 0;
  transform: scale(0);
  transition: all 0.2s;
}

.lesson-checkbox input:checked + .checkmark i {
  opacity: 1;
  transform: scale(1);
}

/* --- CodeMirror Custom --- */
.cm-editor {
  height: 100%;
  font-size: 14px;
}

.cm-editor .cm-content {
  font-family: 'Fira Code', monospace;
}

.cm-editor .cm-line {
  padding-left: 8px;
}

/* --- Scrollbar Styling --- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* --- Mobile Adjustments --- */
@media (max-width: 640px) {
  .lesson-card {
    border-radius: 12px;
  }
  
  .code-editor-wrapper,
  .preview-wrapper {
    min-height: 250px;
  }
  
  .progress-steps {
    overflow-x: auto;
    padding-bottom: 8px;
  }
  
  .nav-buttons {
    flex-direction: column;
  }
  
  .nav-btn {
    justify-content: center;
  }
}

/* --- Print Styles --- */
@media print {
  header, footer, .nav-buttons, .solution-toggle {
    display: none;
  }
  
  .lesson-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #e2e8f0;
  }
}
