* {
  box-sizing: border-box;
}

html { background: #f8fafc; margin-top: 0px !important; }

body {
  font-size: 1rem !important;
  line-height: 1.5;
}

.hentry {
  hyphens: none !important;
}

h1 {
  letter-spacing: 0px !important;
}

/* FULL-WIDTH PAGE BEHAVIOR (theme rewrites) */
.zos-info-page-active .entry-title,
.zos-info-page-active .post-title {
  display: none !important;
}
.zos-info-page-active, .zos-info-page-active body, .zos-info-page-active #page, .zos-info-page-active #primary, .zos-info-page-active .site-content, .zos-info-page-active .entry-content, .zos-info-page-active .content-area, .zos-info-page-active .site-main,
.zos-info-page-active .elementor-section, .zos-info-page-active .elementor-container, .zos-info-page-active .elementor-widget-wrap {
    padding-top: 0 !important;
    margin-top: 0 !important;
}
.zos-info-page-active .zos-device-info-container {
  width: 100vw; max-width: 100vw; position: relative; left: 50%; right: 50%;
  margin-left: -50vw; margin-right: -50vw; border-radius: 0;
}

.zos-device-info-container {
    background: #f8fafc;
    padding: 32px 0;
}

/* HEADER SECTION */
.zos-device-header {
    background: linear-gradient(90deg, #ff6b4a 0%, #e53e3e 100%);
    color: white;
    padding: 32px;
    position: relative;
    overflow: hidden;
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
}
.zos-device-header::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: url('data:image/svg+xml,<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><circle cx="2" cy="2" r="1" fill="rgba(255,255,255,0.1)"/></svg>');
    pointer-events: none;
}
.zos-device-header h1 {
    font-weight: 600 !important; font-size: 24px !important; margin: 0 0 8px 0 !important;
    color: white !important; line-height: 1.2; text-shadow: none; position: relative; z-index: 1;
}
.zos-device-header p {
    font-size: 15px !important; opacity: 0.9 !important; color: white !important; margin: 10px !important;
    text-align: center; font-weight: 400; text-shadow: none; position: relative; z-index: 1; line-height: normal;
}

.zos-controls-bar {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 24px;
    max-width: 1200px;
    margin: 16px auto;
    padding: 16px 32px;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
}
#zos-device-search {
    justify-self: start; width: 100%; max-width: 320px; padding: 8px 16px;
    border: 1px solid #e2e8f0; border-radius: 8px; font-size: 15px; background: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); transition: all 0.2s ease;
}
#zos-device-search:focus {
    outline: none; border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
#zos-stats {
    justify-self: center; white-space: nowrap; font-size: 14px;
    font-weight: 500; color: #64748b; text-align: center;
}
#zos-latest-versions {
    justify-self: end; display: flex; align-items: center; gap: 12px;
    font-size: 14px; font-weight: 500; color: #64748b;
}

/* DEVICE LIST SECTION */
.device-list {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    border-radius: 16px;
    overflow: hidden;
}
.device-item {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    transition: background-color 0.2s ease;
}
.device-item:last-child {
    border-bottom: none;
}
.device-item:hover {
    background-color: #f8fafc;
}

