/* Tutorial Post Styles */
/* filepath: static/css/pages/tutorial.css */

/* ===== TUTORIAL VARIABLES ===== */
:root {
  --tutorial-reading-progress-height: 4px;
  --tutorial-sidebar-width: 300px;
  --tutorial-content-max-width: 800px;
  --tutorial-code-bg: #f8f9fa;
  --tutorial-highlight-color: var(--bs-warning);
}

/* ===== READING PROGRESS ===== */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--tutorial-reading-progress-height);
  background: rgba(var(--bs-gray-300-rgb), 0.3);
  z-index: 1040;
}

.reading-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--bs-primary), var(--bs-secondary));
  width: 0%;
  transition: width 0.2s ease;
}

/* ===== TUTORIAL HEADER ===== */
.tutorial-header {
  border-bottom: 1px solid rgba(var(--bs-gray-300-rgb), 0.2);
  padding-bottom: 2rem;
  margin-bottom: 2rem;
}

.tutorial-header h1 {
  color: var(--bs-gray-900);
  line-height: 1.2;
  margin-bottom: 1.5rem;
}

.tutorial-meta {
  background: rgba(var(--bs-light-rgb), 0.5);
  border-radius: 12px;
  padding: 1rem;
  border: 1px solid rgba(var(--bs-gray-300-rgb), 0.2);
}

.tutorial-meta .badge {
  font-size: 0.8rem;
  padding: 0.375rem 0.75rem;
  border-radius: 6px;
}

.tutorial-meta small {
  display: inline-flex;
  align-items: center;
  margin-right: 1rem;
  color: var(--bs-gray-600);
}

.tutorial-meta small i {
  margin-right: 0.25rem;
  color: var(--bs-gray-500);
}

.tutorial-keywords {
  margin: 1rem 0;
}

.tutorial-keywords .badge {
  background: rgba(var(--bs-primary-rgb), 0.1);
  color: var(--bs-primary);
  border: 1px solid rgba(var(--bs-primary-rgb), 0.2);
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

/* ===== SOCIAL SHARE ===== */
.social-share {
  background: rgba(var(--bs-light-rgb), 0.5);
  border-radius: 12px;
  padding: 1rem;
  border: 1px solid rgba(var(--bs-gray-300-rgb), 0.2);
  margin: 1rem 0;
}

.social-share-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.social-share-btn {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.social-share-btn:hover {
  transform: translateY(-1px);
}

.social-share-btn.twitter {
  background: #1da1f2;
  color: white;
}

.social-share-btn.linkedin {
  background: #0077b5;
  color: white;
}

.social-share-btn.copy {
  background: rgba(var(--bs-gray-500-rgb), 0.1);
  color: var(--bs-gray-700);
  border-color: rgba(var(--bs-gray-400-rgb), 0.3);
}

.social-share-btn.copy:hover {
  background: rgba(var(--bs-gray-500-rgb), 0.2);
  color: var(--bs-gray-800);
}

/* ===== RELATED TOOL WIDGET ===== */
.related-tool-widget {
  background: linear-gradient(135deg,
    rgba(var(--bs-success-rgb), 0.1) 0%,
    rgba(var(--bs-info-rgb), 0.05) 100%);
  border-radius: 12px;
  padding: 1.5rem;
  border: 1px solid rgba(var(--bs-success-rgb), 0.2);
  margin: 2rem 0;
}

.related-tool-widget h5 {
  color: var(--bs-success);
  margin-bottom: 1rem;
}

.tool-link-card {
  background: white;
  border-radius: 8px;
  padding: 1rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.2s ease;
  border: 1px solid rgba(var(--bs-success-rgb), 0.1);
}

.tool-link-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(var(--bs-success-rgb), 0.2);
  color: inherit;
  text-decoration: none;
}

.tool-icon {
  width: 48px;
  height: 48px;
  background: var(--bs-success);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.25rem;
}

.tool-info h6 {
  margin: 0 0 0.25rem 0;
  color: var(--bs-gray-900);
}

.tool-info small {
  color: var(--bs-gray-600);
}

/* ===== TUTORIAL CONTENT ===== */
.tutorial-content {
  max-width: var(--tutorial-content-max-width);
  line-height: 1.7;
  font-size: 1.05rem;
  color: var(--bs-gray-800);
}

.tutorial-content h2,
.tutorial-content h3,
.tutorial-content h4 {
  color: var(--bs-gray-900);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  font-weight: 600;
  scroll-margin-top: 80px; /* Para navegación con anclas */
}

.tutorial-content h2 {
  font-size: 1.75rem;
  border-bottom: 2px solid rgba(var(--bs-primary-rgb), 0.1);
  padding-bottom: 0.5rem;
}

.tutorial-content h3 {
  font-size: 1.5rem;
  color: var(--bs-primary);
}

.tutorial-content h4 {
  font-size: 1.25rem;
}

.tutorial-content p {
  margin-bottom: 1.2rem;
}

.tutorial-content strong {
  color: var(--bs-gray-900);
  font-weight: 600;
}

.tutorial-content em {
  color: var(--bs-primary);
  font-style: normal;
  font-weight: 500;
}

/* ===== CODE BLOCKS ===== */
.tutorial-content pre {
  background: var(--tutorial-code-bg);
  border-radius: 8px;
  padding: 1.5rem;
  overflow-x: auto;
  border: 1px solid rgba(var(--bs-gray-300-rgb), 0.3);
  margin: 1.5rem 0;
}

.tutorial-content code {
  background: rgba(var(--bs-gray-200-rgb), 0.8);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9em;
  color: var(--bs-gray-800);
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
}

.tutorial-content pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  color: var(--bs-gray-700);
}

