/* ==================== タブコンポーネント ==================== */

/* タブコンテナ */
.tab-container {
  margin: 20px auto;
  max-width: 100%;
  width: 100%;
  padding: 0 20px;
  box-sizing: border-box;
}

/* メインタブボタン（カードデザイン） */
.tab-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  padding: 10px;
  background: rgba(3, 23, 44, 0.03);
  border-radius: 12px;
}

.tab-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 2px;
  border: 2px solid #dcd8d3;
  background: white;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  position: relative;
  pointer-events: auto;
}

.tab-button:hover {
  border-color: #c7661a;
  background: rgba(199, 102, 26, 0.05);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.tab-button.active {
  border-color: #03172c;
  background: linear-gradient(135deg, rgba(3, 23, 44, 0.1) 0%, rgba(199, 102, 26, 0.1) 100%);
  box-shadow: 0 4px 12px rgba(3, 23, 44, 0.15);
}

.tab-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  pointer-events: none;
}

.tab-button .tab-icon {
  font-size: 24px;
  line-height: 1;
  pointer-events: auto;
  display: inline-block;
}

.tab-button .tab-label {
  font-size: 13px;
  font-weight: 600;
  color: #03172c;
  text-align: center;
  pointer-events: auto;
  display: inline-block;
}

.tab-content {
  display: none;
  padding: 20px 0;
}

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

/* システム分析サブタブ */
.system-tab-content {
  display: none;
  padding: 20px 0;
}

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

/* システム分析サブタブボタン（従来のタブデザイン） */
.system-sub-tabs {
  display: flex;
  justify-content: center;
  border-bottom: 2px solid #dcd8d3;
  flex-wrap: wrap;
  gap: 0;
  margin-bottom: 20px;
}

.system-tab-button {
  padding: 12px 24px;
  border: none;
  background-color: transparent;
  cursor: pointer;
  font-weight: 600;
  color: #666;
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
  position: relative;
  pointer-events: auto;
}

.system-tab-button:hover {
  background-color: rgba(74, 143, 127, 0.05);
  color: #03172c;
}

.system-tab-button.active {
  color: var(--color-tab-active);
  border-bottom-color: var(--color-tab-active-border);
  background-color: rgba(74, 143, 127, 0.1);
}

.system-tab-button .tab-icon {
  margin-right: 4px;
  pointer-events: none;
  display: inline-block;
}

.system-tab-button .tab-label {
  font-size: 14px;
  pointer-events: none;
  display: inline-block;
}

/* アイコンタブボタン（分析ページ用） */
.icon-tab-button {
  padding: 12px 20px;
  margin: 0 8px;
  border: 2px solid #dcd8d3;
  background: white;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-tab-button img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.icon-tab-button:hover {
  border-color: #c7661a;
  background: rgba(199, 102, 26, 0.05);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.icon-tab-button.active {
  border-color: #03172c;
  background: linear-gradient(135deg, rgba(3, 23, 44, 0.1) 0%, rgba(199, 102, 26, 0.1) 100%);
  box-shadow: 0 4px 12px rgba(3, 23, 44, 0.15);
}

/* ==================== デバイスタイプタブ ==================== */

.device-type-tabs {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 15px 0;
  flex-wrap: wrap;
}

.device-type-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 24px;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  cursor: pointer;
  border: 1px solid #dcd8d3;
  background: rgba(255, 255, 255, 0.9);
  color: #03172c;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.device-type-tab:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  background: #f0eeea;
}

.device-type-tab.active {
  background: var(--color-csv-button);
  color: white;
  border-color: var(--color-csv-button);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.device-type-tab.active:hover {
  background: var(--color-csv-button-hover);
  border-color: var(--color-csv-button-hover);
}

/* ==================== レスポンシブ ==================== */

@media (max-width: 1024px) {
  .tab-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
  }

  .tab-button {
    padding: 8px 16px;
    font-size: 14px;
    flex: 1;
    min-width: 120px;
  }
}

@media (max-width: 768px) {
  .tab-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .tab-button {
    width: 100%;
    padding: 12px;
    font-size: 14px;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .tab-button {
    padding: 10px;
    font-size: 12px;
  }
}

/* ==================== タッチデバイス対応 ==================== */

@media (pointer: coarse) {
  .tab-button {
    padding: var(--spacing-4);
  }
}

/* タッチデバイス専用のホバー防止 */
@media (hover: none) {
  .tab-button:hover {
    transform: none;
  }
}

/* 高コントラストモード対応 */
@media (prefers-contrast: high) {
  .tab-button {
    border: 2px solid currentColor;
  }
}
