/* 自定义样式 - 基于 Bootstrap 5.3.8 */

/* 全局样式 */
body {
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Header Styles */
.header {
  text-align: center;
  margin-bottom: 40px;
  padding: 40px 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 15px;
  color: white;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.header__title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 10px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.header__subtitle {
  font-size: 1.2rem;
  opacity: 0.9;
}

/* Background Section */
.background {
  margin-bottom: 50px;
}

.background__content {
  background: white;
  padding: 30px;
  border-radius: 15px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.background__title {
  font-size: 1.8rem;
  margin-bottom: 20px;
  color: #2c3e50;
}

.background__text {
  margin-bottom: 15px;
  font-size: 1.1rem;
  color: #555;
}

/* Scenario Section */
.scenario {
  margin-bottom: 50px;
}

.scenario__title {
  font-size: 2rem;
  text-align: center;
  margin-bottom: 20px;
  color: #2c3e50;
}

.scenario__description {
  text-align: center;
  margin-bottom: 40px;
  font-size: 1.1rem;
  color: #666;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

/* Comparison Grid */
.comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 30px;
  margin-bottom: 40px;
}

.comparison-card {
  background: white;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.comparison-card:hover {
  transform: translateY(-5px);
}

.comparison-card__title {
  padding: 20px;
  font-size: 1.3rem;
  font-weight: 600;
  color: white;
}

.comparison-card__title--bem {
  background: linear-gradient(135deg, #ff6b6b, #ee5a24);
}

.comparison-card__title--data {
  background: linear-gradient(135deg, #4834d4, #686de0);
}

.comparison-card__example {
  padding: 20px;
  text-align: center;
}

.comparison-card__example button {
  position: relative;
  display: inline-block;
}

.comparison-card__code {
  position: relative;
}

.comparison-card__code pre {
  margin: 0;
  padding: 20px;
  background: #2d3748;
  color: #e2e8f0;
  font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
  line-height: 1.5;
  font-size: 0.9rem;
  overflow-x: auto;
}

/* CSS Comparison */
.css-comparison {
  background: white;
  padding: 30px;
  border-radius: 15px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  margin-bottom: 40px;
}

.css-comparison__title {
  font-size: 1.5rem;
  margin-bottom: 20px;
  color: #2c3e50;
  text-align: center;
}

.css-examples {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.css-example h5 {
  color: #2c3e50;
  margin-bottom: 10px;
  font-size: 1.1rem;
}

.css-example pre {
  margin: 0;
  padding: 15px;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  overflow-x: auto;
}

/* Interactive Demo */
.interactive-demo {
  margin-bottom: 50px;
}

.interactive-demo__title {
  font-size: 2rem;
  text-align: center;
  margin-bottom: 30px;
  color: #2c3e50;
}

.demo-controls {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 30px;
}

.demo-toggle {
  padding: 12px 24px;
  border: 2px solid #667eea;
  background: white;
  color: #667eea;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}

.demo-toggle:hover {
  background: #667eea;
  color: white;
  transform: translateY(-2px);
}

.demo-toggle.active {
  background: #667eea;
  color: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.demo-content {
  display: none;
  background: white;
  padding: 30px;
  border-radius: 15px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.demo-content.active {
  display: block;
}

.demo-description {
  margin-top: 20px;
  color: #666;
  font-style: italic;
}

/* Accordion Styles */
.accordion-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
  max-width: 300px;
  margin: 0 auto 20px;
}

.demo-accordion-item {
  padding: 15px 20px;
  background: #f8f9fa;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  position: relative;
  transition: all 0.3s ease;
  cursor: pointer;
  display: inline-block;
  margin: 10px;
}

.demo-accordion-item:hover {
  background: #e9ecef;
  transform: translateX(5px);
}

/* BEM Accordion Icons */
.demo-accordion-item--icon-down::after {
  content: "↓";
  margin-left: 10px;
  transform: translateY(-50%);
  font-size: 1.2rem;
  color: #007bff;
}

.demo-accordion-item--icon-right::after {
  content: "→";
  margin-left: 10px;
  transform: translateY(-50%);
  font-size: 1.2rem;
  color: #28a745;
}

.demo-accordion-item--icon-plus::after {
  content: "+";
  margin-left: 10px;
  transform: translateY(-50%);
  font-size: 1.2rem;
  color: #dc3545;
}

/* Data Attributes Accordion Icons */
.demo-accordion-item[data-icon="down-arrow"]::after {
  content: "↓";
  margin-left: 10px;
  transform: translateY(-50%);
  font-size: 1.2rem;
  color: #007bff;
}

.demo-accordion-item[data-icon="right-arrow"]::after {
  content: "→";
  margin-left: 10px;
  transform: translateY(-50%);
  font-size: 1.2rem;
  color: #28a745;
}

.demo-accordion-item[data-icon="plus"]::after {
  content: "+";
  margin-left: 10px;
  transform: translateY(-50%);
  font-size: 1.2rem;
  color: #dc3545;
}

/* Badge Selector */
.badge-selector {
  background: white;
  padding: 30px;
  border-radius: 15px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  margin-bottom: 40px;
}

.badge-selector__title {
  font-size: 1.5rem;
  margin-bottom: 20px;
  color: #2c3e50;
  text-align: center;
}

.badge-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  align-items: center;
}

.badge-controls label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-weight: 500;
  color: #2c3e50;
}

.badge-controls select,
.badge-controls input {
  padding: 8px 12px;
  border: 2px solid #e9ecef;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: border-color 0.3s ease;
}

.badge-controls select:focus,
.badge-controls input:focus {
  outline: none;
  border-color: #667eea;
}

/* Badge Demo */
.badge-demo {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}

.product-item {
  position: relative;
  padding: 15px 25px;
  background: #f8f9fa;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1rem;
}

.product-item:hover {
  background: #e9ecef;
  transform: translateY(-2px);
}

/* BEM Badge Styles */
.c-txt {
  position: relative;
  padding: 15px 25px;
  background: #f8f9fa;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1rem;
}

.c-txt::after {
  content: "NEW"; /* BEM方式使用固定内容，或通过JS动态设置 */
  position: absolute;
  top: -8px;
  left: -8px;
  background: #dc3545;
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: bold;
}

.c-txt--color-red::after {
  background: #dc3545;
}

.c-txt--color-blue::after {
  background: #007bff;
}

.c-txt--color-green::after {
  background: #28a745;
}

.c-txt--color-orange::after {
  background: #fd7e14;
}

.c-txt--posv-top::after {
  top: -8px;
  bottom: auto;
}

.c-txt--posv-bottom::after {
  bottom: -8px;
  top: auto;
}

.c-txt--posh-left::after {
  left: -8px;
  right: auto;
}

.c-txt--posh-right::after {
  right: -8px;
  left: auto;
}

/* 修复BEM徽章类型样式 */
.c-txt--badge::after {
  border-radius: 12px;
  padding: 4px 8px;
}

.c-txt--circle::after {
  border-radius: 50%;
  width: 20px;
  height: 20px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.c-txt--dot::after {
  width: 12px;
  height: 12px;
  padding: 0;
  border-radius: 50%;
}

.c-txt--pill::after {
  border-radius: 15px;
  padding: 4px 10px;
}

/* Data Attributes Badge Styles */
.product-item[data-text]::after {
  content: attr(data-text);
  position: absolute;
  top: -8px;
  left: -8px;
  background: #007bff;
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: bold;
  min-width: 20px;
  text-align: center;
}

/* Data attribute specific styling */
.product-item[data-text-type*="red"]::after {
  background: #dc3545;
}

.product-item[data-text-type*="orange"]::after {
  background: #fd7e14;
}

.product-item[data-text-type*="badge"]::after {
  border-radius: 12px;
  padding: 4px 8px;
}

.product-item[data-text-type*="circle"]::after {
  border-radius: 50%;
  width: 20px;
  height: 20px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-item[data-text-type*="dot"]::after {
  width: 12px;
  height: 12px;
  padding: 0;
  border-radius: 50%;
}

.product-item[data-text-type*="pill"]::after {
  border-radius: 15px;
  padding: 4px 10px;
}

.product-item[data-text-type*="top"]::after {
  top: -8px;
  bottom: auto;
}

.product-item[data-text-type*="bottom"]::after {
  bottom: -8px;
  top: auto;
}

.product-item[data-text-type*="left"]::after {
  left: -8px;
  right: auto;
}

.product-item[data-text-type*="right"]::after {
  right: -8px;
  left: auto;
}

/* Advantages Section */
.advantages {
  margin-bottom: 50px;
}

.advantages__title {
  font-size: 2rem;
  text-align: center;
  margin-bottom: 30px;
  color: #2c3e50;
}

.advantages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 25px;
}

.advantage-card {
  background: white;
  padding: 25px;
  border-radius: 15px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
  border-left: 5px solid #667eea;
}

.advantage-card:hover {
  transform: translateY(-5px);
}

.advantage-card__title {
  font-size: 1.2rem;
  margin-bottom: 10px;
  color: #2c3e50;
}

.advantage-card__text {
  color: #666;
  line-height: 1.6;
}

/* Summary Section */
.summary {
  background: white;
  padding: 40px;
  border-radius: 15px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.summary__title {
  font-size: 2rem;
  margin-bottom: 20px;
  color: #2c3e50;
  text-align: center;
}

.summary__content p {
  margin-bottom: 15px;
  font-size: 1.1rem;
  color: #555;
}

.summary__list {
  margin: 20px 0;
  padding-left: 20px;
}

.summary__list li {
  margin-bottom: 10px;
  font-size: 1rem;
  color: #555;
}

.summary__list strong {
  color: #667eea;
}

/* Copy Button for Code Blocks */
.copy-btn {
  position: absolute;
  right: 50px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 5px 10px;
  border-radius: 3px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Responsive Design */
@media (max-width: 768px) {
  .header__title {
    font-size: 2rem;
  }

  .header__subtitle {
    font-size: 1rem;
  }

  .comparison-grid {
    grid-template-columns: 1fr;
  }

  .css-examples {
    grid-template-columns: 1fr;
  }

  .demo-controls {
    flex-direction: column;
    align-items: center;
  }

  .demo-toggle {
    width: 200px;
  }

  .badge-controls {
    grid-template-columns: 1fr;
  }

  .badge-demo {
    flex-direction: column;
    align-items: center;
  }

  .product-item {
    width: 100%;
    max-width: 250px;
  }
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: fadeInUp 0.6s ease forwards;
}

/* Scroll animations */
.animated {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.animated.visible {
  opacity: 1;
  transform: translateY(0);
}
