.mcw-mobile-comparison-widget {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  background: white;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: 16px;
  box-sizing: border-box;
}

/* Desktop Layout */
@media (min-width: 768px) {
  .mcw-mobile-comparison-widget {
    max-width: 1200px;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    background: #f8f9fa;
  }
}

/* Tab Navigation Container */
.mcw-tabs {
  display: flex;
  gap: 6px;
  padding: 6px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  background: #f1f3f4;
  border-radius: 12px;
  box-sizing: border-box;
  width: 100%;
}

/* Desktop Tab Layout - Two Rows */
@media (min-width: 768px) {
  .mcw-tabs {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 8px;
    padding: 12px;
    margin-bottom: 32px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  }
}

/* Large Desktop - More columns */
@media (min-width: 1024px) {
  .mcw-tabs {
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(2, 1fr);
  }
}

.mcw-tab {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #ffffff;
  color: #6b7280;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
}

/* Desktop Tab Styling */
@media (min-width: 768px) {
  .mcw-tab {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
  }
}

.mcw-tab:hover {
  background: #e5e7eb;
  transform: translateY(-1px);
}

@media (min-width: 768px) {
  .mcw-tab:hover {
    background: #e9ecef;
    border-color: #dee2e6;
  }
}

.mcw-tab.mcw-active {
  background: #10b981;
  color: white;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
  transform: translateY(-1px);
}

/* Desktop Active Tab */
@media (min-width: 768px) {
  .mcw-tab.mcw-active {
    background: #10b981;
    border-color: #10b981;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
  }
}

/* Tab Content */
.mcw-tab-content {
  display: none;
  width: 100%;
}

.mcw-tab-content.mcw-active {
  display: block;
}

/* Smooth transitions for tab switching */
.mcw-tab-content {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mcw-tab-content.mcw-active {
  opacity: 1;
}

/* Comparison Card - Match tabs container width */
.mcw-comparison-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
  width: 100%;
  box-sizing: border-box;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Desktop Comparison Card */
@media (min-width: 768px) {
  .mcw-comparison-card {
    padding: 32px;
    margin-bottom: 24px;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  }
}

/* Brand Headers */
.mcw-brand-headers {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  padding: 0 8px;
}

/* Desktop Brand Headers */
@media (min-width: 768px) {
  .mcw-brand-headers {
    justify-content: center;
    gap: 80px;
    margin-bottom: 40px;
    padding: 0;
  }
}

.mcw-brand-left,
.mcw-brand-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Desktop Brand Sections */
@media (min-width: 768px) {
  .mcw-brand-left,
  .mcw-brand-right {
    gap: 16px;
  }
}

.mcw-brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Desktop Brand Logo */
@media (min-width: 768px) {
  .mcw-brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 8px;
  }
}

.mcw-left-logo {
  background: #111827;
}

.mcw-right-logo {
  background: #10b981;
}

.mcw-brand-logo span {
  color: white;
  font-size: 12px;
  font-weight: bold;
}

/* Desktop Brand Logo Text */
@media (min-width: 768px) {
  .mcw-brand-logo span {
    font-size: 16px;
  }
}

.mcw-brand-name {
  font-weight: 600;
  color: #111827;
  font-size: 14px;
}

/* Desktop Brand Name */
@media (min-width: 768px) {
  .mcw-brand-name {
    font-size: 18px;
  }
}

.mcw-vs {
  color: #9ca3af;
  font-size: 14px;
  font-weight: 500;
}

/* Desktop VS */
@media (min-width: 768px) {
  .mcw-vs {
    font-size: 16px;
    font-weight: 600;
  }
}