/* DEVICE CARD HEADER */
.device-header {
  display: grid; grid-template-columns: 56px 1fr 40px; align-items: center;
  gap: 16px; padding: 20px 32px; cursor: pointer; user-select: none;
}
.zos-device-info-container .device-thumbnail {
  width: 56px !important; height: 56px !important; border-radius: 12px !important;
  background: #f1f5f9; border: none; font-size: 24px; padding: 0 !important;
  display: flex; align-items: center; justify-content: center;
}
.zos-device-info-container .device-thumbnail img {
  width: 100%; height: 100%; object-fit: contain;
  border-radius: 10px; padding: 4px !important;
}
.device-basic-info { display: flex; flex-direction: column; gap: 8px; }
.device-name { font-size: 18px; font-weight: 600; color: #1e293b; margin: 0; }
.device-badges {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* BADGES */
.badge {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
    text-align: center;
}
.badge-zos {
  background: linear-gradient(135deg, #e53e3e 0%, #dc2626 100%) !important;
  color: white !important; box-shadow: 0 2px 4px rgba(229, 62, 62, 0.2) !important;
}
.badge-api { background: #3b82f6; color: white; }
.badge-shape { background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }
.badge-zos-latest, .badge-api-latest {
  padding: 4px 8px; border-radius: 6px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.3px;
}
.badge-zos-latest {
    background: linear-gradient(135deg, #e53e3e 0%, #dc2626 100%); color: white;
    box-shadow: 0 2px 4px rgba(229, 62, 62, 0.2);
}
.badge-api-latest {
    background: #3b82f6; color: white;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

/* EXPAND ICON & DETAILS */
.expand-icon {
  width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
  background: #f1f5f9; border-radius: 50%; font-size: 12px; color: #64748b; transition: all 0.3s ease;
}
.device-item.expanded .expand-icon { transform: rotate(180deg); }
.device-details {
    max-height: 0; overflow: hidden; transition: max-height 0.4s ease-out;
    background: #fafbfc;
}
.device-item.expanded .device-details { max-height: none; height: auto; }
.details-grid {
  padding: 24px 32px; display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px;
}
.spec-group { background: white; border-radius: 12px; padding: 20px; border: 1px solid #e2e8f0; }
.spec-group h4 { margin: 0 0 16px 0; font-size: 16px; font-weight: 600; color: #374151; border-bottom: 2px solid #f1f5f9; padding-bottom: 8px; }
.spec-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid #f1f5f9; }
.spec-item:last-child { border-bottom: none; }
.spec-label { font-size: 14px; color: #64748b; font-weight: 500; }
.spec-value { font-size: 14px; color: #1e293b; font-weight: 600; text-align: right; }
.device-sources-section { margin-bottom: 20px; }
.source-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.source-selector { display: inline-flex; justify-content: center; align-items: center; padding: 6px 12px; border: 2px solid #e2e8f0; border-radius: 8px; background: #f8fafc; color: #64748b; font-size: 12px; font-weight: 600; font-family: 'Monaco', 'Consolas', monospace; cursor: pointer; transition: all 0.2s ease; min-width: 90px; }
.source-selector:hover { border-color: #cbd5e1; background: #f1f5f9; }
.source-selector.default-source, .source-selector.active { border-color: #e53e3e; background: linear-gradient(135deg, #e53e3e 0%, #dc2626 100%); color: white; box-shadow: 0 2px 4px rgba(229, 62, 62, 0.2); }
.features-section { margin-top: 16px; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-top: 8px; }
.feature-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #f8fafc; border-radius: 8px; border: 1px solid #e2e8f0; transition: all 0.2s ease; }
.feature-label { font-size: 13px; font-weight: 500; color: #374151; }

/* STATUS ICON BASE STYLES */
.status-icon { 
  width: 16px; height: 16px; border-radius: 50%; display: inline-flex; align-items: center; 
  justify-content: center; font-size: 10px; font-weight: 700; color: white; flex-shrink: 0; 
  transition: all 0.3s ease; 
}
.status-supported { background: #10b981; box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2); }
.status-supported::before { 
    content: "✓"; 
    font-weight: 800 !important;
    font-size: 11px !important;
    text-shadow: 0 0 1px rgba(0,0,0,0.3);
}
.status-unsupported { background: #ef4444; box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2); }
.status-unsupported::before { 
    content: "✗"; 
    font-weight: 800 !important;
    font-size: 11px !important;
    text-shadow: 0 0 1px rgba(0,0,0,0.3);
}

/* NUMERICAL FIELDS */
[data-feature="buttons"] > .status-icon,
.feature-item[data-manual-spec="true"][data-spec-type="number"] > .status-icon {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 16px !important;
    height: 16px !important;
    text-align: center !important;
    vertical-align: middle !important;
}

[data-feature="buttons"] > .status-icon::before,
[data-feature="buttons"] > .status-icon.status-supported::before,
[data-feature="buttons"] > .status-icon.status-unsupported::before,
.feature-item[data-manual-spec="true"][data-spec-type="number"] > .status-icon::before,
.feature-item[data-manual-spec="true"][data-spec-type="number"] > .status-icon.status-supported::before,
.feature-item[data-manual-spec="true"][data-spec-type="number"] > .status-icon.status-unsupported::before {
    display: none !important;
    content: none !important;
}

/* 0 values show X */
.feature-item[data-manual-spec="true"][data-spec-type="number"][data-spec-value="0"] > .status-icon::before,
[data-feature="buttons"][data-spec-value="0"] > .status-icon::before {
    display: block !important;
    content: "✗" !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    text-shadow: 0 0 1px rgba(0,0,0,0.3) !important;
}

.loading, .error { text-align: center; padding: 60px 32px; color: #64748b; }
.error { color: #ef4444; }
.loading::before { content: ""; display: inline-block; width: 20px; height: 20px; border: 2px solid #e2e8f0; border-top: 2px solid #64748b; border-radius: 50%; animation: spin 1s linear infinite; margin-right: 10px; }
.copy-sources-btn { background: none; border: none; cursor: pointer; padding: 4px; border-radius: 4px; color: #64748b; transition: all 0.2s ease; }
.copy-sources-btn:hover { background: #f1f5f9; color: #374151; }

/* IMAGE PREVIEWER */
.device-image-previewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background-color: #ffffff;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2), 0 4px 10px rgba(0, 0, 0, 0.1);
    border: 4px solid white;
    z-index: 9999;
    pointer-events: none;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease, background-color 0.3s ease;
}

.device-image-previewer.loading::before {
    content: none !important;
    display: none !important;
}

.device-image-previewer.visible {
    opacity: 1;
}

.device-image-previewer.loading {
    background-color: #ebebec;
}

.device-thumbnail {
    cursor: pointer;
}

/* TOOLTIPS */
.feature-item {
  position: relative;
  cursor: help;
}

.feature-item::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  height: 15px;
  background: transparent;
  z-index: 999;
  pointer-events: none;
}

.feature-item:hover::before {
  pointer-events: auto;
}

.feature-tooltip {
  position: absolute;
  bottom: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: white;
  padding: 16px 20px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  min-width: 200px;
  max-width: 320px;
  width: max-content;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25), 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  transform: translateX(-50%) translateY(-5px);
  max-width: min(320px, calc(100vw - 40px));
}

.feature-tooltip.visible {
  opacity: 1;
  pointer-events: auto;
}

.feature-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: var(--arrow-left, 50%);
  right: var(--arrow-right, auto);
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top-color: #1f2937;
}

.feature-tooltip:hover {
  opacity: 1 !important;
  pointer-events: auto !important;
}

.feature-tooltip[style*="right: 0"]::after {
  left: auto;
  right: var(--arrow-right, 20px);
  transform: none;
}

.feature-item:hover .feature-tooltip {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.features-grid {
  position: relative;
}

.feature-item .feature-tooltip {
  left: 50%;
  transform: translateX(-50%) translateY(-5px);
}

.feature-item:hover .feature-tooltip {
  transform: translateX(-50%) translateY(0);
}

/* dynamic positioning  */
@supports (container-type: inline-size) {
  .features-grid {
    container-type: inline-size;
  }

  @container (max-width: 600px) {
    .feature-tooltip {
      max-width: 250px;
    }
  }

  @container (max-width: 400px) {
    .feature-tooltip {
      max-width: 200px;
    }
  }
}

.feature-tooltip-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
  color: #f9fafb;
}

.feature-tooltip-description {
  margin-bottom: 10px;
  color: #e5e7eb;
  line-height: 1.5;
}

.feature-tooltip-link {
  color: #60a5fa;
  text-decoration: none;
  font-weight: 500;
  font-size: 12px;
  padding: 4px 8px;
  margin: -4px -8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background-color 0.2s ease;
}

.feature-tooltip-link:hover {
  background-color: rgba(96, 165, 250, 0.1);
  color: #93c5fd;
  text-decoration: underline;
}

.feature-tooltip-link::after {
  content: '↗';
  font-size: 10px;
  opacity: 0.8;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* MOBILE */
@media (max-width: 768px) {
  .zos-device-info-container { padding: 0px 0; }
  .zos-device-header { border-radius: 12px 12px 0 0; }
  .zos-controls-bar { grid-template-columns: 1fr; gap: 16px; padding: 16px; justify-items: center; margin: 16px auto; }
  #zos-device-search { justify-self: stretch; max-width: none; }
  #zos-stats, #zos-latest-versions { justify-self: center; }
  .device-list { margin: 0 16px; border-radius: 12px; }
  .device-header { padding: 16px; line-height: 1.6; }
  .details-grid { padding: 16px; }
  .device-name { line-height: 1.4; margin-bottom: 8px; }
  .spec-item { padding: 12px 0; }
  .feature-label { line-height: 1.5; }
  .zos-device-header {
    border-top-left-radius: 0px;
    border-top-right-radius: 0px;
  }

  .device-item.expanded .device-details {
      max-height: none !important;
      height: auto !important;
  }
  
  .device-details {
      transition: opacity 0.4s ease-out !important;
  }
  
  .device-item.expanded .device-details {
      opacity: 1;
  }

  .feature-tooltip {
      left: 12px !important;
      right: 12px !important;
      transform: translateY(-5px) !important;
      width: auto !important;
      min-width: auto !important;
      max-width: none !important;
      font-size: 12px;
      padding: 12px 16px;
  }
  
  .feature-item:hover .feature-tooltip {
      transform: translateY(0) !important;
  }
  
  .feature-tooltip::after {
      left: 50% !important;
      right: auto !important;
      transform: translateX(-50%) !important;
  }
  
  .feature-tooltip-title {
      font-size: 13px;
  }
}