/* ===== LISTS ===== */
.tutorial-content ul,
.tutorial-content ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

.tutorial-content li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.tutorial-content ul li {
  list-style-type: none;
  position: relative;
}

.tutorial-content ul li::before {
  content: '→';
  color: var(--bs-primary);
  position: absolute;
  left: -1.2rem;
  font-weight: bold;
}

/* ===== BLOCKQUOTES ===== */
.tutorial-content blockquote {
  border-left: 4px solid var(--bs-primary);
  background: rgba(var(--bs-primary-rgb), 0.05);
  margin: 1.5rem 0;
  padding: 1rem 1.5rem;
  border-radius: 0 8px 8px 0;
  font-style: italic;
}

.tutorial-content blockquote p:last-child {
  margin-bottom: 0;
}

/* ===== TABLES ===== */
.tutorial-content table {
  width: 100%;
  margin: 1.5rem 0;
  border-collapse: collapse;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tutorial-content th,
.tutorial-content td {
  padding: 0.875rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(var(--bs-gray-300-rgb), 0.3);
}

.tutorial-content th {
  background: var(--bs-primary);
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tutorial-content tr:nth-child(even) {
  background: rgba(var(--bs-gray-100-rgb), 0.5);
}

.tutorial-content tr:hover {
  background: rgba(var(--bs-primary-rgb), 0.05);
}

/* ===== TUTORIAL SIDEBAR ===== */
.tutorial-sidebar {
  width: var(--tutorial-sidebar-width);
}

.toc-card,
.related-tutorials-card {
  background: white;
  border-radius: 12px;
  border: 1px solid rgba(var(--bs-gray-300-rgb), 0.2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

.toc-card .card-header,
.related-tutorials-card .card-header {
  background: rgba(var(--bs-primary-rgb), 0.05);
  border-bottom: 1px solid rgba(var(--bs-gray-300-rgb), 0.2);
  padding: 1rem 1.5rem;
}

.toc-card h5,
.related-tutorials-card h5 {
  margin: 0;
  color: var(--bs-primary);
  font-weight: 600;
  font-size: 1rem;
}

.toc-content {
  padding: 1rem 1.5rem;
  max-height: 400px;
  overflow-y: auto;
}

.toc-link {
  display: block;
  color: var(--bs-gray-700);
  font-size: 0.9rem;
  line-height: 1.5;
  padding: 0.25rem 0;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.toc-link:hover {
  color: var(--bs-primary);
  background: rgba(var(--bs-primary-rgb), 0.05);
  padding-left: 0.5rem;
  text-decoration: none;
}

.toc-link.active {
  color: var(--bs-primary);
  font-weight: 600;
  background: rgba(var(--bs-primary-rgb), 0.1);
  padding-left: 0.5rem;
}

/* ===== RELATED TUTORIALS ===== */
.related-tutorial-item {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(var(--bs-gray-300-rgb), 0.1);
  transition: all 0.2s ease;
}

.related-tutorial-item:last-child {
  border-bottom: none;
}

.related-tutorial-item:hover {
  background: rgba(var(--bs-primary-rgb), 0.03);
}

.related-tutorial-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.related-tutorial-link:hover {
  color: inherit;
  text-decoration: none;
}

.related-tutorial-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--bs-gray-900);
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

.related-tutorial-meta {
  font-size: 0.8rem;
  color: var(--bs-gray-600);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ===== TUTORIAL FOOTER ===== */
.tutorial-footer {
  background: rgba(var(--bs-light-rgb), 0.5);
  border-radius: 12px;
  padding: 2rem;
  border: 1px solid rgba(var(--bs-gray-300-rgb), 0.2);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1199.98px) {
  .tutorial-sidebar {
    width: 100%;
    margin-top: 2rem;
  }

  .tutorial-sidebar .sticky-top {
    position: static !important;
  }
}

@media (max-width: 768px) {
  .tutorial-content {
    font-size: 1rem;
  }

  .tutorial-content h2 {
    font-size: 1.5rem;
    margin-top: 2rem;
  }

  .tutorial-content h3 {
    font-size: 1.3rem;
  }

  .tutorial-content h4 {
    font-size: 1.1rem;
  }

  .tutorial-meta {
    padding: 0.75rem;
  }

  .tutorial-meta .row {
    gap: 0.5rem;
  }

  .social-share {
    padding: 0.75rem;
  }

  .social-share-buttons {
    gap: 0.25rem;
  }

  .social-share-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
  }

  .related-tool-widget {
    padding: 1rem;
  }

  .tool-link-card {
    padding: 0.75rem;
    flex-direction: column;
    text-align: center;
    gap: 0.75rem;
  }

  .tutorial-content pre {
    padding: 1rem;
    font-size: 0.8rem;
  }

  .tutorial-content table {
    font-size: 0.85rem;
  }

  .tutorial-content th,
  .tutorial-content td {
    padding: 0.5rem 0.75rem;
  }
}

@media (max-width: 576px) {
  .tutorial-header h1 {
    font-size: 1.75rem;
  }

  .tutorial-content ul,
  .tutorial-content ol {
    padding-left: 1rem;
  }

  .tutorial-content ul li::before {
    left: -0.8rem;
  }
}

/* ===== DARK MODE ===== */
[data-bs-theme="dark"] .tutorial-content {
  color: var(--bs-gray-300);
}

[data-bs-theme="dark"] .tutorial-content h2,
[data-bs-theme="dark"] .tutorial-content h3,
[data-bs-theme="dark"] .tutorial-content h4 {
  color: var(--bs-gray-100);
}

[data-bs-theme="dark"] .tutorial-content h2 {
  border-bottom-color: rgba(var(--bs-primary-rgb), 0.3);
}

[data-bs-theme="dark"] .tutorial-content strong {
  color: var(--bs-gray-100);
}

[data-bs-theme="dark"] .tutorial-content pre {
  background: rgba(var(--bs-gray-800-rgb), 0.8);
  border-color: rgba(var(--bs-gray-600-rgb), 0.3);
}

[data-bs-theme="dark"] .tutorial-content code {
  background: rgba(var(--bs-gray-700-rgb), 0.8);
  color: var(--bs-gray-200);
}

[data-bs-theme="dark"] .tutorial-content blockquote {
  background: rgba(var(--bs-primary-rgb), 0.1);
  border-left-color: var(--bs-primary);
}

[data-bs-theme="dark"] .tutorial-content table {
  background: rgba(var(--bs-gray-800-rgb), 0.5);
}

[data-bs-theme="dark"] .tutorial-content th {
  background: var(--bs-primary);
}

[data-bs-theme="dark"] .tutorial-content tr:nth-child(even) {
  background: rgba(var(--bs-gray-700-rgb), 0.3);
}

[data-bs-theme="dark"] .tutorial-content tr:hover {
  background: rgba(var(--bs-primary-rgb), 0.1);
}

[data-bs-theme="dark"] .toc-card,
[data-bs-theme="dark"] .related-tutorials-card {
  background: rgba(var(--bs-gray-800-rgb), 0.8);
  border-color: rgba(var(--bs-gray-600-rgb), 0.3);
}

[data-bs-theme="dark"] .toc-card .card-header,
[data-bs-theme="dark"] .related-tutorials-card .card-header {
  background: rgba(var(--bs-primary-rgb), 0.1);
  border-bottom-color: rgba(var(--bs-gray-600-rgb), 0.3);
}

[data-bs-theme="dark"] .tutorial-footer {
  background: rgba(var(--bs-gray-800-rgb), 0.5);
  border-color: rgba(var(--bs-gray-600-rgb), 0.3);
}

/* ===== PRINT STYLES ===== */
@media print {
  .reading-progress,
  .tutorial-sidebar,
  .social-share,
  .related-tool-widget,
  .tutorial-footer {
    display: none;
  }

  .tutorial-content {
    max-width: none;
    font-size: 12pt;
    line-height: 1.5;
  }

  .tutorial-content h2,
  .tutorial-content h3,
  .tutorial-content h4 {
    break-after: avoid;
    margin-top: 1.5rem;
  }

  .tutorial-content pre {
    background: #f5f5f5;
    border: 1px solid #ddd;
    break-inside: avoid;
    font-size: 10pt;
  }

  .tutorial-content table {
    break-inside: avoid;
    font-size: 10pt;
  }
}