/* Metrics Container */
.mcw-metrics {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

/* Desktop Metrics */
@media (min-width: 768px) {
  .mcw-metrics {
    gap: 24px;
  }
}

.mcw-metric {
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* Desktop Metric Layout */
@media (min-width: 768px) {
  .mcw-metric {
    display: grid;
    grid-template-columns: 180px 1fr;
    align-items: center;
    gap: 24px;
  }
}

.mcw-metric-name {
  font-size: 14px;
  font-weight: 500;
  color: #111827;
  margin-bottom: 12px;
  text-align: center;
  margin: 0 0 12px 0;
}

/* Desktop Metric Name */
@media (min-width: 768px) {
  .mcw-metric-name {
    font-size: 15px;
    text-align: left;
    margin: 0;
    font-weight: 600;
  }
}

.mcw-progress-bars {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
}

/* Desktop Progress Bars */
@media (min-width: 768px) {
  .mcw-progress-bars {
    gap: 16px;
  }
}

.mcw-progress-container {
  flex: 1;
  min-width: 0;
}

.mcw-progress-bar {
  height: 32px;
  background: #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  width: 100%;
}

/* Desktop Progress Bar */
@media (min-width: 768px) {
  .mcw-progress-bar {
    height: 36px;
    border-radius: 10px;
  }
}

.mcw-progress-fill {
  height: 100%;
  border-radius: 8px;
  transition: width 0.6s ease-out;
  position: relative;
  min-width: 40px; /* Ensure minimum width for percentage display */
}

/* Desktop Progress Fill */
@media (min-width: 768px) {
  .mcw-progress-fill {
    border-radius: 10px;
    min-width: 50px;
  }
}

/* IMPORTANT: Hide percentage text below bars completely */
.mcw-percentage {
  display: none !important;
}

/* Progress Bar Percentage Inside - Mobile & Desktop */
.mcw-progress-fill::after {
  content: attr(data-percentage);
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--percentage-text-color, #ffffff);
  font-size: 11px;
  font-weight: 600;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  z-index: 10;
  pointer-events: none;
}

/* Desktop Progress Bar Percentage Inside */
@media (min-width: 768px) {
  .mcw-progress-fill::after {
    font-size: 13px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  }
}

/* Left Position */
.mcw-mobile-comparison-widget[data-percentage-position="left"] .mcw-progress-fill::after {
  left: 8px;
  right: auto;
}

@media (min-width: 768px) {
  .mcw-mobile-comparison-widget[data-percentage-position="left"] .mcw-progress-fill::after {
    left: 12px;
  }
}

/* Center Position */
.mcw-mobile-comparison-widget[data-percentage-position="center"] .mcw-progress-fill::after {
  left: 50%;
  right: auto;
  transform: translate(-50%, -50%);
}

/* Right Position (Default) */
.mcw-mobile-comparison-widget[data-percentage-position="right"] .mcw-progress-fill::after {
  right: 8px;
  left: auto;
}

@media (min-width: 768px) {
  .mcw-mobile-comparison-widget[data-percentage-position="right"] .mcw-progress-fill::after {
    right: 12px;
  }
}

/* Fallback for when no position is set - default to right */
.mcw-mobile-comparison-widget:not([data-percentage-position]) .mcw-progress-fill::after,
.mcw-mobile-comparison-widget[data-percentage-position=""] .mcw-progress-fill::after {
  right: 8px;
  left: auto;
}

@media (min-width: 768px) {
  .mcw-mobile-comparison-widget:not([data-percentage-position]) .mcw-progress-fill::after,
  .mcw-mobile-comparison-widget[data-percentage-position=""] .mcw-progress-fill::after {
    right: 12px;
  }
}

/* Footer - Match container width */
.mcw-footer {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  background: #f8f9fa;
  border-radius: 12px;
  width: 100%;
  box-sizing: border-box;
  margin-top: 8px;
}

/* Desktop Footer */
@media (min-width: 768px) {
  .mcw-footer {
    padding: 20px 32px;
    border-radius: 16px;
    justify-content: center;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  }
}

.mcw-search-icon {
  width: 16px;
  height: 16px;
  color: #9ca3af;
  margin-top: 2px;
  flex-shrink: 0;
}

/* Desktop Search Icon */
@media (min-width: 768px) {
  .mcw-search-icon {
    width: 18px;
    height: 18px;
  }
}

.mcw-footer p {
  font-size: 12px;
  color: #6b7280;
  line-height: 1.5;
  margin: 0;
  font-weight: 500;
}

/* Desktop Footer Text */
@media (min-width: 768px) {
  .mcw-footer p {
    font-size: 14px;
    text-align: center;
  }
}

/* Mobile Responsive - Extra Small Screens */
@media (max-width: 480px) {
  .mcw-mobile-comparison-widget {
    padding: 12px;
  }

  .mcw-tabs {
    gap: 4px;
    padding: 4px;
  }

  .mcw-tab {
    padding: 6px 8px;
    font-size: 12px;
    min-height: 36px;
  }

  .mcw-comparison-card {
    padding: 16px;
  }

  .mcw-brand-headers {
    margin-bottom: 24px;
    padding: 0 4px;
  }

  .mcw-metrics {
    gap: 16px;
  }

  .mcw-progress-bar {
    height: 28px;
  }

  .mcw-progress-fill::after {
    font-size: 10px;
  }
}

/* Prevent horizontal overflow */
* {
  box-sizing: border-box;
}

.mcw-mobile-comparison-widget * {
  max-width: 100%;
}
